Refactor the test system
authorPetri Lehtinen <petri@digip.org>
Mon, 14 Dec 2009 21:01:36 +0000 (23:01 +0200)
committerPetri Lehtinen <petri@digip.org>
Wed, 16 Dec 2009 20:45:29 +0000 (22:45 +0200)
385 files changed:
configure.ac
test/.gitignore
test/Makefile.am
test/bin/Makefile.am [new file with mode: 0644]
test/bin/json_process.c [new file with mode: 0644]
test/json-compare.py [deleted file]
test/load_file_dump_file.c [deleted file]
test/loadf_dumpf.c [deleted file]
test/loads_dumps.c [deleted file]
test/run-suites [new file with mode: 0755]
test/run-test [deleted file]
test/scripts/run-tests.sh [new file with mode: 0644]
test/scripts/valgrind.sh [new file with mode: 0644]
test/split-testfile.py [deleted file]
test/suites/Makefile.am [moved from test/testdata/Makefile.am with 83% similarity]
test/suites/api/Makefile.am [moved from test/testprogs/Makefile.am with 71% similarity]
test/suites/api/run [new file with mode: 0755]
test/suites/api/test_array.c [moved from test/testprogs/test_array.c with 100% similarity]
test/suites/api/test_dump.c [moved from test/testprogs/test_dump.c with 100% similarity]
test/suites/api/test_load.c [moved from test/testprogs/test_load.c with 100% similarity]
test/suites/api/test_number.c [moved from test/testprogs/test_number.c with 100% similarity]
test/suites/api/test_object.c [moved from test/testprogs/test_object.c with 100% similarity]
test/suites/api/test_simple.c [moved from test/testprogs/test_simple.c with 100% similarity]
test/suites/api/util.h [moved from test/testprogs/util.h with 100% similarity]
test/suites/invalid-strip/apostrophe/error [new file with mode: 0644]
test/suites/invalid-strip/apostrophe/input [new file with mode: 0644]
test/suites/invalid-strip/ascii-unicode-identifier/error [new file with mode: 0644]
test/suites/invalid-strip/ascii-unicode-identifier/input [new file with mode: 0644]
test/suites/invalid-strip/brace-comma/error [new file with mode: 0644]
test/suites/invalid-strip/brace-comma/input [new file with mode: 0644]
test/suites/invalid-strip/bracket-comma/error [new file with mode: 0644]
test/suites/invalid-strip/bracket-comma/input [new file with mode: 0644]
test/suites/invalid-strip/bracket-one-comma/error [new file with mode: 0644]
test/suites/invalid-strip/bracket-one-comma/input [new file with mode: 0644]
test/suites/invalid-strip/empty/error [new file with mode: 0644]
test/suites/invalid-strip/empty/input [new file with mode: 0644]
test/suites/invalid-strip/extra-comma-in-array/error [new file with mode: 0644]
test/suites/invalid-strip/extra-comma-in-array/input [new file with mode: 0644]
test/suites/invalid-strip/extra-command-in-multiline-array/error [new file with mode: 0644]
test/suites/invalid-strip/extra-command-in-multiline-array/input [new file with mode: 0644]
test/suites/invalid-strip/garbage-after-newline/error [new file with mode: 0644]
test/suites/invalid-strip/garbage-after-newline/input [new file with mode: 0644]
test/suites/invalid-strip/garbage-at-the-end/error [new file with mode: 0644]
test/suites/invalid-strip/garbage-at-the-end/input [new file with mode: 0644]
test/suites/invalid-strip/integer-starting-with-zero/error [new file with mode: 0644]
test/suites/invalid-strip/integer-starting-with-zero/input [new file with mode: 0644]
test/suites/invalid-strip/invalid-escape/error [new file with mode: 0644]
test/suites/invalid-strip/invalid-escape/input [new file with mode: 0644]
test/suites/invalid-strip/invalid-identifier/error [new file with mode: 0644]
test/suites/invalid-strip/invalid-identifier/input [new file with mode: 0644]
test/suites/invalid-strip/invalid-negative-integerr/error [new file with mode: 0644]
test/suites/invalid-strip/invalid-negative-integerr/input [new file with mode: 0644]
test/suites/invalid-strip/invalid-negative-real/error [new file with mode: 0644]
test/suites/invalid-strip/invalid-negative-real/input [new file with mode: 0644]
test/suites/invalid-strip/invalid-second-surrogate/error [new file with mode: 0644]
test/suites/invalid-strip/invalid-second-surrogate/input [new file with mode: 0644]
test/suites/invalid-strip/lone-open-brace/error [new file with mode: 0644]
test/suites/invalid-strip/lone-open-brace/input [new file with mode: 0644]
test/suites/invalid-strip/lone-open-bracket/error [new file with mode: 0644]
test/suites/invalid-strip/lone-open-bracket/input [new file with mode: 0644]
test/suites/invalid-strip/lone-second-surrogate/error [new file with mode: 0644]
test/suites/invalid-strip/lone-second-surrogate/input [new file with mode: 0644]
test/suites/invalid-strip/minus-sign-without-number/error [new file with mode: 0644]
test/suites/invalid-strip/minus-sign-without-number/input [new file with mode: 0644]
test/suites/invalid-strip/negative-integer-starting-with-zero/error [new file with mode: 0644]
test/suites/invalid-strip/negative-integer-starting-with-zero/input [new file with mode: 0644]
test/suites/invalid-strip/null-byte-in-string/error [new file with mode: 0644]
test/suites/invalid-strip/null-byte-in-string/input [new file with mode: 0644]
test/suites/invalid-strip/null/error [new file with mode: 0644]
test/suites/invalid-strip/null/input [new file with mode: 0644]
test/suites/invalid-strip/object-apostrophes/error [new file with mode: 0644]
test/suites/invalid-strip/object-apostrophes/input [new file with mode: 0644]
test/suites/invalid-strip/object-garbage-at-end/error [new file with mode: 0644]
test/suites/invalid-strip/object-garbage-at-end/input [new file with mode: 0644]
test/suites/invalid-strip/object-in-unterminated-array/error [new file with mode: 0644]
test/suites/invalid-strip/object-in-unterminated-array/input [new file with mode: 0644]
test/suites/invalid-strip/object-no-colon/error [new file with mode: 0644]
test/suites/invalid-strip/object-no-colon/input [new file with mode: 0644]
test/suites/invalid-strip/object-no-value/error [new file with mode: 0644]
test/suites/invalid-strip/object-no-value/input [new file with mode: 0644]
test/suites/invalid-strip/object-unterminated-value/error [new file with mode: 0644]
test/suites/invalid-strip/object-unterminated-value/input [new file with mode: 0644]
test/suites/invalid-strip/real-garbage-after-e/error [new file with mode: 0644]
test/suites/invalid-strip/real-garbage-after-e/input [new file with mode: 0644]
test/suites/invalid-strip/real-negative-overflow/error [new file with mode: 0644]
test/suites/invalid-strip/real-negative-overflow/input [new file with mode: 0644]
test/suites/invalid-strip/real-positive-overflow/error [new file with mode: 0644]
test/suites/invalid-strip/real-positive-overflow/input [new file with mode: 0644]
test/suites/invalid-strip/real-truncated-at-e/error [new file with mode: 0644]
test/suites/invalid-strip/real-truncated-at-e/input [new file with mode: 0644]
test/suites/invalid-strip/real-truncated-at-point/error [new file with mode: 0644]
test/suites/invalid-strip/real-truncated-at-point/input [new file with mode: 0644]
test/suites/invalid-strip/real-underflow/error [new file with mode: 0644]
test/suites/invalid-strip/real-underflow/input [new file with mode: 0644]
test/suites/invalid-strip/run [new file with mode: 0755]
test/suites/invalid-strip/tab-character-in-string/error [new file with mode: 0644]
test/suites/invalid-strip/tab-character-in-string/input [new file with mode: 0644]
test/suites/invalid-strip/too-big-negative-integer/error [new file with mode: 0644]
test/suites/invalid-strip/too-big-negative-integer/input [new file with mode: 0644]
test/suites/invalid-strip/too-big-positive-integer/error [new file with mode: 0644]
test/suites/invalid-strip/too-big-positive-integer/input [new file with mode: 0644]
test/suites/invalid-strip/truncated-unicode-surrogate/error [new file with mode: 0644]
test/suites/invalid-strip/truncated-unicode-surrogate/input [new file with mode: 0644]
test/suites/invalid-strip/unicode-identifier/error [new file with mode: 0644]
test/suites/invalid-strip/unicode-identifier/input [new file with mode: 0644]
test/suites/invalid-strip/unterminated-array-and-object/error [new file with mode: 0644]
test/suites/invalid-strip/unterminated-array-and-object/input [new file with mode: 0644]
test/suites/invalid-strip/unterminated-array/error [new file with mode: 0644]
test/suites/invalid-strip/unterminated-array/input [new file with mode: 0644]
test/suites/invalid-strip/unterminated-empty-key/error [new file with mode: 0644]
test/suites/invalid-strip/unterminated-empty-key/input [new file with mode: 0644]
test/suites/invalid-strip/unterminated-key/error [new file with mode: 0644]
test/suites/invalid-strip/unterminated-key/input [new file with mode: 0644]
test/suites/invalid-strip/unterminated-object-and-array/error [new file with mode: 0644]
test/suites/invalid-strip/unterminated-object-and-array/input [new file with mode: 0644]
test/suites/invalid-strip/unterminated-string/error [new file with mode: 0644]
test/suites/invalid-strip/unterminated-string/input [new file with mode: 0644]
test/suites/invalid-unicode/encoded-surrogate-half/error [new file with mode: 0644]
test/suites/invalid-unicode/encoded-surrogate-half/input [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-after-backslash/error [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-after-backslash/input [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-array/error [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-array/input [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/error [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/input [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-escape/error [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-escape/input [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-exponent/error [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-exponent/input [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-identifier/error [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-identifier/input [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-int/error [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-int/input [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/error [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/input [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-string/error [new file with mode: 0644]
test/suites/invalid-unicode/invalid-utf-8-in-string/input [new file with mode: 0644]
test/suites/invalid-unicode/lone-invalid-utf-8/error [new file with mode: 0644]
test/suites/invalid-unicode/lone-invalid-utf-8/input [new file with mode: 0644]
test/suites/invalid-unicode/lone-utf-8-continuation-byte/error [new file with mode: 0644]
test/suites/invalid-unicode/lone-utf-8-continuation-byte/input [new file with mode: 0644]
test/suites/invalid-unicode/not-in-unicode-range/error [new file with mode: 0644]
test/suites/invalid-unicode/not-in-unicode-range/input [new file with mode: 0644]
test/suites/invalid-unicode/overlong-3-byte-encoding/error [new file with mode: 0644]
test/suites/invalid-unicode/overlong-3-byte-encoding/input [new file with mode: 0644]
test/suites/invalid-unicode/overlong-4-byte-encoding/error [new file with mode: 0644]
test/suites/invalid-unicode/overlong-4-byte-encoding/input [new file with mode: 0644]
test/suites/invalid-unicode/overlong-ascii-encoding/error [new file with mode: 0644]
test/suites/invalid-unicode/overlong-ascii-encoding/input [new file with mode: 0644]
test/suites/invalid-unicode/restricted-utf-8/error [new file with mode: 0644]
test/suites/invalid-unicode/restricted-utf-8/input [new file with mode: 0644]
test/suites/invalid-unicode/run [new file with mode: 0755]
test/suites/invalid-unicode/truncated-utf-8/error [new file with mode: 0644]
test/suites/invalid-unicode/truncated-utf-8/input [new file with mode: 0644]
test/suites/invalid/apostrophe/error [new file with mode: 0644]
test/suites/invalid/apostrophe/input [new file with mode: 0644]
test/suites/invalid/ascii-unicode-identifier/error [new file with mode: 0644]
test/suites/invalid/ascii-unicode-identifier/input [new file with mode: 0644]
test/suites/invalid/brace-comma/error [new file with mode: 0644]
test/suites/invalid/brace-comma/input [new file with mode: 0644]
test/suites/invalid/bracket-comma/error [new file with mode: 0644]
test/suites/invalid/bracket-comma/input [new file with mode: 0644]
test/suites/invalid/bracket-one-comma/error [new file with mode: 0644]
test/suites/invalid/bracket-one-comma/input [new file with mode: 0644]
test/suites/invalid/empty/error [new file with mode: 0644]
test/suites/invalid/empty/input [new file with mode: 0644]
test/suites/invalid/extra-comma-in-array/error [new file with mode: 0644]
test/suites/invalid/extra-comma-in-array/input [new file with mode: 0644]
test/suites/invalid/extra-command-in-multiline-array/error [new file with mode: 0644]
test/suites/invalid/extra-command-in-multiline-array/input [new file with mode: 0644]
test/suites/invalid/garbage-after-newline/error [new file with mode: 0644]
test/suites/invalid/garbage-after-newline/input [new file with mode: 0644]
test/suites/invalid/garbage-at-the-end/error [new file with mode: 0644]
test/suites/invalid/garbage-at-the-end/input [new file with mode: 0644]
test/suites/invalid/integer-starting-with-zero/error [new file with mode: 0644]
test/suites/invalid/integer-starting-with-zero/input [new file with mode: 0644]
test/suites/invalid/invalid-escape/error [new file with mode: 0644]
test/suites/invalid/invalid-escape/input [new file with mode: 0644]
test/suites/invalid/invalid-identifier/error [new file with mode: 0644]
test/suites/invalid/invalid-identifier/input [new file with mode: 0644]
test/suites/invalid/invalid-negative-integerr/error [new file with mode: 0644]
test/suites/invalid/invalid-negative-integerr/input [new file with mode: 0644]
test/suites/invalid/invalid-negative-real/error [new file with mode: 0644]
test/suites/invalid/invalid-negative-real/input [new file with mode: 0644]
test/suites/invalid/invalid-second-surrogate/error [new file with mode: 0644]
test/suites/invalid/invalid-second-surrogate/input [new file with mode: 0644]
test/suites/invalid/lone-open-brace/error [new file with mode: 0644]
test/suites/invalid/lone-open-brace/input [new file with mode: 0644]
test/suites/invalid/lone-open-bracket/error [new file with mode: 0644]
test/suites/invalid/lone-open-bracket/input [new file with mode: 0644]
test/suites/invalid/lone-second-surrogate/error [new file with mode: 0644]
test/suites/invalid/lone-second-surrogate/input [new file with mode: 0644]
test/suites/invalid/minus-sign-without-number/error [new file with mode: 0644]
test/suites/invalid/minus-sign-without-number/input [new file with mode: 0644]
test/suites/invalid/negative-integer-starting-with-zero/error [new file with mode: 0644]
test/suites/invalid/negative-integer-starting-with-zero/input [new file with mode: 0644]
test/suites/invalid/null-byte-in-string/error [new file with mode: 0644]
test/suites/invalid/null-byte-in-string/input [new file with mode: 0644]
test/suites/invalid/null/error [new file with mode: 0644]
test/suites/invalid/null/input [new file with mode: 0644]
test/suites/invalid/object-apostrophes/error [new file with mode: 0644]
test/suites/invalid/object-apostrophes/input [new file with mode: 0644]
test/suites/invalid/object-garbage-at-end/error [new file with mode: 0644]
test/suites/invalid/object-garbage-at-end/input [new file with mode: 0644]
test/suites/invalid/object-in-unterminated-array/error [new file with mode: 0644]
test/suites/invalid/object-in-unterminated-array/input [new file with mode: 0644]
test/suites/invalid/object-no-colon/error [new file with mode: 0644]
test/suites/invalid/object-no-colon/input [new file with mode: 0644]
test/suites/invalid/object-no-value/error [new file with mode: 0644]
test/suites/invalid/object-no-value/input [new file with mode: 0644]
test/suites/invalid/object-unterminated-value/error [new file with mode: 0644]
test/suites/invalid/object-unterminated-value/input [new file with mode: 0644]
test/suites/invalid/real-garbage-after-e/error [new file with mode: 0644]
test/suites/invalid/real-garbage-after-e/input [new file with mode: 0644]
test/suites/invalid/real-negative-overflow/error [new file with mode: 0644]
test/suites/invalid/real-negative-overflow/input [new file with mode: 0644]
test/suites/invalid/real-positive-overflow/error [new file with mode: 0644]
test/suites/invalid/real-positive-overflow/input [new file with mode: 0644]
test/suites/invalid/real-truncated-at-e/error [new file with mode: 0644]
test/suites/invalid/real-truncated-at-e/input [new file with mode: 0644]
test/suites/invalid/real-truncated-at-point/error [new file with mode: 0644]
test/suites/invalid/real-truncated-at-point/input [new file with mode: 0644]
test/suites/invalid/real-underflow/error [new file with mode: 0644]
test/suites/invalid/real-underflow/input [new file with mode: 0644]
test/suites/invalid/run [new file with mode: 0755]
test/suites/invalid/tab-character-in-string/error [new file with mode: 0644]
test/suites/invalid/tab-character-in-string/input [new file with mode: 0644]
test/suites/invalid/too-big-negative-integer/error [new file with mode: 0644]
test/suites/invalid/too-big-negative-integer/input [new file with mode: 0644]
test/suites/invalid/too-big-positive-integer/error [new file with mode: 0644]
test/suites/invalid/too-big-positive-integer/input [new file with mode: 0644]
test/suites/invalid/truncated-unicode-surrogate/error [new file with mode: 0644]
test/suites/invalid/truncated-unicode-surrogate/input [new file with mode: 0644]
test/suites/invalid/unicode-identifier/error [new file with mode: 0644]
test/suites/invalid/unicode-identifier/input [new file with mode: 0644]
test/suites/invalid/unterminated-array-and-object/error [new file with mode: 0644]
test/suites/invalid/unterminated-array-and-object/input [new file with mode: 0644]
test/suites/invalid/unterminated-array/error [new file with mode: 0644]
test/suites/invalid/unterminated-array/input [new file with mode: 0644]
test/suites/invalid/unterminated-empty-key/error [new file with mode: 0644]
test/suites/invalid/unterminated-empty-key/input [new file with mode: 0644]
test/suites/invalid/unterminated-key/error [new file with mode: 0644]
test/suites/invalid/unterminated-key/input [new file with mode: 0644]
test/suites/invalid/unterminated-object-and-array/error [new file with mode: 0644]
test/suites/invalid/unterminated-object-and-array/input [new file with mode: 0644]
test/suites/invalid/unterminated-string/error [new file with mode: 0644]
test/suites/invalid/unterminated-string/input [new file with mode: 0644]
test/suites/valid-strip/complex-array/input [new file with mode: 0644]
test/suites/valid-strip/complex-array/output [new file with mode: 0644]
test/suites/valid-strip/empty-array/input [new file with mode: 0644]
test/suites/valid-strip/empty-array/output [new file with mode: 0644]
test/suites/valid-strip/empty-object-in-array/input [new file with mode: 0644]
test/suites/valid-strip/empty-object-in-array/output [new file with mode: 0644]
test/suites/valid-strip/empty-object/input [new file with mode: 0644]
test/suites/valid-strip/empty-object/output [new file with mode: 0644]
test/suites/valid-strip/empty-string/input [new file with mode: 0644]
test/suites/valid-strip/empty-string/output [new file with mode: 0644]
test/suites/valid-strip/escaped-utf-control-char/input [new file with mode: 0644]
test/suites/valid-strip/escaped-utf-control-char/output [new file with mode: 0644]
test/suites/valid-strip/false/input [new file with mode: 0644]
test/suites/valid-strip/false/output [new file with mode: 0644]
test/suites/valid-strip/negative-int/input [new file with mode: 0644]
test/suites/valid-strip/negative-int/output [new file with mode: 0644]
test/suites/valid-strip/negative-one/input [new file with mode: 0644]
test/suites/valid-strip/negative-one/output [new file with mode: 0644]
test/suites/valid-strip/negative-zero/input [new file with mode: 0644]
test/suites/valid-strip/negative-zero/output [new file with mode: 0644]
test/suites/valid-strip/null/input [new file with mode: 0644]
test/suites/valid-strip/null/output [new file with mode: 0644]
test/suites/valid-strip/one-byte-utf-8/input [new file with mode: 0644]
test/suites/valid-strip/one-byte-utf-8/output [new file with mode: 0644]
test/suites/valid-strip/real-capital-e-negative-exponent/input [new file with mode: 0644]
test/suites/valid-strip/real-capital-e-negative-exponent/output [new file with mode: 0644]
test/suites/valid-strip/real-capital-e-positive-exponent/input [new file with mode: 0644]
test/suites/valid-strip/real-capital-e-positive-exponent/output [new file with mode: 0644]
test/suites/valid-strip/real-capital-e/input [new file with mode: 0644]
test/suites/valid-strip/real-capital-e/output [new file with mode: 0644]
test/suites/valid-strip/real-exponent/input [new file with mode: 0644]
test/suites/valid-strip/real-exponent/output [new file with mode: 0644]
test/suites/valid-strip/real-fraction-exponent/input [new file with mode: 0644]
test/suites/valid-strip/real-fraction-exponent/output [new file with mode: 0644]
test/suites/valid-strip/real-negative-exponent/input [new file with mode: 0644]
test/suites/valid-strip/real-negative-exponent/output [new file with mode: 0644]
test/suites/valid-strip/real-positive-exponent/input [new file with mode: 0644]
test/suites/valid-strip/real-positive-exponent/output [new file with mode: 0644]
test/suites/valid-strip/run [new file with mode: 0755]
test/suites/valid-strip/short-string/input [new file with mode: 0644]
test/suites/valid-strip/short-string/output [new file with mode: 0644]
test/suites/valid-strip/simple-ascii-string/input [new file with mode: 0644]
test/suites/valid-strip/simple-ascii-string/output [new file with mode: 0644]
test/suites/valid-strip/simple-int-0/input [new file with mode: 0644]
test/suites/valid-strip/simple-int-0/output [new file with mode: 0644]
test/suites/valid-strip/simple-int-1/input [new file with mode: 0644]
test/suites/valid-strip/simple-int-1/output [new file with mode: 0644]
test/suites/valid-strip/simple-int-123/input [new file with mode: 0644]
test/suites/valid-strip/simple-int-123/output [new file with mode: 0644]
test/suites/valid-strip/simple-object/input [new file with mode: 0644]
test/suites/valid-strip/simple-object/output [new file with mode: 0644]
test/suites/valid-strip/simple-real/input [new file with mode: 0644]
test/suites/valid-strip/simple-real/output [new file with mode: 0644]
test/suites/valid-strip/string-escapes/input [new file with mode: 0644]
test/suites/valid-strip/string-escapes/output [new file with mode: 0644]
test/suites/valid-strip/three-byte-utf-8/input [new file with mode: 0644]
test/suites/valid-strip/three-byte-utf-8/output [new file with mode: 0644]
test/suites/valid-strip/true/input [new file with mode: 0644]
test/suites/valid-strip/true/output [new file with mode: 0644]
test/suites/valid-strip/two-byte-utf-8/input [new file with mode: 0644]
test/suites/valid-strip/two-byte-utf-8/output [new file with mode: 0644]
test/suites/valid-strip/utf-8-string/input [new file with mode: 0644]
test/suites/valid-strip/utf-8-string/output [new file with mode: 0644]
test/suites/valid-strip/utf-surrogate-four-byte-encoding/input [new file with mode: 0644]
test/suites/valid-strip/utf-surrogate-four-byte-encoding/output [new file with mode: 0644]
test/suites/valid/complex-array/input [new file with mode: 0644]
test/suites/valid/complex-array/output [new file with mode: 0644]
test/suites/valid/empty-array/input [new file with mode: 0644]
test/suites/valid/empty-array/output [new file with mode: 0644]
test/suites/valid/empty-object-in-array/input [new file with mode: 0644]
test/suites/valid/empty-object-in-array/output [new file with mode: 0644]
test/suites/valid/empty-object/input [new file with mode: 0644]
test/suites/valid/empty-object/output [new file with mode: 0644]
test/suites/valid/empty-string/input [new file with mode: 0644]
test/suites/valid/empty-string/output [new file with mode: 0644]
test/suites/valid/escaped-utf-control-char/input [new file with mode: 0644]
test/suites/valid/escaped-utf-control-char/output [new file with mode: 0644]
test/suites/valid/false/input [new file with mode: 0644]
test/suites/valid/false/output [new file with mode: 0644]
test/suites/valid/negative-int/input [new file with mode: 0644]
test/suites/valid/negative-int/output [new file with mode: 0644]
test/suites/valid/negative-one/input [new file with mode: 0644]
test/suites/valid/negative-one/output [new file with mode: 0644]
test/suites/valid/negative-zero/input [new file with mode: 0644]
test/suites/valid/negative-zero/output [new file with mode: 0644]
test/suites/valid/null/input [new file with mode: 0644]
test/suites/valid/null/output [new file with mode: 0644]
test/suites/valid/one-byte-utf-8/input [new file with mode: 0644]
test/suites/valid/one-byte-utf-8/output [new file with mode: 0644]
test/suites/valid/real-capital-e-negative-exponent/input [new file with mode: 0644]
test/suites/valid/real-capital-e-negative-exponent/output [new file with mode: 0644]
test/suites/valid/real-capital-e-positive-exponent/input [new file with mode: 0644]
test/suites/valid/real-capital-e-positive-exponent/output [new file with mode: 0644]
test/suites/valid/real-capital-e/input [new file with mode: 0644]
test/suites/valid/real-capital-e/output [new file with mode: 0644]
test/suites/valid/real-exponent/input [new file with mode: 0644]
test/suites/valid/real-exponent/output [new file with mode: 0644]
test/suites/valid/real-fraction-exponent/input [new file with mode: 0644]
test/suites/valid/real-fraction-exponent/output [new file with mode: 0644]
test/suites/valid/real-negative-exponent/input [new file with mode: 0644]
test/suites/valid/real-negative-exponent/output [new file with mode: 0644]
test/suites/valid/real-positive-exponent/input [new file with mode: 0644]
test/suites/valid/real-positive-exponent/output [new file with mode: 0644]
test/suites/valid/run [new file with mode: 0755]
test/suites/valid/short-string/input [new file with mode: 0644]
test/suites/valid/short-string/output [new file with mode: 0644]
test/suites/valid/simple-ascii-string/input [new file with mode: 0644]
test/suites/valid/simple-ascii-string/output [new file with mode: 0644]
test/suites/valid/simple-int-0/input [new file with mode: 0644]
test/suites/valid/simple-int-0/output [new file with mode: 0644]
test/suites/valid/simple-int-1/input [new file with mode: 0644]
test/suites/valid/simple-int-1/output [new file with mode: 0644]
test/suites/valid/simple-int-123/input [new file with mode: 0644]
test/suites/valid/simple-int-123/output [new file with mode: 0644]
test/suites/valid/simple-object/input [new file with mode: 0644]
test/suites/valid/simple-object/output [new file with mode: 0644]
test/suites/valid/simple-real/input [new file with mode: 0644]
test/suites/valid/simple-real/output [new file with mode: 0644]
test/suites/valid/string-escapes/input [new file with mode: 0644]
test/suites/valid/string-escapes/output [new file with mode: 0644]
test/suites/valid/three-byte-utf-8/input [new file with mode: 0644]
test/suites/valid/three-byte-utf-8/output [new file with mode: 0644]
test/suites/valid/true/input [new file with mode: 0644]
test/suites/valid/true/output [new file with mode: 0644]
test/suites/valid/two-byte-utf-8/input [new file with mode: 0644]
test/suites/valid/two-byte-utf-8/output [new file with mode: 0644]
test/suites/valid/utf-8-string/input [new file with mode: 0644]
test/suites/valid/utf-8-string/output [new file with mode: 0644]
test/suites/valid/utf-surrogate-four-byte-encoding/input [new file with mode: 0644]
test/suites/valid/utf-surrogate-four-byte-encoding/output [new file with mode: 0644]
test/test-api [deleted file]
test/test-invalid [deleted file]
test/test-valid [deleted file]
test/testdata/invalid [deleted file]
test/testdata/invalid-strip [deleted file]
test/testdata/invalid-unicode [deleted file]
test/testdata/valid [deleted file]
test/testdata/valid-strip [deleted file]

index 8de9c05..4020469 100644 (file)
@@ -23,7 +23,8 @@ AC_CONFIG_FILES([
         doc/Makefile
         src/Makefile
         test/Makefile
-        test/testdata/Makefile
-        test/testprogs/Makefile
+        test/bin/Makefile
+        test/suites/Makefile
+        test/suites/api/Makefile
 ])
 AC_OUTPUT
index 1999944..06d11c0 100644 (file)
@@ -1,10 +1,8 @@
-loadf_dumpf
-loads_dumps
-load_file_dump_file
-testlogs
-testprogs/test_array
-testprogs/test_dump
-testprogs/test_load
-testprogs/test_number
-testprogs/test_object
-testprogs/test_simple
+logs
+bin/json_process
+suites/api/test_array
+suites/api/test_dump
+suites/api/test_load
+suites/api/test_number
+suites/api/test_object
+suites/api/test_simple
index ed11110..e468d22 100644 (file)
@@ -1,22 +1,10 @@
-DIST_SUBDIRS = testprogs testdata
-SUBDIRS = testprogs
+SUBDIRS = bin suites
+EXTRA_DIST = scripts
 
-check_PROGRAMS = loadf_dumpf loads_dumps load_file_dump_file
-
-AM_CPPFLAGS = -I$(top_srcdir)/src
-AM_CFLAGS = -Wall -Werror
-LDFLAGS = -static  # for speed and Valgrind
-LDADD = ../src/libjansson.la
-
-TESTS = test-api test-invalid test-valid
-
-EXTRA_DIST = \
-       test-api \
-       test-invalid \
-       test-valid \
-       run-test \
-       json-compare.py \
-       split-testfile.py
+TESTS = run-suites
+TESTS_ENVIRONMENT = \
+       top_srcdir=$(top_srcdir) \
+       top_builddir=$(top_builddir)
 
 clean-local:
-       rm -rf testlogs
+       rm -rf logs
diff --git a/test/bin/Makefile.am b/test/bin/Makefile.am
new file mode 100644 (file)
index 0000000..346db5d
--- /dev/null
@@ -0,0 +1,6 @@
+check_PROGRAMS = json_process
+
+AM_CPPFLAGS = -I$(top_srcdir)/src
+AM_CFLAGS = -Wall -Werror
+LDFLAGS = -static  # for speed and Valgrind
+LDADD = $(top_builddir)/src/libjansson.la
diff --git a/test/bin/json_process.c b/test/bin/json_process.c
new file mode 100644 (file)
index 0000000..e7be614
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <jansson.h>
+
+static int getenv_int(const char *name)
+{
+    char *value, *end;
+    long result;
+
+    value = getenv(name);
+    if(!value)
+        return 0;
+
+    result = strtol(value, &end, 10);
+    if(*end != '\0')
+        return 0;
+
+    return (int)result;
+}
+
+int main(int argc, char *argv[])
+{
+    int indent = 0;
+    unsigned int flags = 0;
+
+    json_t *json;
+    json_error_t error;
+
+    if(argc != 1) {
+        fprintf(stderr, "usage: %s\n", argv[0]);
+        return 2;
+    }
+
+    indent = getenv_int("JSON_INDENT");
+    if(indent < 0 || indent > 255) {
+        fprintf(stderr, "invalid value for JSON_INDENT: %d\n", indent);
+        return 2;
+    }
+
+    if(indent > 0)
+        flags |= JSON_INDENT(indent);
+
+    if(getenv_int("JSON_COMPACT") > 0)
+        flags |= JSON_COMPACT;
+
+    if(getenv_int("JSON_ENSURE_ASCII"))
+        flags |= JSON_ENSURE_ASCII;
+
+    json = json_loadf(stdin, &error);
+    if(!json) {
+        fprintf(stderr, "%d\n%s\n", error.line, error.text);
+        return 1;
+    }
+
+    json_dumpf(json, stdout, flags);
+    json_decref(json);
+
+    return 0;
+}
diff --git a/test/json-compare.py b/test/json-compare.py
deleted file mode 100755 (executable)
index f91530e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-import sys
-try:
-    import json
-except ImportError:
-    import simplejson as json
-
-def load(filename):
-    try:
-        jsonfile = open(filename)
-    except IOError, err:
-        print >>sys.stderr, "unable to load %s: %s" % \
-            (filename, err.strerror)
-        sys.exit(1)
-
-    try:
-        jsondata = json.load(jsonfile)
-    except ValueError, err:
-        print "%s is malformed: %s" % (filename, err)
-        sys.exit(1)
-    finally:
-        jsonfile.close()
-
-    return jsondata
-
-def main():
-    if len(sys.argv) != 3:
-        print >>sys.stderr, "usage: %s json1 json2" % sys.argv[0]
-        return 2
-
-    json1 = load(sys.argv[1])
-    json2 = load(sys.argv[2])
-    if json1 == json2:
-        return 0
-    else:
-        return 1
-
-if __name__ == '__main__':
-    sys.exit(main() or 0)
diff --git a/test/load_file_dump_file.c b/test/load_file_dump_file.c
deleted file mode 100644 (file)
index ac55afe..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
- *
- * Jansson is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See LICENSE for details.
- */
-
-#include <stdio.h>
-#include <jansson.h>
-
-int main(int argc, char *argv[])
-{
-    json_t *json;
-    json_error_t error;
-
-    if(argc != 3) {
-        fprintf(stderr, "usage: %s infile outfile\n", argv[0]);
-        return 2;
-    }
-
-    json = json_load_file(argv[1], &error);
-    if(!json) {
-        fprintf(stderr, "%d\n%s\n", error.line, error.text);
-        return 1;
-    }
-
-    json_dump_file(json, argv[2], 0);
-    json_decref(json);
-
-    return 0;
-}
diff --git a/test/loadf_dumpf.c b/test/loadf_dumpf.c
deleted file mode 100644 (file)
index 75b889f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
- *
- * Jansson is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See LICENSE for details.
- */
-
-#include <stdio.h>
-#include <jansson.h>
-
-int main(int argc, char *argv[])
-{
-    json_t *json;
-    json_error_t error;
-
-    if(argc != 1) {
-        fprintf(stderr, "usage: %s\n", argv[0]);
-        return 2;
-    }
-
-    json = json_loadf(stdin, &error);
-    if(!json) {
-        fprintf(stderr, "%d\n%s\n", error.line, error.text);
-        return 1;
-    }
-
-    /* loadf_dumpf indents, others don't, so dumping with and without
-       indenting is tested */
-    json_dumpf(json, stdout, JSON_INDENT(4));
-    json_decref(json);
-
-    return 0;
-}
diff --git a/test/loads_dumps.c b/test/loads_dumps.c
deleted file mode 100644 (file)
index fefe1ba..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
- *
- * Jansson is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See LICENSE for details.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <jansson.h>
-
-#define BUFFER_SIZE (256 * 1024)
-
-int main(int argc, char *argv[])
-{
-    json_t *json;
-    json_error_t error;
-    int count;
-    char buffer[BUFFER_SIZE];
-    char *result;
-
-    if(argc != 1) {
-        fprintf(stderr, "usage: %s\n", argv[0]);
-        return 2;
-    }
-
-    count = fread(buffer, 1, BUFFER_SIZE, stdin);
-    if(count < 0 || count >= BUFFER_SIZE) {
-        fprintf(stderr, "unable to read input\n");
-        return 1;
-    }
-    buffer[count] = '\0';
-
-    json = json_loads(buffer, &error);
-    if(!json) {
-        fprintf(stderr, "%d\n%s\n", error.line, error.text);
-        return 1;
-    }
-
-    result = json_dumps(json, 0);
-    json_decref(json);
-
-    puts(result);
-    free(result);
-
-    return 0;
-}
diff --git a/test/run-suites b/test/run-suites
new file mode 100755 (executable)
index 0000000..e736004
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+while [ -n "$1" ]; do
+    suite=$1
+    if [ -x $top_srcdir/test/suites/$suite/run ]; then
+        SUITES="$SUITES $suite"
+    else
+        echo "No such suite: $suite"
+        exit 1
+    fi
+    shift
+done
+
+if [ -z "$SUITES" ]; then
+    suitedirs=$top_srcdir/test/suites/*
+    for suitedir in $suitedirs; do
+        if [ -x $suitedir/run ]; then
+            SUITES="$SUITES `basename $suitedir`"
+        fi
+    done
+fi
+
+export suites_srcdir=$top_srcdir/test/suites
+export suites_builddir=suites
+export scriptdir=$top_srcdir/test/scripts
+export logdir=logs
+export bindir=bin
+
+passed=0
+failed=0
+for suite in $SUITES; do
+    echo "Suite: $suite"
+    if $suites_srcdir/$suite/run $suite; then
+        passed=$(($passed+1))
+    else
+        failed=$(($failed+1))
+    fi
+done
+
+if [ $failed -gt 0 ]; then
+    echo "$failed of $((passed+failed)) test suites failed"
+    exit 1
+else
+    echo "$passed test suites passed"
+    rm -rf $logdir
+fi
diff --git a/test/run-test b/test/run-test
deleted file mode 100644 (file)
index ffe653c..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q"
-
-run_testprog() {
-    local prog=$1
-    local prefix=$2
-    if [ -n "$VALGRIND" ]; then
-        local runner="$VALGRIND_CMDLINE "
-    fi
-
-    case "$prog" in
-        load_file_dump_file)
-            $runner./$prog \
-                $prefix.in \
-                $prefix.$prog.stdout \
-                2>$prefix.$prog.stderr
-            ;;
-        *)
-            $runner./$prog \
-                <$prefix.in \
-                >$prefix.$prog.stdout \
-                2>$prefix.$prog.stderr
-            ;;
-    esac
-
-    if [ -n "$VALGRIND" ]; then
-        # Check for Valgrind error output. The valgrind option
-        # --error-exitcode is not enough because Valgrind doesn't
-        # think unfreed allocs are errors.
-        if grep -E -q '^==[0-9]+== ' $prefix.$prog.stderr; then
-            echo "### $prefix ($prog) failed:" >&2
-            echo "valgrind detected an error" >&2
-            echo "for details, see test/$prefix.$prog.stderr" >&2
-            exit 1
-        fi
-    fi
-}
-
-for testfile in $TESTFILES; do
-    tmpdir="testlogs/`basename $testfile`"
-    rm -rf $tmpdir
-    mkdir -p $tmpdir
-    if echo "$testfile" | grep -q -E -e '-strip$'; then
-        opts="--strip"
-    fi
-    ${srcdir}/split-testfile.py $opts $testfile $tmpdir | while read name; do
-        run_test loadf_dumpf $tmpdir/$name
-        run_test loads_dumps $tmpdir/$name
-        run_test load_file_dump_file $tmpdir/$name
-        echo -n '.'
-    done || exit 1
-    echo
-done
diff --git a/test/scripts/run-tests.sh b/test/scripts/run-tests.sh
new file mode 100644 (file)
index 0000000..2559766
--- /dev/null
@@ -0,0 +1,71 @@
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+json_process=$bindir/json_process
+
+suite_name=$1
+suite_srcdir=$suites_srcdir/$suite_name
+suite_builddir=$suites_builddir/$suite_name
+suite_log=$logdir/$suite_name
+
+
+[ -z "$VERBOSE" ] && VERBOSE=0
+
+. $scriptdir/valgrind.sh
+
+rm -rf $suite_log
+mkdir -p $suite_log
+
+for test_path in $suite_srcdir/*; do
+    test_name=$(basename $test_path)
+    test_builddir=$suite_builddir/$test_name
+    test_log=$suite_log/$test_name
+
+    [ "$test_name" = "run" ] && continue
+    is_test || continue
+
+    rm -rf $test_log
+    mkdir -p $test_log
+    if [ $VERBOSE -eq 1 ]; then
+        echo -n "$name... "
+    fi
+
+    if run_test; then
+        # Success
+        if [ $VERBOSE -eq 1 ]; then
+            echo "ok"
+        else
+            echo -n "."
+        fi
+        rm -rf $test_log
+    else
+        # Failure
+        if [ $VERBOSE -eq 1 ]; then
+            echo "FAILED"
+        else
+            echo -n "F"
+        fi
+    fi
+done
+
+if [ $VERBOSE -eq 0 ]; then
+    echo
+fi
+
+if [ -n "$(ls -A $suite_log)" ]; then
+    for test_log in $suite_log/*; do
+        test_name=$(basename $test_log)
+        test_path=$suite_srcdir/$test_name
+        echo "================================================================="
+        echo "$suite_name/$test_name"
+        echo "================================================================="
+        show_error
+        echo
+    done
+    echo "================================================================="
+    exit 1
+else
+    rm -rf $suite_log
+fi
diff --git a/test/scripts/valgrind.sh b/test/scripts/valgrind.sh
new file mode 100644 (file)
index 0000000..7c23c79
--- /dev/null
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+[ -z "$VALGRIND" ] && VALGRIND=0
+
+VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q"
+
+if [ $VALGRIND -eq 1 ]; then
+    json_process="$VALGRIND_CMDLINE $json_process"
+fi
+
+valgrind_check() {
+    if [ $VALGRIND -eq 1 ]; then
+        # Check for Valgrind error output. The valgrind option
+        # --error-exitcode is not enough because Valgrind doesn't
+        # think unfreed allocs are errors.
+        if grep -E -q '^==[0-9]+== ' $1; then
+            touch $test_log/valgrind_error
+            return 1
+        fi
+    fi
+}
+
+valgrind_show_error() {
+    if [ $VALGRIND -eq 1 -a -f $test_log/valgrind_error ]; then
+        echo "valgrind detected an error"
+        return 0
+    fi
+    return 1
+}
diff --git a/test/split-testfile.py b/test/split-testfile.py
deleted file mode 100755 (executable)
index 97a489e..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-import os
-import sys
-from optparse import OptionParser
-
-def strip_file(filename):
-    with open(filename) as fobj:
-        data = fobj.read()
-    with open(filename, 'w') as fobj:
-        fobj.write(data.strip())
-
-def open_files(outdir, i, name):
-    basename = '%02d_%s' % (i, name)
-    print basename
-    input_path = os.path.join(outdir, basename + '.in')
-    output_path = os.path.join(outdir, basename + '.out')
-    return open(input_path, 'w'), open(output_path, 'w')
-
-def main():
-    parser = OptionParser('usage: %prog [options] inputfile outputdir')
-    parser.add_option('--strip', help='strip whitespace from input',
-                      action='store_true', default=False)
-    options, args = parser.parse_args()
-
-    if len(args) != 2:
-        parser.print_help()
-        return 2
-
-    infile = os.path.normpath(args[0])
-    outdir = os.path.normpath(args[1])
-
-    if not os.path.exists(outdir):
-        print >>sys.stderr, 'output directory %r does not exist!' % outdir
-        return 1
-
-    n = 0
-    current = None
-    input, output = None, None
-
-    for line in open(infile):
-        if line.startswith('==== '):
-            n += 1
-            if input is not None and output is not None:
-                input.close()
-                output.close()
-                if options.strip:
-                    strip_file(input.name)
-            input, output = open_files(outdir, n, line[5:line.find(' ====\n')])
-            current = input
-        elif line == '====\n':
-            current = output
-        else:
-            current.write(line)
-
-    if input is not None and output is not None:
-        input.close()
-        output.close()
-
-    print >>sys.stderr, "%s: %d test cases" % (infile, n)
-
-if __name__ == '__main__':
-    sys.exit(main() or 0)
similarity index 83%
rename from test/testdata/Makefile.am
rename to test/suites/Makefile.am
index bb84cf5..db3443c 100644 (file)
@@ -1 +1,2 @@
+SUBDIRS = api
 EXTRA_DIST = invalid invalid-strip invalid-unicode valid valid-strip
similarity index 71%
rename from test/testprogs/Makefile.am
rename to test/suites/api/Makefile.am
index 308b9a5..ac83ed1 100644 (file)
@@ -1,4 +1,10 @@
-check_PROGRAMS = test_array test_dump test_load test_simple test_number test_object
+check_PROGRAMS = \
+       test_array \
+       test_dump \
+       test_load \
+       test_simple \
+       test_number \
+       test_object
 
 test_array_SOURCES = test_array.c util.h
 test_dump_SOURCES = test_dump.c util.h
@@ -10,4 +16,4 @@ test_object_SOURCES = test_object.c util.h
 AM_CPPFLAGS = -I$(top_srcdir)/src
 AM_CFLAGS = -Wall -Werror
 LDFLAGS = -static  # for speed and Valgrind
-LDADD = ../../src/libjansson.la
+LDADD = $(top_builddir)/src/libjansson.la
diff --git a/test/suites/api/run b/test/suites/api/run
new file mode 100755 (executable)
index 0000000..29d628a
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+    test "${test_name%.c}" != "$test_name"
+}
+
+run_test() {
+    $suite_builddir/${test_name%.c} >$test_log/stdout 2>$test_log/stderr
+}
+
+show_error() {
+    valgrind_show_error && return
+    cat $test_log/stderr
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
similarity index 100%
rename from test/testprogs/util.h
rename to test/suites/api/util.h
diff --git a/test/suites/invalid-strip/apostrophe/error b/test/suites/invalid-strip/apostrophe/error
new file mode 100644 (file)
index 0000000..f30d170
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '''
diff --git a/test/suites/invalid-strip/apostrophe/input b/test/suites/invalid-strip/apostrophe/input
new file mode 100644 (file)
index 0000000..8bebe3a
--- /dev/null
@@ -0,0 +1 @@
+['
\ No newline at end of file
diff --git a/test/suites/invalid-strip/ascii-unicode-identifier/error b/test/suites/invalid-strip/ascii-unicode-identifier/error
new file mode 100644 (file)
index 0000000..7469919
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'[' or '{' expected near 'a'
diff --git a/test/suites/invalid-strip/ascii-unicode-identifier/input b/test/suites/invalid-strip/ascii-unicode-identifier/input
new file mode 100644 (file)
index 0000000..ef2ab62
--- /dev/null
@@ -0,0 +1 @@
+aå
\ No newline at end of file
diff --git a/test/suites/invalid-strip/brace-comma/error b/test/suites/invalid-strip/brace-comma/error
new file mode 100644 (file)
index 0000000..394ad5a
--- /dev/null
@@ -0,0 +1,2 @@
+1
+string or '}' expected near ','
diff --git a/test/suites/invalid-strip/brace-comma/input b/test/suites/invalid-strip/brace-comma/input
new file mode 100644 (file)
index 0000000..47bc910
--- /dev/null
@@ -0,0 +1 @@
+{,
\ No newline at end of file
diff --git a/test/suites/invalid-strip/bracket-comma/error b/test/suites/invalid-strip/bracket-comma/error
new file mode 100644 (file)
index 0000000..54c3924
--- /dev/null
@@ -0,0 +1,2 @@
+1
+unexpected token near ','
diff --git a/test/suites/invalid-strip/bracket-comma/input b/test/suites/invalid-strip/bracket-comma/input
new file mode 100644 (file)
index 0000000..6295fdc
--- /dev/null
@@ -0,0 +1 @@
+[,
\ No newline at end of file
diff --git a/test/suites/invalid-strip/bracket-one-comma/error b/test/suites/invalid-strip/bracket-one-comma/error
new file mode 100644 (file)
index 0000000..f00ebc5
--- /dev/null
@@ -0,0 +1,2 @@
+1
+']' expected near end of file
diff --git a/test/suites/invalid-strip/bracket-one-comma/input b/test/suites/invalid-strip/bracket-one-comma/input
new file mode 100644 (file)
index 0000000..6604698
--- /dev/null
@@ -0,0 +1 @@
+[1,
\ No newline at end of file
diff --git a/test/suites/invalid-strip/empty/error b/test/suites/invalid-strip/empty/error
new file mode 100644 (file)
index 0000000..ff19200
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'[' or '{' expected near end of file
diff --git a/test/suites/invalid-strip/empty/input b/test/suites/invalid-strip/empty/input
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/suites/invalid-strip/extra-comma-in-array/error b/test/suites/invalid-strip/extra-comma-in-array/error
new file mode 100644 (file)
index 0000000..38afe71
--- /dev/null
@@ -0,0 +1,2 @@
+1
+unexpected token near ']'
diff --git a/test/suites/invalid-strip/extra-comma-in-array/input b/test/suites/invalid-strip/extra-comma-in-array/input
new file mode 100644 (file)
index 0000000..13f6f1d
--- /dev/null
@@ -0,0 +1 @@
+[1,]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/extra-command-in-multiline-array/error b/test/suites/invalid-strip/extra-command-in-multiline-array/error
new file mode 100644 (file)
index 0000000..26c2152
--- /dev/null
@@ -0,0 +1,2 @@
+6
+unexpected token near ']'
diff --git a/test/suites/invalid-strip/extra-command-in-multiline-array/input b/test/suites/invalid-strip/extra-command-in-multiline-array/input
new file mode 100644 (file)
index 0000000..e4d4ddd
--- /dev/null
@@ -0,0 +1,6 @@
+[1,
+2,
+3,
+4,
+5,
+]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/garbage-after-newline/error b/test/suites/invalid-strip/garbage-after-newline/error
new file mode 100644 (file)
index 0000000..90eacdd
--- /dev/null
@@ -0,0 +1,2 @@
+2
+end of file expected near 'foo'
diff --git a/test/suites/invalid-strip/garbage-after-newline/input b/test/suites/invalid-strip/garbage-after-newline/input
new file mode 100644 (file)
index 0000000..3614ac7
--- /dev/null
@@ -0,0 +1,2 @@
+[1,2,3]
+foo
diff --git a/test/suites/invalid-strip/garbage-at-the-end/error b/test/suites/invalid-strip/garbage-at-the-end/error
new file mode 100644 (file)
index 0000000..9076aec
--- /dev/null
@@ -0,0 +1,2 @@
+1
+end of file expected near 'foo'
diff --git a/test/suites/invalid-strip/garbage-at-the-end/input b/test/suites/invalid-strip/garbage-at-the-end/input
new file mode 100644 (file)
index 0000000..adf1aac
--- /dev/null
@@ -0,0 +1 @@
+[1,2,3]foo
\ No newline at end of file
diff --git a/test/suites/invalid-strip/integer-starting-with-zero/error b/test/suites/invalid-strip/integer-starting-with-zero/error
new file mode 100644 (file)
index 0000000..e4eee2f
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '0'
diff --git a/test/suites/invalid-strip/integer-starting-with-zero/input b/test/suites/invalid-strip/integer-starting-with-zero/input
new file mode 100644 (file)
index 0000000..7106da1
--- /dev/null
@@ -0,0 +1 @@
+[012]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/invalid-escape/error b/test/suites/invalid-strip/invalid-escape/error
new file mode 100644 (file)
index 0000000..9930ca7
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid escape near '"\'
diff --git a/test/suites/invalid-strip/invalid-escape/input b/test/suites/invalid-strip/invalid-escape/input
new file mode 100644 (file)
index 0000000..e305947
--- /dev/null
@@ -0,0 +1 @@
+["\a <-- invalid escape"]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/invalid-identifier/error b/test/suites/invalid-strip/invalid-identifier/error
new file mode 100644 (file)
index 0000000..0f88417
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near 'troo'
diff --git a/test/suites/invalid-strip/invalid-identifier/input b/test/suites/invalid-strip/invalid-identifier/input
new file mode 100644 (file)
index 0000000..7c06bd5
--- /dev/null
@@ -0,0 +1 @@
+[troo
\ No newline at end of file
diff --git a/test/suites/invalid-strip/invalid-negative-integerr/error b/test/suites/invalid-strip/invalid-negative-integerr/error
new file mode 100644 (file)
index 0000000..f9d930e
--- /dev/null
@@ -0,0 +1,2 @@
+1
+']' expected near 'foo'
diff --git a/test/suites/invalid-strip/invalid-negative-integerr/input b/test/suites/invalid-strip/invalid-negative-integerr/input
new file mode 100644 (file)
index 0000000..fe088a3
--- /dev/null
@@ -0,0 +1 @@
+[-123foo]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/invalid-negative-real/error b/test/suites/invalid-strip/invalid-negative-real/error
new file mode 100644 (file)
index 0000000..f9d930e
--- /dev/null
@@ -0,0 +1,2 @@
+1
+']' expected near 'foo'
diff --git a/test/suites/invalid-strip/invalid-negative-real/input b/test/suites/invalid-strip/invalid-negative-real/input
new file mode 100644 (file)
index 0000000..5fc3c1e
--- /dev/null
@@ -0,0 +1 @@
+[-123.123foo]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/invalid-second-surrogate/error b/test/suites/invalid-strip/invalid-second-surrogate/error
new file mode 100644 (file)
index 0000000..22d0e1f
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid Unicode '\uD888\u3210'
diff --git a/test/suites/invalid-strip/invalid-second-surrogate/input b/test/suites/invalid-strip/invalid-second-surrogate/input
new file mode 100644 (file)
index 0000000..25a1ca2
--- /dev/null
@@ -0,0 +1 @@
+["\uD888\u3210 (first surrogate and invalid second surrogate)"]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/lone-open-brace/error b/test/suites/invalid-strip/lone-open-brace/error
new file mode 100644 (file)
index 0000000..73a2947
--- /dev/null
@@ -0,0 +1,2 @@
+1
+string or '}' expected near end of file
diff --git a/test/suites/invalid-strip/lone-open-brace/input b/test/suites/invalid-strip/lone-open-brace/input
new file mode 100644 (file)
index 0000000..81750b9
--- /dev/null
@@ -0,0 +1 @@
+{
\ No newline at end of file
diff --git a/test/suites/invalid-strip/lone-open-bracket/error b/test/suites/invalid-strip/lone-open-bracket/error
new file mode 100644 (file)
index 0000000..f00ebc5
--- /dev/null
@@ -0,0 +1,2 @@
+1
+']' expected near end of file
diff --git a/test/suites/invalid-strip/lone-open-bracket/input b/test/suites/invalid-strip/lone-open-bracket/input
new file mode 100644 (file)
index 0000000..8e2f0be
--- /dev/null
@@ -0,0 +1 @@
+[
\ No newline at end of file
diff --git a/test/suites/invalid-strip/lone-second-surrogate/error b/test/suites/invalid-strip/lone-second-surrogate/error
new file mode 100644 (file)
index 0000000..c96d7f5
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid Unicode '\uDFAA'
diff --git a/test/suites/invalid-strip/lone-second-surrogate/input b/test/suites/invalid-strip/lone-second-surrogate/input
new file mode 100644 (file)
index 0000000..6882ee4
--- /dev/null
@@ -0,0 +1 @@
+["\uDFAA (second surrogate on it's own)"]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/minus-sign-without-number/error b/test/suites/invalid-strip/minus-sign-without-number/error
new file mode 100644 (file)
index 0000000..e978234
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '-'
diff --git a/test/suites/invalid-strip/minus-sign-without-number/input b/test/suites/invalid-strip/minus-sign-without-number/input
new file mode 100644 (file)
index 0000000..a6d8e78
--- /dev/null
@@ -0,0 +1 @@
+[-foo]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/negative-integer-starting-with-zero/error b/test/suites/invalid-strip/negative-integer-starting-with-zero/error
new file mode 100644 (file)
index 0000000..a758d94
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '-0'
diff --git a/test/suites/invalid-strip/negative-integer-starting-with-zero/input b/test/suites/invalid-strip/negative-integer-starting-with-zero/input
new file mode 100644 (file)
index 0000000..67af096
--- /dev/null
@@ -0,0 +1 @@
+[-012]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/null-byte-in-string/error b/test/suites/invalid-strip/null-byte-in-string/error
new file mode 100644 (file)
index 0000000..0fa36e2
--- /dev/null
@@ -0,0 +1,2 @@
+1
+\u0000 is not allowed
diff --git a/test/suites/invalid-strip/null-byte-in-string/input b/test/suites/invalid-strip/null-byte-in-string/input
new file mode 100644 (file)
index 0000000..60f7f7b
--- /dev/null
@@ -0,0 +1 @@
+["\u0000 (null byte not allowed)"]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/null/error b/test/suites/invalid-strip/null/error
new file mode 100644 (file)
index 0000000..de9280b
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'[' or '{' expected near 'null'
diff --git a/test/suites/invalid-strip/null/input b/test/suites/invalid-strip/null/input
new file mode 100644 (file)
index 0000000..ec747fa
--- /dev/null
@@ -0,0 +1 @@
+null
\ No newline at end of file
diff --git a/test/suites/invalid-strip/object-apostrophes/error b/test/suites/invalid-strip/object-apostrophes/error
new file mode 100644 (file)
index 0000000..f7b586a
--- /dev/null
@@ -0,0 +1,2 @@
+1
+string or '}' expected near '''
diff --git a/test/suites/invalid-strip/object-apostrophes/input b/test/suites/invalid-strip/object-apostrophes/input
new file mode 100644 (file)
index 0000000..9dba170
--- /dev/null
@@ -0,0 +1 @@
+{'a'
\ No newline at end of file
diff --git a/test/suites/invalid-strip/object-garbage-at-end/error b/test/suites/invalid-strip/object-garbage-at-end/error
new file mode 100644 (file)
index 0000000..a60dc47
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'}' expected near '123'
diff --git a/test/suites/invalid-strip/object-garbage-at-end/input b/test/suites/invalid-strip/object-garbage-at-end/input
new file mode 100644 (file)
index 0000000..80c42cb
--- /dev/null
@@ -0,0 +1 @@
+{"a":"a" 123}
\ No newline at end of file
diff --git a/test/suites/invalid-strip/object-in-unterminated-array/error b/test/suites/invalid-strip/object-in-unterminated-array/error
new file mode 100644 (file)
index 0000000..f00ebc5
--- /dev/null
@@ -0,0 +1,2 @@
+1
+']' expected near end of file
diff --git a/test/suites/invalid-strip/object-in-unterminated-array/input b/test/suites/invalid-strip/object-in-unterminated-array/input
new file mode 100644 (file)
index 0000000..043a87e
--- /dev/null
@@ -0,0 +1 @@
+[{}
\ No newline at end of file
diff --git a/test/suites/invalid-strip/object-no-colon/error b/test/suites/invalid-strip/object-no-colon/error
new file mode 100644 (file)
index 0000000..7f8b299
--- /dev/null
@@ -0,0 +1,2 @@
+1
+':' expected near end of file
diff --git a/test/suites/invalid-strip/object-no-colon/input b/test/suites/invalid-strip/object-no-colon/input
new file mode 100644 (file)
index 0000000..f3797b3
--- /dev/null
@@ -0,0 +1 @@
+{"a"
\ No newline at end of file
diff --git a/test/suites/invalid-strip/object-no-value/error b/test/suites/invalid-strip/object-no-value/error
new file mode 100644 (file)
index 0000000..085fc8b
--- /dev/null
@@ -0,0 +1,2 @@
+1
+unexpected token near end of file
diff --git a/test/suites/invalid-strip/object-no-value/input b/test/suites/invalid-strip/object-no-value/input
new file mode 100644 (file)
index 0000000..3ef538a
--- /dev/null
@@ -0,0 +1 @@
+{"a":
\ No newline at end of file
diff --git a/test/suites/invalid-strip/object-unterminated-value/error b/test/suites/invalid-strip/object-unterminated-value/error
new file mode 100644 (file)
index 0000000..62f18ab
--- /dev/null
@@ -0,0 +1,2 @@
+1
+premature end of input near '"a'
diff --git a/test/suites/invalid-strip/object-unterminated-value/input b/test/suites/invalid-strip/object-unterminated-value/input
new file mode 100644 (file)
index 0000000..7fe699a
--- /dev/null
@@ -0,0 +1 @@
+{"a":"a
\ No newline at end of file
diff --git a/test/suites/invalid-strip/real-garbage-after-e/error b/test/suites/invalid-strip/real-garbage-after-e/error
new file mode 100644 (file)
index 0000000..d9b83e7
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '1e'
diff --git a/test/suites/invalid-strip/real-garbage-after-e/input b/test/suites/invalid-strip/real-garbage-after-e/input
new file mode 100644 (file)
index 0000000..9213dfc
--- /dev/null
@@ -0,0 +1 @@
+[1ea]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/real-negative-overflow/error b/test/suites/invalid-strip/real-negative-overflow/error
new file mode 100644 (file)
index 0000000..af5a850
--- /dev/null
@@ -0,0 +1,2 @@
+1
+real number overflow near '-123123e100000'
diff --git a/test/suites/invalid-strip/real-negative-overflow/input b/test/suites/invalid-strip/real-negative-overflow/input
new file mode 100644 (file)
index 0000000..3d628a9
--- /dev/null
@@ -0,0 +1 @@
+[-123123e100000]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/real-positive-overflow/error b/test/suites/invalid-strip/real-positive-overflow/error
new file mode 100644 (file)
index 0000000..e9becc3
--- /dev/null
@@ -0,0 +1,2 @@
+1
+real number overflow near '123123e100000'
diff --git a/test/suites/invalid-strip/real-positive-overflow/input b/test/suites/invalid-strip/real-positive-overflow/input
new file mode 100644 (file)
index 0000000..54d7d3d
--- /dev/null
@@ -0,0 +1 @@
+[123123e100000]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/real-truncated-at-e/error b/test/suites/invalid-strip/real-truncated-at-e/error
new file mode 100644 (file)
index 0000000..d9b83e7
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '1e'
diff --git a/test/suites/invalid-strip/real-truncated-at-e/input b/test/suites/invalid-strip/real-truncated-at-e/input
new file mode 100644 (file)
index 0000000..c3ace3a
--- /dev/null
@@ -0,0 +1 @@
+[1e]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/real-truncated-at-point/error b/test/suites/invalid-strip/real-truncated-at-point/error
new file mode 100644 (file)
index 0000000..7312401
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '1.'
diff --git a/test/suites/invalid-strip/real-truncated-at-point/input b/test/suites/invalid-strip/real-truncated-at-point/input
new file mode 100644 (file)
index 0000000..1de287c
--- /dev/null
@@ -0,0 +1 @@
+[1.]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/real-underflow/error b/test/suites/invalid-strip/real-underflow/error
new file mode 100644 (file)
index 0000000..1b65d40
--- /dev/null
@@ -0,0 +1,2 @@
+1
+real number underflow near '123e-10000000'
diff --git a/test/suites/invalid-strip/real-underflow/input b/test/suites/invalid-strip/real-underflow/input
new file mode 100644 (file)
index 0000000..c5236eb
--- /dev/null
@@ -0,0 +1 @@
+[123e-10000000]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/run b/test/suites/invalid-strip/run
new file mode 100755 (executable)
index 0000000..1c6130d
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+    test -d $test_path
+}
+
+run_test() {
+    $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+    valgrind_check $test_log/stderr || return 1
+    cmp -s $test_path/error $test_log/stderr
+}
+
+show_error() {
+    valgrind_show_error && return
+
+    echo "EXPECTED ERROR:"
+    nl -bn $test_path/error
+    echo "ACTUAL ERROR:"
+    nl -bn $test_log/stderr
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
diff --git a/test/suites/invalid-strip/tab-character-in-string/error b/test/suites/invalid-strip/tab-character-in-string/error
new file mode 100644 (file)
index 0000000..ee81a5f
--- /dev/null
@@ -0,0 +1,2 @@
+1
+control character 0x9 near '"'
diff --git a/test/suites/invalid-strip/tab-character-in-string/input b/test/suites/invalid-strip/tab-character-in-string/input
new file mode 100644 (file)
index 0000000..f3010f5
--- /dev/null
@@ -0,0 +1 @@
+["      <-- tab character"]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/too-big-negative-integer/error b/test/suites/invalid-strip/too-big-negative-integer/error
new file mode 100644 (file)
index 0000000..4245f39
--- /dev/null
@@ -0,0 +1,2 @@
+1
+too big negative integer near '-123123123123123'
diff --git a/test/suites/invalid-strip/too-big-negative-integer/input b/test/suites/invalid-strip/too-big-negative-integer/input
new file mode 100644 (file)
index 0000000..f2366dc
--- /dev/null
@@ -0,0 +1 @@
+[-123123123123123]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/too-big-positive-integer/error b/test/suites/invalid-strip/too-big-positive-integer/error
new file mode 100644 (file)
index 0000000..4761ad3
--- /dev/null
@@ -0,0 +1,2 @@
+1
+too big integer near '123123123123123'
diff --git a/test/suites/invalid-strip/too-big-positive-integer/input b/test/suites/invalid-strip/too-big-positive-integer/input
new file mode 100644 (file)
index 0000000..a787c2c
--- /dev/null
@@ -0,0 +1 @@
+[123123123123123]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/truncated-unicode-surrogate/error b/test/suites/invalid-strip/truncated-unicode-surrogate/error
new file mode 100644 (file)
index 0000000..17b932d
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid Unicode '\uDADA'
diff --git a/test/suites/invalid-strip/truncated-unicode-surrogate/input b/test/suites/invalid-strip/truncated-unicode-surrogate/input
new file mode 100644 (file)
index 0000000..3937c2c
--- /dev/null
@@ -0,0 +1 @@
+["\uDADA (first surrogate without the second)"]
\ No newline at end of file
diff --git a/test/suites/invalid-strip/unicode-identifier/error b/test/suites/invalid-strip/unicode-identifier/error
new file mode 100644 (file)
index 0000000..e3817fa
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'[' or '{' expected near 'å'
diff --git a/test/suites/invalid-strip/unicode-identifier/input b/test/suites/invalid-strip/unicode-identifier/input
new file mode 100644 (file)
index 0000000..7284aea
--- /dev/null
@@ -0,0 +1 @@
\ No newline at end of file
diff --git a/test/suites/invalid-strip/unterminated-array-and-object/error b/test/suites/invalid-strip/unterminated-array-and-object/error
new file mode 100644 (file)
index 0000000..73a2947
--- /dev/null
@@ -0,0 +1,2 @@
+1
+string or '}' expected near end of file
diff --git a/test/suites/invalid-strip/unterminated-array-and-object/input b/test/suites/invalid-strip/unterminated-array-and-object/input
new file mode 100644 (file)
index 0000000..7a63c8c
--- /dev/null
@@ -0,0 +1 @@
+[{
\ No newline at end of file
diff --git a/test/suites/invalid-strip/unterminated-array/error b/test/suites/invalid-strip/unterminated-array/error
new file mode 100644 (file)
index 0000000..f00ebc5
--- /dev/null
@@ -0,0 +1,2 @@
+1
+']' expected near end of file
diff --git a/test/suites/invalid-strip/unterminated-array/input b/test/suites/invalid-strip/unterminated-array/input
new file mode 100644 (file)
index 0000000..42a6193
--- /dev/null
@@ -0,0 +1 @@
+["a"
\ No newline at end of file
diff --git a/test/suites/invalid-strip/unterminated-empty-key/error b/test/suites/invalid-strip/unterminated-empty-key/error
new file mode 100644 (file)
index 0000000..dd913cf
--- /dev/null
@@ -0,0 +1,2 @@
+1
+premature end of input near '"'
diff --git a/test/suites/invalid-strip/unterminated-empty-key/input b/test/suites/invalid-strip/unterminated-empty-key/input
new file mode 100644 (file)
index 0000000..20f22da
--- /dev/null
@@ -0,0 +1 @@
+{"
\ No newline at end of file
diff --git a/test/suites/invalid-strip/unterminated-key/error b/test/suites/invalid-strip/unterminated-key/error
new file mode 100644 (file)
index 0000000..62f18ab
--- /dev/null
@@ -0,0 +1,2 @@
+1
+premature end of input near '"a'
diff --git a/test/suites/invalid-strip/unterminated-key/input b/test/suites/invalid-strip/unterminated-key/input
new file mode 100644 (file)
index 0000000..328c30c
--- /dev/null
@@ -0,0 +1 @@
+{"a
\ No newline at end of file
diff --git a/test/suites/invalid-strip/unterminated-object-and-array/error b/test/suites/invalid-strip/unterminated-object-and-array/error
new file mode 100644 (file)
index 0000000..5fe61b5
--- /dev/null
@@ -0,0 +1,2 @@
+1
+string or '}' expected near '['
diff --git a/test/suites/invalid-strip/unterminated-object-and-array/input b/test/suites/invalid-strip/unterminated-object-and-array/input
new file mode 100644 (file)
index 0000000..381ede5
--- /dev/null
@@ -0,0 +1 @@
+{[
\ No newline at end of file
diff --git a/test/suites/invalid-strip/unterminated-string/error b/test/suites/invalid-strip/unterminated-string/error
new file mode 100644 (file)
index 0000000..62f18ab
--- /dev/null
@@ -0,0 +1,2 @@
+1
+premature end of input near '"a'
diff --git a/test/suites/invalid-strip/unterminated-string/input b/test/suites/invalid-strip/unterminated-string/input
new file mode 100644 (file)
index 0000000..9822a6b
--- /dev/null
@@ -0,0 +1 @@
+["a
\ No newline at end of file
diff --git a/test/suites/invalid-unicode/encoded-surrogate-half/error b/test/suites/invalid-unicode/encoded-surrogate-half/error
new file mode 100644 (file)
index 0000000..a1813f7
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xed at position 2
diff --git a/test/suites/invalid-unicode/encoded-surrogate-half/input b/test/suites/invalid-unicode/encoded-surrogate-half/input
new file mode 100644 (file)
index 0000000..515dd93
--- /dev/null
@@ -0,0 +1 @@
+[" <-- encoded surrogate half"]
diff --git a/test/suites/invalid-unicode/invalid-utf-8-after-backslash/error b/test/suites/invalid-unicode/invalid-utf-8-after-backslash/error
new file mode 100644 (file)
index 0000000..50beb0a
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 3
diff --git a/test/suites/invalid-unicode/invalid-utf-8-after-backslash/input b/test/suites/invalid-unicode/invalid-utf-8-after-backslash/input
new file mode 100644 (file)
index 0000000..57c8bee
--- /dev/null
@@ -0,0 +1 @@
+["\å"]
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-array/error b/test/suites/invalid-unicode/invalid-utf-8-in-array/error
new file mode 100644 (file)
index 0000000..4030cd5
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 1
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-array/input b/test/suites/invalid-unicode/invalid-utf-8-in-array/input
new file mode 100644 (file)
index 0000000..ebefcd6
--- /dev/null
@@ -0,0 +1 @@
+[å]
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/error b/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/error
new file mode 100644 (file)
index 0000000..74252d7
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 4
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/input b/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/input
new file mode 100644 (file)
index 0000000..e512f9a
--- /dev/null
@@ -0,0 +1 @@
+[123å]
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-escape/error b/test/suites/invalid-unicode/invalid-utf-8-in-escape/error
new file mode 100644 (file)
index 0000000..74252d7
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 4
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-escape/input b/test/suites/invalid-unicode/invalid-utf-8-in-escape/input
new file mode 100644 (file)
index 0000000..2b271b8
--- /dev/null
@@ -0,0 +1 @@
+["\uå"]
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-exponent/error b/test/suites/invalid-unicode/invalid-utf-8-in-exponent/error
new file mode 100644 (file)
index 0000000..74252d7
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 4
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-exponent/input b/test/suites/invalid-unicode/invalid-utf-8-in-exponent/input
new file mode 100644 (file)
index 0000000..d8e83c5
--- /dev/null
@@ -0,0 +1 @@
+[1e1å]
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-identifier/error b/test/suites/invalid-unicode/invalid-utf-8-in-identifier/error
new file mode 100644 (file)
index 0000000..39763ec
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 2
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-identifier/input b/test/suites/invalid-unicode/invalid-utf-8-in-identifier/input
new file mode 100644 (file)
index 0000000..ef03851
--- /dev/null
@@ -0,0 +1 @@
+[aå]
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-int/error b/test/suites/invalid-unicode/invalid-utf-8-in-int/error
new file mode 100644 (file)
index 0000000..39763ec
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 2
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-int/input b/test/suites/invalid-unicode/invalid-utf-8-in-int/input
new file mode 100644 (file)
index 0000000..371226e
--- /dev/null
@@ -0,0 +1 @@
+[0å]
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/error b/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/error
new file mode 100644 (file)
index 0000000..50beb0a
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 3
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/input b/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/input
new file mode 100644 (file)
index 0000000..17fc29c
--- /dev/null
@@ -0,0 +1 @@
+[1eå]
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-string/error b/test/suites/invalid-unicode/invalid-utf-8-in-string/error
new file mode 100644 (file)
index 0000000..39763ec
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 2
diff --git a/test/suites/invalid-unicode/invalid-utf-8-in-string/input b/test/suites/invalid-unicode/invalid-utf-8-in-string/input
new file mode 100644 (file)
index 0000000..00b79c0
--- /dev/null
@@ -0,0 +1 @@
+["å <-- invalid UTF-8"]
diff --git a/test/suites/invalid-unicode/lone-invalid-utf-8/error b/test/suites/invalid-unicode/lone-invalid-utf-8/error
new file mode 100644 (file)
index 0000000..77f16c9
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe5 at position 0
diff --git a/test/suites/invalid-unicode/lone-invalid-utf-8/input b/test/suites/invalid-unicode/lone-invalid-utf-8/input
new file mode 100644 (file)
index 0000000..eb80796
--- /dev/null
@@ -0,0 +1 @@
diff --git a/test/suites/invalid-unicode/lone-utf-8-continuation-byte/error b/test/suites/invalid-unicode/lone-utf-8-continuation-byte/error
new file mode 100644 (file)
index 0000000..370738e
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0x81 at position 2
diff --git a/test/suites/invalid-unicode/lone-utf-8-continuation-byte/input b/test/suites/invalid-unicode/lone-utf-8-continuation-byte/input
new file mode 100644 (file)
index 0000000..62a26b6
--- /dev/null
@@ -0,0 +1 @@
+["\81"]
diff --git a/test/suites/invalid-unicode/not-in-unicode-range/error b/test/suites/invalid-unicode/not-in-unicode-range/error
new file mode 100644 (file)
index 0000000..5a00b67
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xf4 at position 2
diff --git a/test/suites/invalid-unicode/not-in-unicode-range/input b/test/suites/invalid-unicode/not-in-unicode-range/input
new file mode 100644 (file)
index 0000000..1216186
--- /dev/null
@@ -0,0 +1 @@
+[""]
diff --git a/test/suites/invalid-unicode/overlong-3-byte-encoding/error b/test/suites/invalid-unicode/overlong-3-byte-encoding/error
new file mode 100644 (file)
index 0000000..48796d1
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe0 at position 2
diff --git a/test/suites/invalid-unicode/overlong-3-byte-encoding/input b/test/suites/invalid-unicode/overlong-3-byte-encoding/input
new file mode 100644 (file)
index 0000000..0bf909f
--- /dev/null
@@ -0,0 +1 @@
+["à\80¢ <-- overlong encoding"]
diff --git a/test/suites/invalid-unicode/overlong-4-byte-encoding/error b/test/suites/invalid-unicode/overlong-4-byte-encoding/error
new file mode 100644 (file)
index 0000000..5c6e37f
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xf0 at position 2
diff --git a/test/suites/invalid-unicode/overlong-4-byte-encoding/input b/test/suites/invalid-unicode/overlong-4-byte-encoding/input
new file mode 100644 (file)
index 0000000..c6b6313
--- /dev/null
@@ -0,0 +1 @@
+["ð\80\80¢ <-- overlong encoding"]
diff --git a/test/suites/invalid-unicode/overlong-ascii-encoding/error b/test/suites/invalid-unicode/overlong-ascii-encoding/error
new file mode 100644 (file)
index 0000000..8fbf914
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xc1 at position 2
diff --git a/test/suites/invalid-unicode/overlong-ascii-encoding/input b/test/suites/invalid-unicode/overlong-ascii-encoding/input
new file mode 100644 (file)
index 0000000..ef6e10a
--- /dev/null
@@ -0,0 +1 @@
+["Á"]
diff --git a/test/suites/invalid-unicode/restricted-utf-8/error b/test/suites/invalid-unicode/restricted-utf-8/error
new file mode 100644 (file)
index 0000000..e71089d
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xfd at position 2
diff --git a/test/suites/invalid-unicode/restricted-utf-8/input b/test/suites/invalid-unicode/restricted-utf-8/input
new file mode 100644 (file)
index 0000000..ba60170
--- /dev/null
@@ -0,0 +1 @@
+["ý"]
diff --git a/test/suites/invalid-unicode/run b/test/suites/invalid-unicode/run
new file mode 100755 (executable)
index 0000000..1c6130d
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+    test -d $test_path
+}
+
+run_test() {
+    $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+    valgrind_check $test_log/stderr || return 1
+    cmp -s $test_path/error $test_log/stderr
+}
+
+show_error() {
+    valgrind_show_error && return
+
+    echo "EXPECTED ERROR:"
+    nl -bn $test_path/error
+    echo "ACTUAL ERROR:"
+    nl -bn $test_log/stderr
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
diff --git a/test/suites/invalid-unicode/truncated-utf-8/error b/test/suites/invalid-unicode/truncated-utf-8/error
new file mode 100644 (file)
index 0000000..48796d1
--- /dev/null
@@ -0,0 +1,2 @@
+-1
+unable to decode byte 0xe0 at position 2
diff --git a/test/suites/invalid-unicode/truncated-utf-8/input b/test/suites/invalid-unicode/truncated-utf-8/input
new file mode 100644 (file)
index 0000000..bce9e18
--- /dev/null
@@ -0,0 +1 @@
+["àÿ <-- truncated UTF-8"]
diff --git a/test/suites/invalid/apostrophe/error b/test/suites/invalid/apostrophe/error
new file mode 100644 (file)
index 0000000..f30d170
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '''
diff --git a/test/suites/invalid/apostrophe/input b/test/suites/invalid/apostrophe/input
new file mode 100644 (file)
index 0000000..f2dd4d2
--- /dev/null
@@ -0,0 +1 @@
+['
diff --git a/test/suites/invalid/ascii-unicode-identifier/error b/test/suites/invalid/ascii-unicode-identifier/error
new file mode 100644 (file)
index 0000000..7469919
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'[' or '{' expected near 'a'
diff --git a/test/suites/invalid/ascii-unicode-identifier/input b/test/suites/invalid/ascii-unicode-identifier/input
new file mode 100644 (file)
index 0000000..c2c0208
--- /dev/null
@@ -0,0 +1 @@
+aå
diff --git a/test/suites/invalid/brace-comma/error b/test/suites/invalid/brace-comma/error
new file mode 100644 (file)
index 0000000..394ad5a
--- /dev/null
@@ -0,0 +1,2 @@
+1
+string or '}' expected near ','
diff --git a/test/suites/invalid/brace-comma/input b/test/suites/invalid/brace-comma/input
new file mode 100644 (file)
index 0000000..74a6628
--- /dev/null
@@ -0,0 +1 @@
+{,
diff --git a/test/suites/invalid/bracket-comma/error b/test/suites/invalid/bracket-comma/error
new file mode 100644 (file)
index 0000000..54c3924
--- /dev/null
@@ -0,0 +1,2 @@
+1
+unexpected token near ','
diff --git a/test/suites/invalid/bracket-comma/input b/test/suites/invalid/bracket-comma/input
new file mode 100644 (file)
index 0000000..5b911f1
--- /dev/null
@@ -0,0 +1 @@
+[,
diff --git a/test/suites/invalid/bracket-one-comma/error b/test/suites/invalid/bracket-one-comma/error
new file mode 100644 (file)
index 0000000..41fd6d6
--- /dev/null
@@ -0,0 +1,2 @@
+2
+']' expected near end of file
diff --git a/test/suites/invalid/bracket-one-comma/input b/test/suites/invalid/bracket-one-comma/input
new file mode 100644 (file)
index 0000000..874691b
--- /dev/null
@@ -0,0 +1 @@
+[1,
diff --git a/test/suites/invalid/empty/error b/test/suites/invalid/empty/error
new file mode 100644 (file)
index 0000000..ff19200
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'[' or '{' expected near end of file
diff --git a/test/suites/invalid/empty/input b/test/suites/invalid/empty/input
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/suites/invalid/extra-comma-in-array/error b/test/suites/invalid/extra-comma-in-array/error
new file mode 100644 (file)
index 0000000..38afe71
--- /dev/null
@@ -0,0 +1,2 @@
+1
+unexpected token near ']'
diff --git a/test/suites/invalid/extra-comma-in-array/input b/test/suites/invalid/extra-comma-in-array/input
new file mode 100644 (file)
index 0000000..e8b1a17
--- /dev/null
@@ -0,0 +1 @@
+[1,]
diff --git a/test/suites/invalid/extra-command-in-multiline-array/error b/test/suites/invalid/extra-command-in-multiline-array/error
new file mode 100644 (file)
index 0000000..26c2152
--- /dev/null
@@ -0,0 +1,2 @@
+6
+unexpected token near ']'
diff --git a/test/suites/invalid/extra-command-in-multiline-array/input b/test/suites/invalid/extra-command-in-multiline-array/input
new file mode 100644 (file)
index 0000000..bcb2a75
--- /dev/null
@@ -0,0 +1,6 @@
+[1,
+2,
+3,
+4,
+5,
+]
diff --git a/test/suites/invalid/garbage-after-newline/error b/test/suites/invalid/garbage-after-newline/error
new file mode 100644 (file)
index 0000000..90eacdd
--- /dev/null
@@ -0,0 +1,2 @@
+2
+end of file expected near 'foo'
diff --git a/test/suites/invalid/garbage-after-newline/input b/test/suites/invalid/garbage-after-newline/input
new file mode 100644 (file)
index 0000000..3614ac7
--- /dev/null
@@ -0,0 +1,2 @@
+[1,2,3]
+foo
diff --git a/test/suites/invalid/garbage-at-the-end/error b/test/suites/invalid/garbage-at-the-end/error
new file mode 100644 (file)
index 0000000..9076aec
--- /dev/null
@@ -0,0 +1,2 @@
+1
+end of file expected near 'foo'
diff --git a/test/suites/invalid/garbage-at-the-end/input b/test/suites/invalid/garbage-at-the-end/input
new file mode 100644 (file)
index 0000000..55aee53
--- /dev/null
@@ -0,0 +1 @@
+[1,2,3]foo
diff --git a/test/suites/invalid/integer-starting-with-zero/error b/test/suites/invalid/integer-starting-with-zero/error
new file mode 100644 (file)
index 0000000..e4eee2f
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '0'
diff --git a/test/suites/invalid/integer-starting-with-zero/input b/test/suites/invalid/integer-starting-with-zero/input
new file mode 100644 (file)
index 0000000..12f67e2
--- /dev/null
@@ -0,0 +1 @@
+[012]
diff --git a/test/suites/invalid/invalid-escape/error b/test/suites/invalid/invalid-escape/error
new file mode 100644 (file)
index 0000000..9930ca7
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid escape near '"\'
diff --git a/test/suites/invalid/invalid-escape/input b/test/suites/invalid/invalid-escape/input
new file mode 100644 (file)
index 0000000..64c7b70
--- /dev/null
@@ -0,0 +1 @@
+["\a <-- invalid escape"]
diff --git a/test/suites/invalid/invalid-identifier/error b/test/suites/invalid/invalid-identifier/error
new file mode 100644 (file)
index 0000000..0f88417
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near 'troo'
diff --git a/test/suites/invalid/invalid-identifier/input b/test/suites/invalid/invalid-identifier/input
new file mode 100644 (file)
index 0000000..3d2860d
--- /dev/null
@@ -0,0 +1 @@
+[troo
diff --git a/test/suites/invalid/invalid-negative-integerr/error b/test/suites/invalid/invalid-negative-integerr/error
new file mode 100644 (file)
index 0000000..f9d930e
--- /dev/null
@@ -0,0 +1,2 @@
+1
+']' expected near 'foo'
diff --git a/test/suites/invalid/invalid-negative-integerr/input b/test/suites/invalid/invalid-negative-integerr/input
new file mode 100644 (file)
index 0000000..6196980
--- /dev/null
@@ -0,0 +1 @@
+[-123foo]
diff --git a/test/suites/invalid/invalid-negative-real/error b/test/suites/invalid/invalid-negative-real/error
new file mode 100644 (file)
index 0000000..f9d930e
--- /dev/null
@@ -0,0 +1,2 @@
+1
+']' expected near 'foo'
diff --git a/test/suites/invalid/invalid-negative-real/input b/test/suites/invalid/invalid-negative-real/input
new file mode 100644 (file)
index 0000000..3c763d3
--- /dev/null
@@ -0,0 +1 @@
+[-123.123foo]
diff --git a/test/suites/invalid/invalid-second-surrogate/error b/test/suites/invalid/invalid-second-surrogate/error
new file mode 100644 (file)
index 0000000..22d0e1f
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid Unicode '\uD888\u3210'
diff --git a/test/suites/invalid/invalid-second-surrogate/input b/test/suites/invalid/invalid-second-surrogate/input
new file mode 100644 (file)
index 0000000..b21453f
--- /dev/null
@@ -0,0 +1 @@
+["\uD888\u3210 (first surrogate and invalid second surrogate)"]
diff --git a/test/suites/invalid/lone-open-brace/error b/test/suites/invalid/lone-open-brace/error
new file mode 100644 (file)
index 0000000..a31caf7
--- /dev/null
@@ -0,0 +1,2 @@
+2
+string or '}' expected near end of file
diff --git a/test/suites/invalid/lone-open-brace/input b/test/suites/invalid/lone-open-brace/input
new file mode 100644 (file)
index 0000000..98232c6
--- /dev/null
@@ -0,0 +1 @@
+{
diff --git a/test/suites/invalid/lone-open-bracket/error b/test/suites/invalid/lone-open-bracket/error
new file mode 100644 (file)
index 0000000..41fd6d6
--- /dev/null
@@ -0,0 +1,2 @@
+2
+']' expected near end of file
diff --git a/test/suites/invalid/lone-open-bracket/input b/test/suites/invalid/lone-open-bracket/input
new file mode 100644 (file)
index 0000000..558ed37
--- /dev/null
@@ -0,0 +1 @@
+[
diff --git a/test/suites/invalid/lone-second-surrogate/error b/test/suites/invalid/lone-second-surrogate/error
new file mode 100644 (file)
index 0000000..c96d7f5
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid Unicode '\uDFAA'
diff --git a/test/suites/invalid/lone-second-surrogate/input b/test/suites/invalid/lone-second-surrogate/input
new file mode 100644 (file)
index 0000000..328e35c
--- /dev/null
@@ -0,0 +1 @@
+["\uDFAA (second surrogate on it's own)"]
diff --git a/test/suites/invalid/minus-sign-without-number/error b/test/suites/invalid/minus-sign-without-number/error
new file mode 100644 (file)
index 0000000..e978234
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '-'
diff --git a/test/suites/invalid/minus-sign-without-number/input b/test/suites/invalid/minus-sign-without-number/input
new file mode 100644 (file)
index 0000000..0337883
--- /dev/null
@@ -0,0 +1 @@
+[-foo]
diff --git a/test/suites/invalid/negative-integer-starting-with-zero/error b/test/suites/invalid/negative-integer-starting-with-zero/error
new file mode 100644 (file)
index 0000000..a758d94
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '-0'
diff --git a/test/suites/invalid/negative-integer-starting-with-zero/input b/test/suites/invalid/negative-integer-starting-with-zero/input
new file mode 100644 (file)
index 0000000..6fbb7a2
--- /dev/null
@@ -0,0 +1 @@
+[-012]
diff --git a/test/suites/invalid/null-byte-in-string/error b/test/suites/invalid/null-byte-in-string/error
new file mode 100644 (file)
index 0000000..0fa36e2
--- /dev/null
@@ -0,0 +1,2 @@
+1
+\u0000 is not allowed
diff --git a/test/suites/invalid/null-byte-in-string/input b/test/suites/invalid/null-byte-in-string/input
new file mode 100644 (file)
index 0000000..22ae82b
--- /dev/null
@@ -0,0 +1 @@
+["\u0000 (null byte not allowed)"]
diff --git a/test/suites/invalid/null/error b/test/suites/invalid/null/error
new file mode 100644 (file)
index 0000000..de9280b
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'[' or '{' expected near 'null'
diff --git a/test/suites/invalid/null/input b/test/suites/invalid/null/input
new file mode 100644 (file)
index 0000000..19765bd
--- /dev/null
@@ -0,0 +1 @@
+null
diff --git a/test/suites/invalid/object-apostrophes/error b/test/suites/invalid/object-apostrophes/error
new file mode 100644 (file)
index 0000000..f7b586a
--- /dev/null
@@ -0,0 +1,2 @@
+1
+string or '}' expected near '''
diff --git a/test/suites/invalid/object-apostrophes/input b/test/suites/invalid/object-apostrophes/input
new file mode 100644 (file)
index 0000000..52b2905
--- /dev/null
@@ -0,0 +1 @@
+{'a'
diff --git a/test/suites/invalid/object-garbage-at-end/error b/test/suites/invalid/object-garbage-at-end/error
new file mode 100644 (file)
index 0000000..a60dc47
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'}' expected near '123'
diff --git a/test/suites/invalid/object-garbage-at-end/input b/test/suites/invalid/object-garbage-at-end/input
new file mode 100644 (file)
index 0000000..62c19d7
--- /dev/null
@@ -0,0 +1 @@
+{"a":"a" 123}
diff --git a/test/suites/invalid/object-in-unterminated-array/error b/test/suites/invalid/object-in-unterminated-array/error
new file mode 100644 (file)
index 0000000..41fd6d6
--- /dev/null
@@ -0,0 +1,2 @@
+2
+']' expected near end of file
diff --git a/test/suites/invalid/object-in-unterminated-array/input b/test/suites/invalid/object-in-unterminated-array/input
new file mode 100644 (file)
index 0000000..ca9ec37
--- /dev/null
@@ -0,0 +1 @@
+[{}
diff --git a/test/suites/invalid/object-no-colon/error b/test/suites/invalid/object-no-colon/error
new file mode 100644 (file)
index 0000000..80c9249
--- /dev/null
@@ -0,0 +1,2 @@
+2
+':' expected near end of file
diff --git a/test/suites/invalid/object-no-colon/input b/test/suites/invalid/object-no-colon/input
new file mode 100644 (file)
index 0000000..107e626
--- /dev/null
@@ -0,0 +1 @@
+{"a"
diff --git a/test/suites/invalid/object-no-value/error b/test/suites/invalid/object-no-value/error
new file mode 100644 (file)
index 0000000..f252060
--- /dev/null
@@ -0,0 +1,2 @@
+2
+unexpected token near end of file
diff --git a/test/suites/invalid/object-no-value/input b/test/suites/invalid/object-no-value/input
new file mode 100644 (file)
index 0000000..f68f262
--- /dev/null
@@ -0,0 +1 @@
+{"a":
diff --git a/test/suites/invalid/object-unterminated-value/error b/test/suites/invalid/object-unterminated-value/error
new file mode 100644 (file)
index 0000000..9b725a2
--- /dev/null
@@ -0,0 +1,2 @@
+1
+unexpected newline near '"a'
diff --git a/test/suites/invalid/object-unterminated-value/input b/test/suites/invalid/object-unterminated-value/input
new file mode 100644 (file)
index 0000000..b854d7e
--- /dev/null
@@ -0,0 +1 @@
+{"a":"a
diff --git a/test/suites/invalid/real-garbage-after-e/error b/test/suites/invalid/real-garbage-after-e/error
new file mode 100644 (file)
index 0000000..d9b83e7
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '1e'
diff --git a/test/suites/invalid/real-garbage-after-e/input b/test/suites/invalid/real-garbage-after-e/input
new file mode 100644 (file)
index 0000000..6a945ac
--- /dev/null
@@ -0,0 +1 @@
+[1ea]
diff --git a/test/suites/invalid/real-negative-overflow/error b/test/suites/invalid/real-negative-overflow/error
new file mode 100644 (file)
index 0000000..af5a850
--- /dev/null
@@ -0,0 +1,2 @@
+1
+real number overflow near '-123123e100000'
diff --git a/test/suites/invalid/real-negative-overflow/input b/test/suites/invalid/real-negative-overflow/input
new file mode 100644 (file)
index 0000000..b5bd21c
--- /dev/null
@@ -0,0 +1 @@
+[-123123e100000]
diff --git a/test/suites/invalid/real-positive-overflow/error b/test/suites/invalid/real-positive-overflow/error
new file mode 100644 (file)
index 0000000..e9becc3
--- /dev/null
@@ -0,0 +1,2 @@
+1
+real number overflow near '123123e100000'
diff --git a/test/suites/invalid/real-positive-overflow/input b/test/suites/invalid/real-positive-overflow/input
new file mode 100644 (file)
index 0000000..524e53b
--- /dev/null
@@ -0,0 +1 @@
+[123123e100000]
diff --git a/test/suites/invalid/real-truncated-at-e/error b/test/suites/invalid/real-truncated-at-e/error
new file mode 100644 (file)
index 0000000..d9b83e7
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '1e'
diff --git a/test/suites/invalid/real-truncated-at-e/input b/test/suites/invalid/real-truncated-at-e/input
new file mode 100644 (file)
index 0000000..1d67b7b
--- /dev/null
@@ -0,0 +1 @@
+[1e]
diff --git a/test/suites/invalid/real-truncated-at-point/error b/test/suites/invalid/real-truncated-at-point/error
new file mode 100644 (file)
index 0000000..7312401
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid token near '1.'
diff --git a/test/suites/invalid/real-truncated-at-point/input b/test/suites/invalid/real-truncated-at-point/input
new file mode 100644 (file)
index 0000000..b652b3f
--- /dev/null
@@ -0,0 +1 @@
+[1.]
diff --git a/test/suites/invalid/real-underflow/error b/test/suites/invalid/real-underflow/error
new file mode 100644 (file)
index 0000000..1b65d40
--- /dev/null
@@ -0,0 +1,2 @@
+1
+real number underflow near '123e-10000000'
diff --git a/test/suites/invalid/real-underflow/input b/test/suites/invalid/real-underflow/input
new file mode 100644 (file)
index 0000000..dc70996
--- /dev/null
@@ -0,0 +1 @@
+[123e-10000000]
diff --git a/test/suites/invalid/run b/test/suites/invalid/run
new file mode 100755 (executable)
index 0000000..1c6130d
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+    test -d $test_path
+}
+
+run_test() {
+    $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+    valgrind_check $test_log/stderr || return 1
+    cmp -s $test_path/error $test_log/stderr
+}
+
+show_error() {
+    valgrind_show_error && return
+
+    echo "EXPECTED ERROR:"
+    nl -bn $test_path/error
+    echo "ACTUAL ERROR:"
+    nl -bn $test_log/stderr
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
diff --git a/test/suites/invalid/tab-character-in-string/error b/test/suites/invalid/tab-character-in-string/error
new file mode 100644 (file)
index 0000000..ee81a5f
--- /dev/null
@@ -0,0 +1,2 @@
+1
+control character 0x9 near '"'
diff --git a/test/suites/invalid/tab-character-in-string/input b/test/suites/invalid/tab-character-in-string/input
new file mode 100644 (file)
index 0000000..3ebae09
--- /dev/null
@@ -0,0 +1 @@
+["      <-- tab character"]
diff --git a/test/suites/invalid/too-big-negative-integer/error b/test/suites/invalid/too-big-negative-integer/error
new file mode 100644 (file)
index 0000000..4245f39
--- /dev/null
@@ -0,0 +1,2 @@
+1
+too big negative integer near '-123123123123123'
diff --git a/test/suites/invalid/too-big-negative-integer/input b/test/suites/invalid/too-big-negative-integer/input
new file mode 100644 (file)
index 0000000..40ed1bb
--- /dev/null
@@ -0,0 +1 @@
+[-123123123123123]
diff --git a/test/suites/invalid/too-big-positive-integer/error b/test/suites/invalid/too-big-positive-integer/error
new file mode 100644 (file)
index 0000000..4761ad3
--- /dev/null
@@ -0,0 +1,2 @@
+1
+too big integer near '123123123123123'
diff --git a/test/suites/invalid/too-big-positive-integer/input b/test/suites/invalid/too-big-positive-integer/input
new file mode 100644 (file)
index 0000000..d045071
--- /dev/null
@@ -0,0 +1 @@
+[123123123123123]
diff --git a/test/suites/invalid/truncated-unicode-surrogate/error b/test/suites/invalid/truncated-unicode-surrogate/error
new file mode 100644 (file)
index 0000000..17b932d
--- /dev/null
@@ -0,0 +1,2 @@
+1
+invalid Unicode '\uDADA'
diff --git a/test/suites/invalid/truncated-unicode-surrogate/input b/test/suites/invalid/truncated-unicode-surrogate/input
new file mode 100644 (file)
index 0000000..2b340f4
--- /dev/null
@@ -0,0 +1 @@
+["\uDADA (first surrogate without the second)"]
diff --git a/test/suites/invalid/unicode-identifier/error b/test/suites/invalid/unicode-identifier/error
new file mode 100644 (file)
index 0000000..e3817fa
--- /dev/null
@@ -0,0 +1,2 @@
+1
+'[' or '{' expected near 'å'
diff --git a/test/suites/invalid/unicode-identifier/input b/test/suites/invalid/unicode-identifier/input
new file mode 100644 (file)
index 0000000..aad321c
--- /dev/null
@@ -0,0 +1 @@
diff --git a/test/suites/invalid/unterminated-array-and-object/error b/test/suites/invalid/unterminated-array-and-object/error
new file mode 100644 (file)
index 0000000..a31caf7
--- /dev/null
@@ -0,0 +1,2 @@
+2
+string or '}' expected near end of file
diff --git a/test/suites/invalid/unterminated-array-and-object/input b/test/suites/invalid/unterminated-array-and-object/input
new file mode 100644 (file)
index 0000000..cd9dc64
--- /dev/null
@@ -0,0 +1 @@
+[{
diff --git a/test/suites/invalid/unterminated-array/error b/test/suites/invalid/unterminated-array/error
new file mode 100644 (file)
index 0000000..41fd6d6
--- /dev/null
@@ -0,0 +1,2 @@
+2
+']' expected near end of file
diff --git a/test/suites/invalid/unterminated-array/input b/test/suites/invalid/unterminated-array/input
new file mode 100644 (file)
index 0000000..727ee81
--- /dev/null
@@ -0,0 +1 @@
+["a"
diff --git a/test/suites/invalid/unterminated-empty-key/error b/test/suites/invalid/unterminated-empty-key/error
new file mode 100644 (file)
index 0000000..6691458
--- /dev/null
@@ -0,0 +1,2 @@
+1
+unexpected newline near '"'
diff --git a/test/suites/invalid/unterminated-empty-key/input b/test/suites/invalid/unterminated-empty-key/input
new file mode 100644 (file)
index 0000000..4117452
--- /dev/null
@@ -0,0 +1 @@
+{"
diff --git a/test/suites/invalid/unterminated-key/error b/test/suites/invalid/unterminated-key/error
new file mode 100644 (file)
index 0000000..9b725a2
--- /dev/null
@@ -0,0 +1,2 @@
+1
+unexpected newline near '"a'
diff --git a/test/suites/invalid/unterminated-key/input b/test/suites/invalid/unterminated-key/input
new file mode 100644 (file)
index 0000000..705948c
--- /dev/null
@@ -0,0 +1 @@
+{"a
diff --git a/test/suites/invalid/unterminated-object-and-array/error b/test/suites/invalid/unterminated-object-and-array/error
new file mode 100644 (file)
index 0000000..5fe61b5
--- /dev/null
@@ -0,0 +1,2 @@
+1
+string or '}' expected near '['
diff --git a/test/suites/invalid/unterminated-object-and-array/input b/test/suites/invalid/unterminated-object-and-array/input
new file mode 100644 (file)
index 0000000..da35a86
--- /dev/null
@@ -0,0 +1 @@
+{[
diff --git a/test/suites/invalid/unterminated-string/error b/test/suites/invalid/unterminated-string/error
new file mode 100644 (file)
index 0000000..9b725a2
--- /dev/null
@@ -0,0 +1,2 @@
+1
+unexpected newline near '"a'
diff --git a/test/suites/invalid/unterminated-string/input b/test/suites/invalid/unterminated-string/input
new file mode 100644 (file)
index 0000000..38ab6b0
--- /dev/null
@@ -0,0 +1 @@
+["a
diff --git a/test/suites/valid-strip/complex-array/input b/test/suites/valid-strip/complex-array/input
new file mode 100644 (file)
index 0000000..7255532
--- /dev/null
@@ -0,0 +1,5 @@
+[1,2,3,4,
+"a", "b", "c",
+{"foo": "bar", "core": "dump"},
+true, false, true, true, null, false
+]
\ No newline at end of file
diff --git a/test/suites/valid-strip/complex-array/output b/test/suites/valid-strip/complex-array/output
new file mode 100644 (file)
index 0000000..44ac463
--- /dev/null
@@ -0,0 +1 @@
+[1, 2, 3, 4, "a", "b", "c", {"foo": "bar", "core": "dump"}, true, false, true, true, null, false]
\ No newline at end of file
diff --git a/test/suites/valid-strip/empty-array/input b/test/suites/valid-strip/empty-array/input
new file mode 100644 (file)
index 0000000..0637a08
--- /dev/null
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/test/suites/valid-strip/empty-array/output b/test/suites/valid-strip/empty-array/output
new file mode 100644 (file)
index 0000000..0637a08
--- /dev/null
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/test/suites/valid-strip/empty-object-in-array/input b/test/suites/valid-strip/empty-object-in-array/input
new file mode 100644 (file)
index 0000000..ee1aac4
--- /dev/null
@@ -0,0 +1 @@
+[{}]
\ No newline at end of file
diff --git a/test/suites/valid-strip/empty-object-in-array/output b/test/suites/valid-strip/empty-object-in-array/output
new file mode 100644 (file)
index 0000000..ee1aac4
--- /dev/null
@@ -0,0 +1 @@
+[{}]
\ No newline at end of file
diff --git a/test/suites/valid-strip/empty-object/input b/test/suites/valid-strip/empty-object/input
new file mode 100644 (file)
index 0000000..9e26dfe
--- /dev/null
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/test/suites/valid-strip/empty-object/output b/test/suites/valid-strip/empty-object/output
new file mode 100644 (file)
index 0000000..9e26dfe
--- /dev/null
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/test/suites/valid-strip/empty-string/input b/test/suites/valid-strip/empty-string/input
new file mode 100644 (file)
index 0000000..93b6be2
--- /dev/null
@@ -0,0 +1 @@
+[""]
\ No newline at end of file
diff --git a/test/suites/valid-strip/empty-string/output b/test/suites/valid-strip/empty-string/output
new file mode 100644 (file)
index 0000000..93b6be2
--- /dev/null
@@ -0,0 +1 @@
+[""]
\ No newline at end of file
diff --git a/test/suites/valid-strip/escaped-utf-control-char/input b/test/suites/valid-strip/escaped-utf-control-char/input
new file mode 100644 (file)
index 0000000..07221b7
--- /dev/null
@@ -0,0 +1 @@
+["\u0012 escaped control character"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/escaped-utf-control-char/output b/test/suites/valid-strip/escaped-utf-control-char/output
new file mode 100644 (file)
index 0000000..07221b7
--- /dev/null
@@ -0,0 +1 @@
+["\u0012 escaped control character"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/false/input b/test/suites/valid-strip/false/input
new file mode 100644 (file)
index 0000000..67b2f07
--- /dev/null
@@ -0,0 +1 @@
+[false]
\ No newline at end of file
diff --git a/test/suites/valid-strip/false/output b/test/suites/valid-strip/false/output
new file mode 100644 (file)
index 0000000..67b2f07
--- /dev/null
@@ -0,0 +1 @@
+[false]
\ No newline at end of file
diff --git a/test/suites/valid-strip/negative-int/input b/test/suites/valid-strip/negative-int/input
new file mode 100644 (file)
index 0000000..8e30f8b
--- /dev/null
@@ -0,0 +1 @@
+[-123]
\ No newline at end of file
diff --git a/test/suites/valid-strip/negative-int/output b/test/suites/valid-strip/negative-int/output
new file mode 100644 (file)
index 0000000..8e30f8b
--- /dev/null
@@ -0,0 +1 @@
+[-123]
\ No newline at end of file
diff --git a/test/suites/valid-strip/negative-one/input b/test/suites/valid-strip/negative-one/input
new file mode 100644 (file)
index 0000000..99d21a2
--- /dev/null
@@ -0,0 +1 @@
+[-1]
\ No newline at end of file
diff --git a/test/suites/valid-strip/negative-one/output b/test/suites/valid-strip/negative-one/output
new file mode 100644 (file)
index 0000000..99d21a2
--- /dev/null
@@ -0,0 +1 @@
+[-1]
\ No newline at end of file
diff --git a/test/suites/valid-strip/negative-zero/input b/test/suites/valid-strip/negative-zero/input
new file mode 100644 (file)
index 0000000..37af131
--- /dev/null
@@ -0,0 +1 @@
+[-0]
\ No newline at end of file
diff --git a/test/suites/valid-strip/negative-zero/output b/test/suites/valid-strip/negative-zero/output
new file mode 100644 (file)
index 0000000..6e7ea63
--- /dev/null
@@ -0,0 +1 @@
+[0]
\ No newline at end of file
diff --git a/test/suites/valid-strip/null/input b/test/suites/valid-strip/null/input
new file mode 100644 (file)
index 0000000..500db4a
--- /dev/null
@@ -0,0 +1 @@
+[null]
\ No newline at end of file
diff --git a/test/suites/valid-strip/null/output b/test/suites/valid-strip/null/output
new file mode 100644 (file)
index 0000000..500db4a
--- /dev/null
@@ -0,0 +1 @@
+[null]
\ No newline at end of file
diff --git a/test/suites/valid-strip/one-byte-utf-8/input b/test/suites/valid-strip/one-byte-utf-8/input
new file mode 100644 (file)
index 0000000..f26edd0
--- /dev/null
@@ -0,0 +1 @@
+["\u002c one-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/one-byte-utf-8/output b/test/suites/valid-strip/one-byte-utf-8/output
new file mode 100644 (file)
index 0000000..c33d250
--- /dev/null
@@ -0,0 +1 @@
+[", one-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-capital-e-negative-exponent/input b/test/suites/valid-strip/real-capital-e-negative-exponent/input
new file mode 100644 (file)
index 0000000..0a01bd3
--- /dev/null
@@ -0,0 +1 @@
+[1E-2]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-capital-e-negative-exponent/output b/test/suites/valid-strip/real-capital-e-negative-exponent/output
new file mode 100644 (file)
index 0000000..9c9a06a
--- /dev/null
@@ -0,0 +1 @@
+[0.01000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-capital-e-positive-exponent/input b/test/suites/valid-strip/real-capital-e-positive-exponent/input
new file mode 100644 (file)
index 0000000..5a8fc09
--- /dev/null
@@ -0,0 +1 @@
+[1E+2]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-capital-e-positive-exponent/output b/test/suites/valid-strip/real-capital-e-positive-exponent/output
new file mode 100644 (file)
index 0000000..0cc2e4d
--- /dev/null
@@ -0,0 +1 @@
+[100.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-capital-e/input b/test/suites/valid-strip/real-capital-e/input
new file mode 100644 (file)
index 0000000..6edbdfc
--- /dev/null
@@ -0,0 +1 @@
+[1E22]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-capital-e/output b/test/suites/valid-strip/real-capital-e/output
new file mode 100644 (file)
index 0000000..5750cf5
--- /dev/null
@@ -0,0 +1 @@
+[10000000000000000000000.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-exponent/input b/test/suites/valid-strip/real-exponent/input
new file mode 100644 (file)
index 0000000..da2522d
--- /dev/null
@@ -0,0 +1 @@
+[123e45]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-exponent/output b/test/suites/valid-strip/real-exponent/output
new file mode 100644 (file)
index 0000000..f78e2cd
--- /dev/null
@@ -0,0 +1 @@
+[122999999999999994846185700645503654167417192448.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-fraction-exponent/input b/test/suites/valid-strip/real-fraction-exponent/input
new file mode 100644 (file)
index 0000000..3944a7a
--- /dev/null
@@ -0,0 +1 @@
+[123.456e78]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-fraction-exponent/output b/test/suites/valid-strip/real-fraction-exponent/output
new file mode 100644 (file)
index 0000000..c0ca46e
--- /dev/null
@@ -0,0 +1 @@
+[123456000000000003773544074641513176432063851726237026847343602712484748520849408.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-negative-exponent/input b/test/suites/valid-strip/real-negative-exponent/input
new file mode 100644 (file)
index 0000000..ca40d3c
--- /dev/null
@@ -0,0 +1 @@
+[1e-2]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-negative-exponent/output b/test/suites/valid-strip/real-negative-exponent/output
new file mode 100644 (file)
index 0000000..9c9a06a
--- /dev/null
@@ -0,0 +1 @@
+[0.01000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-positive-exponent/input b/test/suites/valid-strip/real-positive-exponent/input
new file mode 100644 (file)
index 0000000..343601d
--- /dev/null
@@ -0,0 +1 @@
+[1e+2]
\ No newline at end of file
diff --git a/test/suites/valid-strip/real-positive-exponent/output b/test/suites/valid-strip/real-positive-exponent/output
new file mode 100644 (file)
index 0000000..0cc2e4d
--- /dev/null
@@ -0,0 +1 @@
+[100.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid-strip/run b/test/suites/valid-strip/run
new file mode 100755 (executable)
index 0000000..6d2bc2f
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+    test -d $test_path
+}
+
+run_test() {
+    $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+    valgrind_check $test_log/stderr || return 1
+    cmp -s $test_path/output $test_log/stdout
+}
+
+show_error() {
+    valgrind_show_error && return
+
+    echo "EXPECTED OUTPUT:"
+    nl -bn $test_path/output
+    echo "ACTUAL OUTPUT:"
+    nl -bn $test_log/stdout
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
diff --git a/test/suites/valid-strip/short-string/input b/test/suites/valid-strip/short-string/input
new file mode 100644 (file)
index 0000000..eac5f7b
--- /dev/null
@@ -0,0 +1 @@
+["a"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/short-string/output b/test/suites/valid-strip/short-string/output
new file mode 100644 (file)
index 0000000..eac5f7b
--- /dev/null
@@ -0,0 +1 @@
+["a"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-ascii-string/input b/test/suites/valid-strip/simple-ascii-string/input
new file mode 100644 (file)
index 0000000..90358ab
--- /dev/null
@@ -0,0 +1 @@
+["abcdefghijklmnopqrstuvwxyz1234567890 "]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-ascii-string/output b/test/suites/valid-strip/simple-ascii-string/output
new file mode 100644 (file)
index 0000000..90358ab
--- /dev/null
@@ -0,0 +1 @@
+["abcdefghijklmnopqrstuvwxyz1234567890 "]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-int-0/input b/test/suites/valid-strip/simple-int-0/input
new file mode 100644 (file)
index 0000000..6e7ea63
--- /dev/null
@@ -0,0 +1 @@
+[0]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-int-0/output b/test/suites/valid-strip/simple-int-0/output
new file mode 100644 (file)
index 0000000..6e7ea63
--- /dev/null
@@ -0,0 +1 @@
+[0]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-int-1/input b/test/suites/valid-strip/simple-int-1/input
new file mode 100644 (file)
index 0000000..bace2a0
--- /dev/null
@@ -0,0 +1 @@
+[1]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-int-1/output b/test/suites/valid-strip/simple-int-1/output
new file mode 100644 (file)
index 0000000..bace2a0
--- /dev/null
@@ -0,0 +1 @@
+[1]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-int-123/input b/test/suites/valid-strip/simple-int-123/input
new file mode 100644 (file)
index 0000000..e47f69a
--- /dev/null
@@ -0,0 +1 @@
+[123]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-int-123/output b/test/suites/valid-strip/simple-int-123/output
new file mode 100644 (file)
index 0000000..e47f69a
--- /dev/null
@@ -0,0 +1 @@
+[123]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-object/input b/test/suites/valid-strip/simple-object/input
new file mode 100644 (file)
index 0000000..a34fb49
--- /dev/null
@@ -0,0 +1 @@
+{"a":[]}
diff --git a/test/suites/valid-strip/simple-object/output b/test/suites/valid-strip/simple-object/output
new file mode 100644 (file)
index 0000000..982abe8
--- /dev/null
@@ -0,0 +1 @@
+{"a": []}
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-real/input b/test/suites/valid-strip/simple-real/input
new file mode 100644 (file)
index 0000000..b02878e
--- /dev/null
@@ -0,0 +1 @@
+[123.456789]
\ No newline at end of file
diff --git a/test/suites/valid-strip/simple-real/output b/test/suites/valid-strip/simple-real/output
new file mode 100644 (file)
index 0000000..5aef35f
--- /dev/null
@@ -0,0 +1 @@
+[123.45678900000000056]
\ No newline at end of file
diff --git a/test/suites/valid-strip/string-escapes/input b/test/suites/valid-strip/string-escapes/input
new file mode 100644 (file)
index 0000000..7f49553
--- /dev/null
@@ -0,0 +1 @@
+["\"\\\/\b\f\n\r\t"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/string-escapes/output b/test/suites/valid-strip/string-escapes/output
new file mode 100644 (file)
index 0000000..ca5c1c6
--- /dev/null
@@ -0,0 +1 @@
+["\"\\/\b\f\n\r\t"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/three-byte-utf-8/input b/test/suites/valid-strip/three-byte-utf-8/input
new file mode 100644 (file)
index 0000000..25dcede
--- /dev/null
@@ -0,0 +1 @@
+["\u0821 three-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/three-byte-utf-8/output b/test/suites/valid-strip/three-byte-utf-8/output
new file mode 100644 (file)
index 0000000..c44d124
--- /dev/null
@@ -0,0 +1 @@
+["ࠡ three-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/true/input b/test/suites/valid-strip/true/input
new file mode 100644 (file)
index 0000000..de601e3
--- /dev/null
@@ -0,0 +1 @@
+[true]
\ No newline at end of file
diff --git a/test/suites/valid-strip/true/output b/test/suites/valid-strip/true/output
new file mode 100644 (file)
index 0000000..de601e3
--- /dev/null
@@ -0,0 +1 @@
+[true]
\ No newline at end of file
diff --git a/test/suites/valid-strip/two-byte-utf-8/input b/test/suites/valid-strip/two-byte-utf-8/input
new file mode 100644 (file)
index 0000000..627046a
--- /dev/null
@@ -0,0 +1 @@
+["\u0123 two-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/two-byte-utf-8/output b/test/suites/valid-strip/two-byte-utf-8/output
new file mode 100644 (file)
index 0000000..1f0988d
--- /dev/null
@@ -0,0 +1 @@
+["ģ two-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/utf-8-string/input b/test/suites/valid-strip/utf-8-string/input
new file mode 100644 (file)
index 0000000..5372865
--- /dev/null
@@ -0,0 +1 @@
+["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/utf-8-string/output b/test/suites/valid-strip/utf-8-string/output
new file mode 100644 (file)
index 0000000..5372865
--- /dev/null
@@ -0,0 +1 @@
+["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/utf-surrogate-four-byte-encoding/input b/test/suites/valid-strip/utf-surrogate-four-byte-encoding/input
new file mode 100644 (file)
index 0000000..183855a
--- /dev/null
@@ -0,0 +1 @@
+["\uD834\uDD1E surrogate, four-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid-strip/utf-surrogate-four-byte-encoding/output b/test/suites/valid-strip/utf-surrogate-four-byte-encoding/output
new file mode 100644 (file)
index 0000000..fa806d2
--- /dev/null
@@ -0,0 +1 @@
+["𝄞 surrogate, four-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid/complex-array/input b/test/suites/valid/complex-array/input
new file mode 100644 (file)
index 0000000..1b9bbb9
--- /dev/null
@@ -0,0 +1,5 @@
+[1,2,3,4,
+"a", "b", "c",
+{"foo": "bar", "core": "dump"},
+true, false, true, true, null, false
+]
diff --git a/test/suites/valid/complex-array/output b/test/suites/valid/complex-array/output
new file mode 100644 (file)
index 0000000..44ac463
--- /dev/null
@@ -0,0 +1 @@
+[1, 2, 3, 4, "a", "b", "c", {"foo": "bar", "core": "dump"}, true, false, true, true, null, false]
\ No newline at end of file
diff --git a/test/suites/valid/empty-array/input b/test/suites/valid/empty-array/input
new file mode 100644 (file)
index 0000000..fe51488
--- /dev/null
@@ -0,0 +1 @@
+[]
diff --git a/test/suites/valid/empty-array/output b/test/suites/valid/empty-array/output
new file mode 100644 (file)
index 0000000..0637a08
--- /dev/null
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/test/suites/valid/empty-object-in-array/input b/test/suites/valid/empty-object-in-array/input
new file mode 100644 (file)
index 0000000..93d5140
--- /dev/null
@@ -0,0 +1 @@
+[{}]
diff --git a/test/suites/valid/empty-object-in-array/output b/test/suites/valid/empty-object-in-array/output
new file mode 100644 (file)
index 0000000..ee1aac4
--- /dev/null
@@ -0,0 +1 @@
+[{}]
\ No newline at end of file
diff --git a/test/suites/valid/empty-object/input b/test/suites/valid/empty-object/input
new file mode 100644 (file)
index 0000000..0967ef4
--- /dev/null
@@ -0,0 +1 @@
+{}
diff --git a/test/suites/valid/empty-object/output b/test/suites/valid/empty-object/output
new file mode 100644 (file)
index 0000000..9e26dfe
--- /dev/null
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/test/suites/valid/empty-string/input b/test/suites/valid/empty-string/input
new file mode 100644 (file)
index 0000000..66a1e18
--- /dev/null
@@ -0,0 +1 @@
+[""]
diff --git a/test/suites/valid/empty-string/output b/test/suites/valid/empty-string/output
new file mode 100644 (file)
index 0000000..93b6be2
--- /dev/null
@@ -0,0 +1 @@
+[""]
\ No newline at end of file
diff --git a/test/suites/valid/escaped-utf-control-char/input b/test/suites/valid/escaped-utf-control-char/input
new file mode 100644 (file)
index 0000000..9a98545
--- /dev/null
@@ -0,0 +1 @@
+["\u0012 escaped control character"]
diff --git a/test/suites/valid/escaped-utf-control-char/output b/test/suites/valid/escaped-utf-control-char/output
new file mode 100644 (file)
index 0000000..07221b7
--- /dev/null
@@ -0,0 +1 @@
+["\u0012 escaped control character"]
\ No newline at end of file
diff --git a/test/suites/valid/false/input b/test/suites/valid/false/input
new file mode 100644 (file)
index 0000000..4343652
--- /dev/null
@@ -0,0 +1 @@
+[false]
diff --git a/test/suites/valid/false/output b/test/suites/valid/false/output
new file mode 100644 (file)
index 0000000..67b2f07
--- /dev/null
@@ -0,0 +1 @@
+[false]
\ No newline at end of file
diff --git a/test/suites/valid/negative-int/input b/test/suites/valid/negative-int/input
new file mode 100644 (file)
index 0000000..a96d5cd
--- /dev/null
@@ -0,0 +1 @@
+[-123]
diff --git a/test/suites/valid/negative-int/output b/test/suites/valid/negative-int/output
new file mode 100644 (file)
index 0000000..8e30f8b
--- /dev/null
@@ -0,0 +1 @@
+[-123]
\ No newline at end of file
diff --git a/test/suites/valid/negative-one/input b/test/suites/valid/negative-one/input
new file mode 100644 (file)
index 0000000..2363a1a
--- /dev/null
@@ -0,0 +1 @@
+[-1]
diff --git a/test/suites/valid/negative-one/output b/test/suites/valid/negative-one/output
new file mode 100644 (file)
index 0000000..99d21a2
--- /dev/null
@@ -0,0 +1 @@
+[-1]
\ No newline at end of file
diff --git a/test/suites/valid/negative-zero/input b/test/suites/valid/negative-zero/input
new file mode 100644 (file)
index 0000000..40fc49c
--- /dev/null
@@ -0,0 +1 @@
+[-0]
diff --git a/test/suites/valid/negative-zero/output b/test/suites/valid/negative-zero/output
new file mode 100644 (file)
index 0000000..6e7ea63
--- /dev/null
@@ -0,0 +1 @@
+[0]
\ No newline at end of file
diff --git a/test/suites/valid/null/input b/test/suites/valid/null/input
new file mode 100644 (file)
index 0000000..62864b3
--- /dev/null
@@ -0,0 +1 @@
+[null]
diff --git a/test/suites/valid/null/output b/test/suites/valid/null/output
new file mode 100644 (file)
index 0000000..500db4a
--- /dev/null
@@ -0,0 +1 @@
+[null]
\ No newline at end of file
diff --git a/test/suites/valid/one-byte-utf-8/input b/test/suites/valid/one-byte-utf-8/input
new file mode 100644 (file)
index 0000000..8bda468
--- /dev/null
@@ -0,0 +1 @@
+["\u002c one-byte UTF-8"]
diff --git a/test/suites/valid/one-byte-utf-8/output b/test/suites/valid/one-byte-utf-8/output
new file mode 100644 (file)
index 0000000..c33d250
--- /dev/null
@@ -0,0 +1 @@
+[", one-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid/real-capital-e-negative-exponent/input b/test/suites/valid/real-capital-e-negative-exponent/input
new file mode 100644 (file)
index 0000000..1e9fa51
--- /dev/null
@@ -0,0 +1 @@
+[1E-2]
diff --git a/test/suites/valid/real-capital-e-negative-exponent/output b/test/suites/valid/real-capital-e-negative-exponent/output
new file mode 100644 (file)
index 0000000..9c9a06a
--- /dev/null
@@ -0,0 +1 @@
+[0.01000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid/real-capital-e-positive-exponent/input b/test/suites/valid/real-capital-e-positive-exponent/input
new file mode 100644 (file)
index 0000000..6a6ab93
--- /dev/null
@@ -0,0 +1 @@
+[1E+2]
diff --git a/test/suites/valid/real-capital-e-positive-exponent/output b/test/suites/valid/real-capital-e-positive-exponent/output
new file mode 100644 (file)
index 0000000..0cc2e4d
--- /dev/null
@@ -0,0 +1 @@
+[100.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid/real-capital-e/input b/test/suites/valid/real-capital-e/input
new file mode 100644 (file)
index 0000000..e703223
--- /dev/null
@@ -0,0 +1 @@
+[1E22]
diff --git a/test/suites/valid/real-capital-e/output b/test/suites/valid/real-capital-e/output
new file mode 100644 (file)
index 0000000..5750cf5
--- /dev/null
@@ -0,0 +1 @@
+[10000000000000000000000.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid/real-exponent/input b/test/suites/valid/real-exponent/input
new file mode 100644 (file)
index 0000000..b2a69b9
--- /dev/null
@@ -0,0 +1 @@
+[123e45]
diff --git a/test/suites/valid/real-exponent/output b/test/suites/valid/real-exponent/output
new file mode 100644 (file)
index 0000000..f78e2cd
--- /dev/null
@@ -0,0 +1 @@
+[122999999999999994846185700645503654167417192448.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid/real-fraction-exponent/input b/test/suites/valid/real-fraction-exponent/input
new file mode 100644 (file)
index 0000000..0c1660d
--- /dev/null
@@ -0,0 +1 @@
+[123.456e78]
diff --git a/test/suites/valid/real-fraction-exponent/output b/test/suites/valid/real-fraction-exponent/output
new file mode 100644 (file)
index 0000000..c0ca46e
--- /dev/null
@@ -0,0 +1 @@
+[123456000000000003773544074641513176432063851726237026847343602712484748520849408.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid/real-negative-exponent/input b/test/suites/valid/real-negative-exponent/input
new file mode 100644 (file)
index 0000000..daa4af9
--- /dev/null
@@ -0,0 +1 @@
+[1e-2]
diff --git a/test/suites/valid/real-negative-exponent/output b/test/suites/valid/real-negative-exponent/output
new file mode 100644 (file)
index 0000000..9c9a06a
--- /dev/null
@@ -0,0 +1 @@
+[0.01000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid/real-positive-exponent/input b/test/suites/valid/real-positive-exponent/input
new file mode 100644 (file)
index 0000000..f378077
--- /dev/null
@@ -0,0 +1 @@
+[1e+2]
diff --git a/test/suites/valid/real-positive-exponent/output b/test/suites/valid/real-positive-exponent/output
new file mode 100644 (file)
index 0000000..0cc2e4d
--- /dev/null
@@ -0,0 +1 @@
+[100.00000000000000000]
\ No newline at end of file
diff --git a/test/suites/valid/run b/test/suites/valid/run
new file mode 100755 (executable)
index 0000000..6d2bc2f
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+is_test() {
+    test -d $test_path
+}
+
+run_test() {
+    $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr
+    valgrind_check $test_log/stderr || return 1
+    cmp -s $test_path/output $test_log/stdout
+}
+
+show_error() {
+    valgrind_show_error && return
+
+    echo "EXPECTED OUTPUT:"
+    nl -bn $test_path/output
+    echo "ACTUAL OUTPUT:"
+    nl -bn $test_log/stdout
+}
+
+. $top_srcdir/test/scripts/run-tests.sh
diff --git a/test/suites/valid/short-string/input b/test/suites/valid/short-string/input
new file mode 100644 (file)
index 0000000..0c3426d
--- /dev/null
@@ -0,0 +1 @@
+["a"]
diff --git a/test/suites/valid/short-string/output b/test/suites/valid/short-string/output
new file mode 100644 (file)
index 0000000..eac5f7b
--- /dev/null
@@ -0,0 +1 @@
+["a"]
\ No newline at end of file
diff --git a/test/suites/valid/simple-ascii-string/input b/test/suites/valid/simple-ascii-string/input
new file mode 100644 (file)
index 0000000..929b215
--- /dev/null
@@ -0,0 +1 @@
+["abcdefghijklmnopqrstuvwxyz1234567890 "]
diff --git a/test/suites/valid/simple-ascii-string/output b/test/suites/valid/simple-ascii-string/output
new file mode 100644 (file)
index 0000000..90358ab
--- /dev/null
@@ -0,0 +1 @@
+["abcdefghijklmnopqrstuvwxyz1234567890 "]
\ No newline at end of file
diff --git a/test/suites/valid/simple-int-0/input b/test/suites/valid/simple-int-0/input
new file mode 100644 (file)
index 0000000..111bb86
--- /dev/null
@@ -0,0 +1 @@
+[0]
diff --git a/test/suites/valid/simple-int-0/output b/test/suites/valid/simple-int-0/output
new file mode 100644 (file)
index 0000000..6e7ea63
--- /dev/null
@@ -0,0 +1 @@
+[0]
\ No newline at end of file
diff --git a/test/suites/valid/simple-int-1/input b/test/suites/valid/simple-int-1/input
new file mode 100644 (file)
index 0000000..7660873
--- /dev/null
@@ -0,0 +1 @@
+[1]
diff --git a/test/suites/valid/simple-int-1/output b/test/suites/valid/simple-int-1/output
new file mode 100644 (file)
index 0000000..bace2a0
--- /dev/null
@@ -0,0 +1 @@
+[1]
\ No newline at end of file
diff --git a/test/suites/valid/simple-int-123/input b/test/suites/valid/simple-int-123/input
new file mode 100644 (file)
index 0000000..3214bfe
--- /dev/null
@@ -0,0 +1 @@
+[123]
diff --git a/test/suites/valid/simple-int-123/output b/test/suites/valid/simple-int-123/output
new file mode 100644 (file)
index 0000000..e47f69a
--- /dev/null
@@ -0,0 +1 @@
+[123]
\ No newline at end of file
diff --git a/test/suites/valid/simple-object/input b/test/suites/valid/simple-object/input
new file mode 100644 (file)
index 0000000..a34fb49
--- /dev/null
@@ -0,0 +1 @@
+{"a":[]}
diff --git a/test/suites/valid/simple-object/output b/test/suites/valid/simple-object/output
new file mode 100644 (file)
index 0000000..982abe8
--- /dev/null
@@ -0,0 +1 @@
+{"a": []}
\ No newline at end of file
diff --git a/test/suites/valid/simple-real/input b/test/suites/valid/simple-real/input
new file mode 100644 (file)
index 0000000..0fed7df
--- /dev/null
@@ -0,0 +1 @@
+[123.456789]
diff --git a/test/suites/valid/simple-real/output b/test/suites/valid/simple-real/output
new file mode 100644 (file)
index 0000000..5aef35f
--- /dev/null
@@ -0,0 +1 @@
+[123.45678900000000056]
\ No newline at end of file
diff --git a/test/suites/valid/string-escapes/input b/test/suites/valid/string-escapes/input
new file mode 100644 (file)
index 0000000..d994564
--- /dev/null
@@ -0,0 +1 @@
+["\"\\\/\b\f\n\r\t"]
diff --git a/test/suites/valid/string-escapes/output b/test/suites/valid/string-escapes/output
new file mode 100644 (file)
index 0000000..ca5c1c6
--- /dev/null
@@ -0,0 +1 @@
+["\"\\/\b\f\n\r\t"]
\ No newline at end of file
diff --git a/test/suites/valid/three-byte-utf-8/input b/test/suites/valid/three-byte-utf-8/input
new file mode 100644 (file)
index 0000000..ccc0bfa
--- /dev/null
@@ -0,0 +1 @@
+["\u0821 three-byte UTF-8"]
diff --git a/test/suites/valid/three-byte-utf-8/output b/test/suites/valid/three-byte-utf-8/output
new file mode 100644 (file)
index 0000000..c44d124
--- /dev/null
@@ -0,0 +1 @@
+["ࠡ three-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid/true/input b/test/suites/valid/true/input
new file mode 100644 (file)
index 0000000..29513c4
--- /dev/null
@@ -0,0 +1 @@
+[true]
diff --git a/test/suites/valid/true/output b/test/suites/valid/true/output
new file mode 100644 (file)
index 0000000..de601e3
--- /dev/null
@@ -0,0 +1 @@
+[true]
\ No newline at end of file
diff --git a/test/suites/valid/two-byte-utf-8/input b/test/suites/valid/two-byte-utf-8/input
new file mode 100644 (file)
index 0000000..05ae854
--- /dev/null
@@ -0,0 +1 @@
+["\u0123 two-byte UTF-8"]
diff --git a/test/suites/valid/two-byte-utf-8/output b/test/suites/valid/two-byte-utf-8/output
new file mode 100644 (file)
index 0000000..1f0988d
--- /dev/null
@@ -0,0 +1 @@
+["ģ two-byte UTF-8"]
\ No newline at end of file
diff --git a/test/suites/valid/utf-8-string/input b/test/suites/valid/utf-8-string/input
new file mode 100644 (file)
index 0000000..20dc64a
--- /dev/null
@@ -0,0 +1 @@
+["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
diff --git a/test/suites/valid/utf-8-string/output b/test/suites/valid/utf-8-string/output
new file mode 100644 (file)
index 0000000..5372865
--- /dev/null
@@ -0,0 +1 @@
+["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
\ No newline at end of file
diff --git a/test/suites/valid/utf-surrogate-four-byte-encoding/input b/test/suites/valid/utf-surrogate-four-byte-encoding/input
new file mode 100644 (file)
index 0000000..c598b41
--- /dev/null
@@ -0,0 +1 @@
+["\uD834\uDD1E surrogate, four-byte UTF-8"]
diff --git a/test/suites/valid/utf-surrogate-four-byte-encoding/output b/test/suites/valid/utf-surrogate-four-byte-encoding/output
new file mode 100644 (file)
index 0000000..fa806d2
--- /dev/null
@@ -0,0 +1 @@
+["𝄞 surrogate, four-byte UTF-8"]
\ No newline at end of file
diff --git a/test/test-api b/test/test-api
deleted file mode 100755 (executable)
index 04018c1..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q"
-LOGDIR="testlogs/api"
-N=`find testprogs -type f -executable | wc -l`
-
-echo "testprogs: $N tests"
-
-rm -rf $LOGDIR
-mkdir -p $LOGDIR
-
-if [ -n "$VALGRIND" ]; then
-    runner="$VALGRIND_CMDLINE "
-fi
-
-i=1
-failed=
-for prog in testprogs/*; do
-    [ -x $prog ] || continue
-    t=`basename $prog`
-    logbase="testlogs/api/`printf '%02d-%s' $i $t`"
-    if ! $runner./$prog >$logbase.stdout 2>$logbase.stderr; then
-        echo >&2
-        echo "### $prog failed:" >&2
-        cat $logbase.stderr
-        exit 1
-    fi
-    if [ -n "$VALGRIND" ]; then
-        # Check for Valgrind error output. The valgrind option
-        # --error-exitcode is not enough because Valgrind doesn't
-        # think unfreed allocs are errors.
-        if grep -E -q '^==[0-9]+== ' $logbase.stderr; then
-            echo "### $prog failed:" >&2
-            echo "valgrind detected an error" >&2
-            echo "for details, see test/$logbase.stderr" >&2
-            exit 1
-        fi
-    fi
-    echo -n '.'
-done
-echo
diff --git a/test/test-invalid b/test/test-invalid
deleted file mode 100755 (executable)
index b83c2e7..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-TESTFILES="${srcdir}/testdata/invalid ${srcdir}/testdata/invalid-strip ${srcdir}/testdata/invalid-unicode"
-
-run_test() {
-    local prog=$1
-    local prefix=$2
-
-    run_testprog $prog $prefix
-    if ! cmp $prefix.out $prefix.$prog.stderr >/dev/null; then
-        echo >&2
-        echo "### $prefix ($prog) failed:" >&2
-        cat $prefix.in >&2
-        echo "### expected output:" >&2
-        cat $prefix.out >&2
-        echo "### actual output:" >&2
-        cat $prefix.$prog.stderr >&2
-        exit 1
-    fi
-}
-
-. ${srcdir}/run-test
diff --git a/test/test-valid b/test/test-valid
deleted file mode 100755 (executable)
index 46d4edf..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
-#
-# Jansson is free software; you can redistribute it and/or modify
-# it under the terms of the MIT license. See LICENSE for details.
-
-TESTFILES="${srcdir}/testdata/valid ${srcdir}/testdata/valid-strip"
-
-run_test() {
-    local prog=$1
-    local prefix=$2
-
-    run_testprog $prog $prefix
-
-    if ! ${srcdir}/json-compare.py $prefix.in $prefix.$prog.stdout \
-        >$prefix.$prog.cmp-stdout
-    then
-        echo >&2
-        echo "### $prefix ($prog) failed:" >&2
-        cat $prefix.in >&2
-        if [ -f $prefix.$prog.stdout ]; then
-            echo "### output:" >&2
-            cat $prefix.$prog.stdout >&2
-        fi
-        if [ -s $prefix.$prog.stdout ]; then
-            echo "### compare output:" >&2
-            cat $prefix.$prog.cmp-stdout >&2
-        fi
-        exit 1
-    fi
-}
-
-. ${srcdir}/run-test
diff --git a/test/testdata/invalid b/test/testdata/invalid
deleted file mode 100644 (file)
index 7fede67..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-==== empty ====
-====
-1
-'[' or '{' expected near end of file
-==== null ====
-null
-====
-1
-'[' or '{' expected near 'null'
-==== lone-open-brace ====
-{
-====
-2
-string or '}' expected near end of file
-==== lone-open-bracket ====
-[
-====
-2
-']' expected near end of file
-==== bracket-comma ====
-[,
-====
-1
-unexpected token near ','
-==== bracket-one-comma ====
-[1,
-====
-2
-']' expected near end of file
-==== unterminated-string ====
-["a
-====
-1
-unexpected newline near '"a'
-==== unterminated-array ====
-["a"
-====
-2
-']' expected near end of file
-==== apostrophe ====
-['
-====
-1
-invalid token near '''
-==== brace-comma ====
-{,
-====
-1
-string or '}' expected near ','
-==== unterminated-empty-key ====
-{"
-====
-1
-unexpected newline near '"'
-==== unterminated-key ====
-{"a
-====
-1
-unexpected newline near '"a'
-==== object-no-colon ====
-{"a"
-====
-2
-':' expected near end of file
-==== object-apostrophes ====
-{'a'
-====
-1
-string or '}' expected near '''
-==== object-no-value ====
-{"a":
-====
-2
-unexpected token near end of file
-==== object-unterminated-value ====
-{"a":"a
-====
-1
-unexpected newline near '"a'
-==== object-garbage-at-end ====
-{"a":"a" 123}
-====
-1
-'}' expected near '123'
-==== unterminated-object-and-array ====
-{[
-====
-1
-string or '}' expected near '['
-==== unterminated-array-and-object ====
-[{
-====
-2
-string or '}' expected near end of file
-==== object-in-unterminated-array ====
-[{}
-====
-2
-']' expected near end of file
-==== extra-comma-in-array ====
-[1,]
-====
-1
-unexpected token near ']'
-==== extra-command-in-multiline-array ====
-[1,
-2,
-3,
-4,
-5,
-]
-====
-6
-unexpected token near ']'
-==== real-truncated-at-point ====
-[1.]
-====
-1
-invalid token near '1.'
-==== real-truncated-at-e ====
-[1e]
-====
-1
-invalid token near '1e'
-==== real-garbage-after-e ====
-[1ea]
-====
-1
-invalid token near '1e'
-==== real-positive-overflow ====
-[123123e100000]
-====
-1
-real number overflow near '123123e100000'
-==== real-negative-overflow ====
-[-123123e100000]
-====
-1
-real number overflow near '-123123e100000'
-==== real-underflow ====
-[123e-10000000]
-====
-1
-real number underflow near '123e-10000000'
-==== integer-starting-with-zero ====
-[012]
-====
-1
-invalid token near '0'
-==== negative-integer-starting-with-zero ====
-[-012]
-====
-1
-invalid token near '-0'
-==== too-big-positive-integer ====
-[123123123123123]
-====
-1
-too big integer near '123123123123123'
-==== too-big-negative-integer ====
-[-123123123123123]
-====
-1
-too big negative integer near '-123123123123123'
-==== invalid-identifier ====
-[troo
-====
-1
-invalid token near 'troo'
-==== minus-sign-without-number ====
-[-foo]
-====
-1
-invalid token near '-'
-==== invalid-negative-integerr ====
-[-123foo]
-====
-1
-']' expected near 'foo'
-==== invalid-negative-real ====
-[-123.123foo]
-====
-1
-']' expected near 'foo'
-==== invalid-escape ====
-["\a <-- invalid escape"]
-====
-1
-invalid escape near '"\'
-==== tab-character-in-string ====
-["      <-- tab character"]
-====
-1
-control character 0x9 near '"'
-==== null-byte-in-string ====
-["\u0000 (null byte not allowed)"]
-====
-1
-\u0000 is not allowed
-==== truncated-unicode-surrogate ====
-["\uDADA (first surrogate without the second)"]
-====
-1
-invalid Unicode '\uDADA'
-==== invalid-second-surrogate ====
-["\uD888\u3210 (first surrogate and invalid second surrogate)"]
-====
-1
-invalid Unicode '\uD888\u3210'
-==== lone-second-surrogate ====
-["\uDFAA (second surrogate on it's own)"]
-====
-1
-invalid Unicode '\uDFAA'
-==== unicode-identifier ====
-====
-1
-'[' or '{' expected near 'å'
-==== ascii-unicode-identifier ====
-aå
-====
-1
-'[' or '{' expected near 'a'
-==== garbage-at-the-end ====
-[1,2,3]foo
-====
-1
-end of file expected near 'foo'
-==== garbage-after-newline ====
-[1,2,3]
-foo
-====
-2
-end of file expected near 'foo'
diff --git a/test/testdata/invalid-strip b/test/testdata/invalid-strip
deleted file mode 100644 (file)
index 1efdc25..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-==== empty ====
-====
-1
-'[' or '{' expected near end of file
-==== null ====
-null
-====
-1
-'[' or '{' expected near 'null'
-==== lone-open-brace ====
-{
-====
-1
-string or '}' expected near end of file
-==== lone-open-bracket ====
-[
-====
-1
-']' expected near end of file
-==== bracket-comma ====
-[,
-====
-1
-unexpected token near ','
-==== bracket-one-comma ====
-[1,
-====
-1
-']' expected near end of file
-==== unterminated-string ====
-["a
-====
-1
-premature end of input near '"a'
-==== unterminated-array ====
-["a"
-====
-1
-']' expected near end of file
-==== apostrophe ====
-['
-====
-1
-invalid token near '''
-==== brace-comma ====
-{,
-====
-1
-string or '}' expected near ','
-==== unterminated-empty-key ====
-{"
-====
-1
-premature end of input near '"'
-==== unterminated-key ====
-{"a
-====
-1
-premature end of input near '"a'
-==== object-no-colon ====
-{"a"
-====
-1
-':' expected near end of file
-==== object-apostrophes ====
-{'a'
-====
-1
-string or '}' expected near '''
-==== object-no-value ====
-{"a":
-====
-1
-unexpected token near end of file
-==== object-unterminated-value ====
-{"a":"a
-====
-1
-premature end of input near '"a'
-==== object-garbage-at-end ====
-{"a":"a" 123}
-====
-1
-'}' expected near '123'
-==== unterminated-object-and-array ====
-{[
-====
-1
-string or '}' expected near '['
-==== unterminated-array-and-object ====
-[{
-====
-1
-string or '}' expected near end of file
-==== object-in-unterminated-array ====
-[{}
-====
-1
-']' expected near end of file
-==== extra-comma-in-array ====
-[1,]
-====
-1
-unexpected token near ']'
-==== extra-command-in-multiline-array ====
-[1,
-2,
-3,
-4,
-5,
-]
-====
-6
-unexpected token near ']'
-==== real-truncated-at-point ====
-[1.]
-====
-1
-invalid token near '1.'
-==== real-truncated-at-e ====
-[1e]
-====
-1
-invalid token near '1e'
-==== real-garbage-after-e ====
-[1ea]
-====
-1
-invalid token near '1e'
-==== real-positive-overflow ====
-[123123e100000]
-====
-1
-real number overflow near '123123e100000'
-==== real-negative-overflow ====
-[-123123e100000]
-====
-1
-real number overflow near '-123123e100000'
-==== real-underflow ====
-[123e-10000000]
-====
-1
-real number underflow near '123e-10000000'
-==== integer-starting-with-zero ====
-[012]
-====
-1
-invalid token near '0'
-==== negative-integer-starting-with-zero ====
-[-012]
-====
-1
-invalid token near '-0'
-==== too-big-positive-integer ====
-[123123123123123]
-====
-1
-too big integer near '123123123123123'
-==== too-big-negative-integer ====
-[-123123123123123]
-====
-1
-too big negative integer near '-123123123123123'
-==== invalid-identifier ====
-[troo
-====
-1
-invalid token near 'troo'
-==== minus-sign-without-number ====
-[-foo]
-====
-1
-invalid token near '-'
-==== invalid-negative-integerr ====
-[-123foo]
-====
-1
-']' expected near 'foo'
-==== invalid-negative-real ====
-[-123.123foo]
-====
-1
-']' expected near 'foo'
-==== invalid-escape ====
-["\a <-- invalid escape"]
-====
-1
-invalid escape near '"\'
-==== tab-character-in-string ====
-["      <-- tab character"]
-====
-1
-control character 0x9 near '"'
-==== null-byte-in-string ====
-["\u0000 (null byte not allowed)"]
-====
-1
-\u0000 is not allowed
-==== truncated-unicode-surrogate ====
-["\uDADA (first surrogate without the second)"]
-====
-1
-invalid Unicode '\uDADA'
-==== invalid-second-surrogate ====
-["\uD888\u3210 (first surrogate and invalid second surrogate)"]
-====
-1
-invalid Unicode '\uD888\u3210'
-==== lone-second-surrogate ====
-["\uDFAA (second surrogate on it's own)"]
-====
-1
-invalid Unicode '\uDFAA'
-==== unicode-identifier ====
-====
-1
-'[' or '{' expected near 'å'
-==== ascii-unicode-identifier ====
-aå
-====
-1
-'[' or '{' expected near 'a'
-==== garbage-at-the-end ====
-[1,2,3]foo
-====
-1
-end of file expected near 'foo'
-==== garbage-after-newline ====
-[1,2,3]
-foo
-====
-2
-end of file expected near 'foo'
diff --git a/test/testdata/invalid-unicode b/test/testdata/invalid-unicode
deleted file mode 100644 (file)
index 84db51f..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-==== lone-invalid-utf-8 ====
-====
--1
-unable to decode byte 0xe5 at position 0
-==== invalid-utf-8-in-string ====
-["å <-- invalid UTF-8"]
-====
--1
-unable to decode byte 0xe5 at position 2
-==== invalid-utf-8-in-array ====
-[å]
-====
--1
-unable to decode byte 0xe5 at position 1
-==== invalid-utf-8-in-identifier ====
-[aå]
-====
--1
-unable to decode byte 0xe5 at position 2
-==== invalid-utf-8-in-escape ====
-["\uå"]
-====
--1
-unable to decode byte 0xe5 at position 4
-==== invalid-utf-8-after-backslash ====
-["\å"]
-====
--1
-unable to decode byte 0xe5 at position 3
-==== invalid-utf-8-in-int ====
-[0å]
-====
--1
-unable to decode byte 0xe5 at position 2
-==== invalid-utf-8-in-bigger-int ====
-[123å]
-====
--1
-unable to decode byte 0xe5 at position 4
-==== invalid-utf-8-in-real-after-e ====
-[1eå]
-====
--1
-unable to decode byte 0xe5 at position 3
-==== invalid-utf-8-in-exponent ====
-[1e1å]
-====
--1
-unable to decode byte 0xe5 at position 4
-==== lone-utf-8-continuation-byte ====
-["\81"]
-====
--1
-unable to decode byte 0x81 at position 2
-==== overlong-ascii-encoding ====
-["Á"]
-====
--1
-unable to decode byte 0xc1 at position 2
-==== restricted-utf-8 ====
-["ý"]
-====
--1
-unable to decode byte 0xfd at position 2
-==== not-in-unicode-range ====
-[""]
-====
--1
-unable to decode byte 0xf4 at position 2
-==== overlong-3-byte-encoding ====
-["à\80¢ <-- overlong encoding"]
-====
--1
-unable to decode byte 0xe0 at position 2
-==== overlong-4-byte-encoding ====
-["ð\80\80¢ <-- overlong encoding"]
-====
--1
-unable to decode byte 0xf0 at position 2
-==== truncated-utf-8 ====
-["àÿ <-- truncated UTF-8"]
-====
--1
-unable to decode byte 0xe0 at position 2
-==== encoded-surrogate-half ====
-[" <-- encoded surrogate half"]
-====
--1
-unable to decode byte 0xed at position 2
diff --git a/test/testdata/valid b/test/testdata/valid
deleted file mode 100644 (file)
index 50cfc63..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-==== empty-string ====
-[""]
-==== short-string ====
-["a"]
-==== simple-ascii-string ====
-["abcdefghijklmnopqrstuvwxyz1234567890 "]
-==== utf-8-string ====
-["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
-==== string-escapes ====
-["\"\\\/\b\f\n\r\t"]
-==== one-byte-utf-8 ====
-["\u002c one-byte UTF-8"]
-==== two-byte-utf-8 ====
-["\u0123 two-byte UTF-8"]
-==== three-byte-utf-8 ====
-["\u0821 three-byte UTF-8"]
-==== utf-surrogate-four-byte-encoding ====
-["\uD834\uDD1E surrogate, four-byte UTF-8"]
-==== escaped-utf-control-char ====
-["\u0012 escaped control character"]
-==== simple-int-0 ====
-[0]
-==== simple-int-1 ====
-[1]
-==== simple-int-123 ====
-[123]
-==== negative-zero ====
-[-0]
-==== negative-one ====
-[-1]
-==== negative-int ====
-[-123]
-==== simple-real ====
-[123.456789]
-==== real-exponent ====
-[123e45]
-==== real-capital-e ====
-[1E22]
-==== real-positive-exponent ====
-[1e+2]
-==== real-negative-exponent ====
-[1e-2]
-==== real-capital-e-positive-exponent ====
-[1E+2]
-==== real-capital-e-negative-exponent ====
-[1E-2]
-==== real-fraction-exponent ====
-[123.456e78]
-==== true ====
-[true]
-==== false ====
-[false]
-==== null ====
-[null]
-==== empty-array ====
-[]
-==== empty-object-in-array ====
-[{}]
-==== complex-array ====
-[1,2,3,4,
-"a", "b", "c",
-{"foo": "bar", "core": "dump"},
-true, false, true, true, null, false
-]
-==== empty-object ====
-{}
-==== simple-object ====
-{"a":[]}
diff --git a/test/testdata/valid-strip b/test/testdata/valid-strip
deleted file mode 100644 (file)
index 50cfc63..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-==== empty-string ====
-[""]
-==== short-string ====
-["a"]
-==== simple-ascii-string ====
-["abcdefghijklmnopqrstuvwxyz1234567890 "]
-==== utf-8-string ====
-["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"]
-==== string-escapes ====
-["\"\\\/\b\f\n\r\t"]
-==== one-byte-utf-8 ====
-["\u002c one-byte UTF-8"]
-==== two-byte-utf-8 ====
-["\u0123 two-byte UTF-8"]
-==== three-byte-utf-8 ====
-["\u0821 three-byte UTF-8"]
-==== utf-surrogate-four-byte-encoding ====
-["\uD834\uDD1E surrogate, four-byte UTF-8"]
-==== escaped-utf-control-char ====
-["\u0012 escaped control character"]
-==== simple-int-0 ====
-[0]
-==== simple-int-1 ====
-[1]
-==== simple-int-123 ====
-[123]
-==== negative-zero ====
-[-0]
-==== negative-one ====
-[-1]
-==== negative-int ====
-[-123]
-==== simple-real ====
-[123.456789]
-==== real-exponent ====
-[123e45]
-==== real-capital-e ====
-[1E22]
-==== real-positive-exponent ====
-[1e+2]
-==== real-negative-exponent ====
-[1e-2]
-==== real-capital-e-positive-exponent ====
-[1E+2]
-==== real-capital-e-negative-exponent ====
-[1E-2]
-==== real-fraction-exponent ====
-[123.456e78]
-==== true ====
-[true]
-==== false ====
-[false]
-==== null ====
-[null]
-==== empty-array ====
-[]
-==== empty-object-in-array ====
-[{}]
-==== complex-array ====
-[1,2,3,4,
-"a", "b", "c",
-{"foo": "bar", "core": "dump"},
-true, false, true, true, null, false
-]
-==== empty-object ====
-{}
-==== simple-object ====
-{"a":[]}