nixite/testing/it.nix

17 lines
492 B
Nix
Raw Normal View History

msg:
2024-01-01 06:33:57 +00:00
{ actual, expected, asString ? false, asJSON ? false, removeDunders ? false, }:
if (if asString then
toString actual == toString expected
else if asJSON then
builtins.toJSON actual == builtins.toJSON expected
2024-01-01 06:33:57 +00:00
else if removeDunders then
builtins.removeAttrs actual [ "__toString" "__functor" ] == expected
else
actual == expected) then ''
echo 'it ${msg}'
'' else ''
echo 'FAILED: ${msg}'
echo '${builtins.toJSON expected}'
echo '${builtins.toJSON actual}'
''