add cram based unit tests
[project/libubox.git] / tests / cram / test_jshn.t
1 set jshn for convenience:
2
3 $ [ -n "$JSHN" ] && export PATH="$(dirname "$JSHN"):$PATH"
4 $ alias jshn="valgrind --quiet --leak-check=full jshn"
5
6 check usage:
7
8 $ jshn
9 Usage: jshn [-n] [-i] -r <message>|-R <file>|-w
10 [2]
11
12 test bad json:
13
14 $ jshn -r '[]'
15 Failed to parse message data
16 [1]
17
18 test good json:
19
20 $ jshn -r '{"foo": "bar", "baz": {"next": "meep"}}'
21 json_init;
22 json_add_string 'foo' 'bar';
23 json_add_object 'baz';
24 json_add_string 'next' 'meep';
25 json_close_object;