I am learning scala, and want to write my tests with ===
. However, I am curious if there is a way to do something like this:
assert(1 !=== 2)
I have tried the above, !==
, and !(===)
Is there any way to get the descriptiveness of ===
and use negation?
ScalaTest doesn't have a
!==
method (it's actually in the source code and is commented out). You could implement your own analogue, like:Then it becomes as simple to use as
===
:Note that this is a simplified version of
===
that doesn't do deep array comparisons and doesn't generate a nice diff like ScalaTest does.