libubox/tests/cram/test_jshn.t
Petr Štetiar b0a5cd8a28 add cram based unit tests
For improved QA etc. For the start with initial test cases for avl,
base64, jshn and list components. Moved runqueue and blobmsg from
examples to tests.  Converted just a few first test cases from
json-script example into the new cram based unit test, more to come.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-24 13:26:58 +01:00

25 lines
491 B
Perl

set jshn for convenience:
$ [ -n "$JSHN" ] && export PATH="$(dirname "$JSHN"):$PATH"
$ alias jshn="valgrind --quiet --leak-check=full jshn"
check usage:
$ jshn
Usage: jshn [-n] [-i] -r <message>|-R <file>|-w
[2]
test bad json:
$ jshn -r '[]'
Failed to parse message data
[1]
test good json:
$ jshn -r '{"foo": "bar", "baz": {"next": "meep"}}'
json_init;
json_add_string 'foo' 'bar';
json_add_object 'baz';
json_add_string 'next' 'meep';
json_close_object;