jrsonnet icon indicating copy to clipboard operation
jrsonnet copied to clipboard

Weird assert: null

Open vklachkov opened this issue 4 months ago • 1 comments

I don't know what the assert should look like, but for some reason, it now outputs null instead of a clear error message.

Command:

jrsonnet -e 'local x=1, y=2; assert x == y; {}'

Current output:

assert failed: null
    <cmdline>:1:8-32: assertion failure

Expected output:

assert failed: 1 != 2
    <cmdline>:1:8-32: assertion failure

vklachkov avatar Oct 18 '25 04:10 vklachkov

Full assert syntax is:

assert condition [ : message ] ; value

If message not specified (assert condition ; value) - it equals to null, this behavior is consistent with other jsonnet implementations.

There is no special parsing rules for assert, there is however std.assertEqual which implements special formatting for equality operation.

CertainLach avatar Oct 18 '25 05:10 CertainLach