Closed jsab closed 5 years ago
Looks like a bug indeed. Guess we should look into this. I won't have any time for CIDER until the end of the month at least, so help would be appreciated.
My guess is that this behavior would disappear if he used cider-refresh
to reload all the code at the same time. Two types on the jvm are equal if they are both the same and were loaded with the same classloader.
Can you try that @jsab?
@expez cider-refresh
does not make the test pass.
Steps used:
M-x cider-refresh
-> Cider refresh: Reloading successfulM-x cider-test-run-ns-tests
-> FailThere are now two tests in the project so that you can see the behavior for last expression or not last expression in the same test run.
@jsab how can you demonstrate the lein test
does not have this behavior? It seems that CIDER's test run results in all passing on the first run, but then after re-evaling the source buffer, it starts having issues. It seems lein test
would only simulate our first successful run, correct?
@dpsutton Agreed. I included this information because when talking in freenode#clojure about the issue and where I should file it, it was one of the first thing people wanted to know.
Cannot reproduce using
CIDER 0.17.0snapshot (package: 20180131.913), nREPL 0.2.13
Clojure 1.8.0, Java 1.8.0_151
Hmm, was able to reproduce when using cider-refresh
instead of cider-eval-buffer
.
This bug is actually pretty extraordinary--I've no idea why it's behaving the way it is!
(deftest a-test
(is (= (.getClassLoader test_record.core.MyRecord) (.getClassLoader (type (map->MyRecord {})))))
(is (= 1 1)))
;; => fail
(deftest c-test
(let [cl1 (.getClassLoader test_record.core.MyRecord)
cl2 (.getClassLoader (type (map->MyRecord {})))]
(is (= cl1 cl2)))
(is (= 1 1)))
;; => pass
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it.
Expected behavior
The order of
is
assertions withing adeftest
form should not impact their execution.Actual behavior
After a
defrecord
form has been evaluated more than once. An assertion on the type of the record will succeed if it is the last assertion in adeftest
but will fail if there is one or more assertions after.Note that running
lein test
does not exhibit the problem.Steps to reproduce the problem
Use minimal project:
https://github.com/jsab/test-record
Follow steps in the
README.md
file. At the time of the creation of the issue, they are:M-x cider-jack-in
M-x cider-eval-buffer
in core_test.cljM-x cider-test-run-ns-tests
-> PASSM-x cider-eval-buffer
in core.cljM-x cider-test-run-ns-tests
-> FAILM-x cider-eval-buffer
in core_test.cljM-x cider-test-run-ns-tests
-> PASSM-x cider-eval-buffer
in core_test.cljM-x cider-test-run-ns-tests
-> FAILUsing
cider-load-buffer
instead ofcider-eval-buffer
yields the same results.Environment & Version information
CIDER version information
Lein/Boot version
Leiningen 2.7.1 on Java 1.8.0_112 Java HotSpot(TM) 64-Bit Server VM
Emacs version
GNU Emacs 25.1.1 (x86_64-apple-darwin16.3.0, NS appkit-1504.76 Version 10.12.2 (Build 16C67)) of 2017-01-06
Operating system
macOS Sierra 10.12.2 (16C67)