1
1
mirror of https://github.com/wader/fq.git synced 2024-11-30 09:58:13 +03:00
fq/pkg/interp/assert.jq

12 lines
289 B
Plaintext
Raw Normal View History

2021-08-21 19:52:29 +03:00
def log: if env.VERBOSE then stderr else empty end;
2021-08-14 20:50:17 +03:00
def assert($name; $expected; $actual):
( if $expected == $actual then
2021-08-21 19:52:29 +03:00
"PASS \($name)\n" | log
2020-06-08 03:29:51 +03:00
else
2021-08-14 20:50:17 +03:00
( "FAIL \($name): expected \($expected) got \($actual)\n" | stderr
2020-06-08 03:29:51 +03:00
, (null | halt_error(1))
)
end
);