Thanks to visit codestin.com
Credit goes to github.com

Skip to content

zprint.main-test failing when run on my dev box #355

@lread

Description

@lread

Hiya @kkinnear!

While updating zprint to 1.3.0 in rewrite-clj's canary tests, I noticed that a test in main-tests is failing for me.

Environment

Linux Pop!_OS, JDK 17

Setup

$ git clone [email protected]:kkinnear/zprint.git
$ cd zprint 
$ git reset 1.3.0 --hard

Repro

$ clojure -Srepro -M:cljtest

Expected Behaviour

All tests pass

Actual Behaviour

I get a single test failing:

Running tests in #{"test"}

Testing zprint.comment-test

Testing zprint.config-test

Testing zprint.core-test

Testing zprint.finish-test

Testing zprint.guide-test

Testing zprint.main-test

FAIL in (main-tests) (main_test.cljc:211)
(with-out-str (binding [*err* *out*] (-main ":debug" "{:files {:glob \"tt*_test.clj\"}}" "-lfsw")))

matches: "Processing file tt"
>>>  expected diverges: "t_test.clj\n2_test.clj\nFailed to write output file: tt2_test.clj because java.io.FileNotFoundException: tt2_test.clj (Permission denied)\nProcessed 2 files, with 1 error, 1 of which required formatting.\n"
>>>    actual diverges: "2_test.clj\nFailed to write output file: tt2_test.clj because java.io.FileNotFoundException: tt2_test.clj (Permission denied)\nt_test.clj\nProcessed 2 files, with 1 error, 1 of which required formatting.\n"

expected: "Processing file ttt_test.clj\nProcessing file tt2_test.clj\nFailed to write output file: tt2_test.clj because java.io.FileNotFoundException: tt2_test.clj (Permission denied)\nProcessed 2 files, with 1 error, 1 of which required formatting.\n"
  actual: "Processing file tt2_test.clj\nFailed to write output file: tt2_test.clj because java.io.FileNotFoundException: tt2_test.clj (Permission denied)\nProcessing file ttt_test.clj\nProcessed 2 files, with 1 error, 1 of which required formatting.\n"
    diff: - "Processing file ttt_test.clj\nProcessing file tt2_test.clj\nFailed to write output file: tt2_test.clj because java.io.FileNotFoundException: tt2_test.clj (Permission denied)\nProcessed 2 files, with 1 error, 1 of which required formatting.\n"
          + "Processing file tt2_test.clj\nFailed to write output file: tt2_test.clj because java.io.FileNotFoundException: tt2_test.clj (Permission denied)\nProcessing file ttt_test.clj\nProcessed 2 files, with 1 error, 1 of which required formatting.\n"
Didn't find uberjar target/zprint-filter-1.3.0 , skipping 13 uberjar tests!!

Testing zprint.range-test

Testing zprint.rewrite-test

Testing zprint.spec-test

Testing zprint.zprint-test

Testing zprint.zutil-test

Ran 11 tests containing 2001 assertions.
1 failures, 0 errors.

Diagnosis

Source for failing test:

(expect
"Processing file ttt_test.clj\nProcessing file tt2_test.clj\nFailed to write output file: tt2_test.clj because java.io.FileNotFoundException: tt2_test.clj (Permission denied)\nProcessed 2 files, with 1 error, 1 of which required formatting.\n"
(with-out-str
(binding [*err* *out*]
(-main ":debug" "{:files {:glob \"tt*_test.clj\"}}" "-lfsw"))))

It looks to me like the test expects the files to be processed in a specific order.
But that specific order does not match on my particular dev box.

Perhaps if zprint were to sort files resulting from a glob match before processing them, that would do the trick?

I'll go ahead and tell rewrite-clj to skip this test when testing against zprint 1.3.0, but thought you'd be interested to know about the failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions