ohler55 / ojg

Optimized JSON for Go
MIT License
857 stars 49 forks source link

asm.cond doesn't evaluate expressions #138

Closed tmth-iskhakov closed 1 year ago

tmth-iskhakov commented 1 year ago

cond function description says "All arguments must be array of two elements. The first element must evaluate to a boolean", but it doesn't evaluate provided expression. We can take a line from cond_test:

..
[set $.asm.a [cond [true abc]]]
..

and replace it with

..
[set $.asm.a [cond [[not false] abc]]]
..

test will fail because not expression will not be evaluated (can be checked in debbuger)

ohler55 commented 1 year ago

I'll update the tests and get it fixed. Travelling now so it might take a few days or more than a week.

ohler55 commented 1 year ago

Please try the "cond-eval" branch. It needs a few more tests but seems to work so far.

tmth-iskhakov commented 1 year ago

It works now. Thanks a lot.

ohler55 commented 1 year ago

Released v1.19.3 with the fix.