Add stripped unit tests for decoder

That is, test cases where there's no newline or other whitespace at
the beginning or end of input. This was implemented by adding a
--strip option to split-testfile to strip the input file after writing
it.

The actual test JSON texts are the same as testdata/invalid and
testdata/valid. The expected output of the invalid cases had to be
adjusted a bit: because there's no newline at the end, some of the
line numbers needed to be changed.
This commit is contained in:
Petri Lehtinen
2009-09-08 16:32:47 +03:00
parent 55d2566539
commit 04d550b02e
6 changed files with 287 additions and 7 deletions

68
test/testdata/valid-strip vendored Normal file
View File

@@ -0,0 +1,68 @@
==== 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":[]}