Fork me on GitHub
#testing
<
2017-09-21
>
vuuvi14:09:07

can someone help explain to me why clojure.test isn’t trying to compare the evaluation of a function I’ve written?

expected: (= (hello_world) "Hello World!")
  actual: (not (= "Hello, World!" "Hello World!"))

donaldball14:09:25

I think you may be misunderstanding the output

noisesmith14:09:31

the expected shows the forms, the actual shows the values

noisesmith14:09:23

since the actual values in the form make it much easier to see what made the test fail, usually

vuuvi14:09:28

the actual output is what I want, not what I want expected

noisesmith14:09:49

the expected part is also useful, because it shows me exactly what form was evaluated to get a given value

noisesmith14:09:03

(though of course you can easily see that by reading the test)

vuuvi14:09:11

yeah I know! But the thing that’s confusing me is the expected output is more literal than I want

noisesmith14:09:25

I fix this with a let block

vuuvi14:09:28

I just want to test that the string the hello_world function returns is “Hello World!”

noisesmith14:09:39

that is what you are testing...

vuuvi14:09:25

okay that’s what I thought - then why is it returning false?

noisesmith14:09:36

because one has a comma in it

noisesmith14:09:57

there's a plugin, "lein difftest" that highlights data differences in assertions btw

vuuvi14:09:19

oh wow that’s a stupid mistake

noisesmith14:09:23

it works with the tests you have already, it just uses different output formats to make it more clear

vuuvi14:09:26

thanks for the info / second set of eye balls

vuuvi14:09:40

that’s great I didn’t know about that!