Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(= [1] '(1)), but it shows up in the diff anyway #9

Open
durka opened this issue Jul 16, 2013 · 0 comments
Open

(= [1] '(1)), but it shows up in the diff anyway #9

durka opened this issue Jul 16, 2013 · 0 comments

Comments

@durka
Copy link

durka commented Jul 16, 2013

When a test fails due to unequal maps, difftest flags a key where only the type of collection differs, not the content. This is a false positive because those collections are still equal (and if the maps are otherwise equal, the test does not fail).

Here is what I mean:

(deftest bad
   (testing "oops"
     (is (= {:a [1] :b 2} {:a '(1) :b 2}) "all else equal")
     (is (= {:a [1] :b 2} {:a '(1) :b 3}) "all else unequal")))

and the output

FAIL in (bad) (bug.clj:100)
oops
all else unequal
expected: (= {:a [1], :b 2} {:a (quote (1)), :b 3})
  actual:
   {:a
 - (1)
 + [1]
   , :b
 - 3
 + 2
   }

You can see that the first test passed when considering only [1] vs '(1), and the second failed due to :b, but difftest picks up :a as well even though Clojure does not care.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant