2023-12-31 21:33:42 +00:00
|
|
|
msg:
|
2024-01-01 06:33:57 +00:00
|
|
|
{ actual, expected, asString ? false, asJSON ? false, removeDunders ? false, }:
|
2024-01-01 08:10:32 +00:00
|
|
|
let
|
2024-01-01 09:43:52 +00:00
|
|
|
preProcess = v:
|
|
|
|
if removeDunders then
|
|
|
|
builtins.removeAttrs v [ "__toString" "__functor" ]
|
|
|
|
else if asString then
|
|
|
|
toString v
|
|
|
|
else if asJSON then
|
|
|
|
builtins.toJSON v
|
|
|
|
else
|
|
|
|
v;
|
|
|
|
|
2024-01-01 08:10:32 +00:00
|
|
|
a = preProcess actual;
|
|
|
|
e = preProcess expected;
|
|
|
|
|
2024-01-01 09:43:52 +00:00
|
|
|
in if (a == e) then ''
|
|
|
|
echo 'it ${msg}'
|
|
|
|
'' else
|
|
|
|
builtins.trace actual
|
|
|
|
builtins.trace expected
|
|
|
|
''
|
|
|
|
echo FAILED ${msg}
|
|
|
|
''
|