3 $ [ -n "$TEST_BIN_DIR" ] && export PATH="$TEST_BIN_DIR:$PATH"
4 $ export TEST_INPUTS="$TESTDIR/inputs"
5 $ alias js="valgrind --quiet --leak-check=full test-json-script"
6 $ alias js-san="test-json-script-san"
8 check that json-script is producing expected results:
11 Usage: test-json-script [VARNAME=value] <filename_json_script>
15 Usage: test-json-script-san [VARNAME=value] <filename_json_script>
18 $ echo '}' > test.json; js test.json
19 load JSON data from test.json failed.
21 $ echo '}' > test.json; js-san test.json
22 load JSON data from test.json failed.
24 $ js nada.json 2>&1 | grep load.*failed
25 load JSON data from nada.json failed.
27 $ js-san nada.json 2>&1 | grep load.*failed
28 load JSON data from nada.json failed.
30 $ echo '[ [ ] [ ] ]' > test.json; js test.json
31 load JSON data from test.json failed.
33 $ echo '[ [ ] [ ] ]' > test.json; js-san test.json
34 load JSON data from test.json failed.
36 check example json-script:
38 $ js $TEST_INPUTS/json-script.json
42 $ js-san $TEST_INPUTS/json-script.json
46 $ js EXECVAR=meh ORVAR=meep $TEST_INPUTS/json-script.json
50 $ js-san EXECVAR=meh ORVAR=meep $TEST_INPUTS/json-script.json
65 $ js VAR=foo test.json
68 $ js-san VAR=foo test.json
71 $ js VAR=bar test.json
74 $ js-san VAR=bar test.json
88 > [ "eq", "VAR", "bar" ],
94 $ js VAR=bar test.json
97 $ js-san VAR=bar test.json
100 $ js VAR=xxx test.json
103 $ js-san VAR=xxx test.json
112 check regex single expression:
117 > [ "regex", "VAR", ".ell." ],
123 $ js VAR=hello test.json
126 $ js-san VAR=hello test.json
129 $ js VAR=.ell. test.json
132 $ js-san VAR=.ell. test.json
144 $ js-san VAR= test.json
147 $ js VAR=hell test.json
150 $ js-san VAR=hell test.json