aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cleantests.py12
-rw-r--r--test/data/fail_invalid_quote.json1
-rw-r--r--test/data/fail_test_array_02.json1
-rw-r--r--test/data/fail_test_object_01.json1
-rw-r--r--test/data/fail_test_stack_limit.json1
-rw-r--r--test/data/legacy_test_array_01.expected (renamed from test/data/test_array_01.expected)0
-rw-r--r--test/data/legacy_test_array_01.json (renamed from test/data/test_array_01.json)0
-rw-r--r--test/data/legacy_test_array_02.expected (renamed from test/data/test_array_02.expected)0
-rw-r--r--test/data/legacy_test_array_02.json (renamed from test/data/test_array_02.json)0
-rw-r--r--test/data/legacy_test_array_03.expected (renamed from test/data/test_array_03.expected)0
-rw-r--r--test/data/legacy_test_array_03.json (renamed from test/data/test_array_03.json)0
-rw-r--r--test/data/legacy_test_array_04.expected (renamed from test/data/test_array_04.expected)0
-rw-r--r--test/data/legacy_test_array_04.json (renamed from test/data/test_array_04.json)0
-rw-r--r--test/data/legacy_test_array_05.expected (renamed from test/data/test_array_05.expected)0
-rw-r--r--test/data/legacy_test_array_05.json (renamed from test/data/test_array_05.json)0
-rw-r--r--test/data/legacy_test_array_06.expected (renamed from test/data/test_array_06.expected)0
-rw-r--r--test/data/legacy_test_array_06.json (renamed from test/data/test_array_06.json)0
-rw-r--r--test/data/legacy_test_array_07.expected (renamed from test/data/test_array_07.expected)0
-rw-r--r--test/data/legacy_test_array_07.json (renamed from test/data/test_array_07.json)0
-rw-r--r--test/data/legacy_test_basic_01.expected (renamed from test/data/test_basic_01.expected)0
-rw-r--r--test/data/legacy_test_basic_01.json (renamed from test/data/test_basic_01.json)0
-rw-r--r--test/data/legacy_test_basic_02.expected (renamed from test/data/test_basic_02.expected)0
-rw-r--r--test/data/legacy_test_basic_02.json (renamed from test/data/test_basic_02.json)0
-rw-r--r--test/data/legacy_test_basic_03.expected (renamed from test/data/test_basic_03.expected)0
-rw-r--r--test/data/legacy_test_basic_03.json (renamed from test/data/test_basic_03.json)0
-rw-r--r--test/data/legacy_test_basic_04.expected (renamed from test/data/test_basic_04.expected)0
-rw-r--r--test/data/legacy_test_basic_04.json (renamed from test/data/test_basic_04.json)0
-rw-r--r--test/data/legacy_test_basic_05.expected (renamed from test/data/test_basic_05.expected)0
-rw-r--r--test/data/legacy_test_basic_05.json (renamed from test/data/test_basic_05.json)0
-rw-r--r--test/data/legacy_test_basic_06.expected (renamed from test/data/test_basic_06.expected)0
-rw-r--r--test/data/legacy_test_basic_06.json (renamed from test/data/test_basic_06.json)0
-rw-r--r--test/data/legacy_test_basic_07.expected (renamed from test/data/test_basic_07.expected)0
-rw-r--r--test/data/legacy_test_basic_07.json (renamed from test/data/test_basic_07.json)0
-rw-r--r--test/data/legacy_test_basic_08.expected (renamed from test/data/test_basic_08.expected)0
-rw-r--r--test/data/legacy_test_basic_08.json (renamed from test/data/test_basic_08.json)0
-rw-r--r--test/data/legacy_test_basic_09.expected (renamed from test/data/test_basic_09.expected)0
-rw-r--r--test/data/legacy_test_basic_09.json (renamed from test/data/test_basic_09.json)0
-rw-r--r--test/data/legacy_test_comment_00.expected4
-rw-r--r--test/data/legacy_test_comment_00.json5
-rw-r--r--test/data/legacy_test_comment_01.expected (renamed from test/data/test_comment_01.expected)2
-rw-r--r--test/data/legacy_test_comment_01.json (renamed from test/data/test_comment_01.json)2
-rw-r--r--test/data/legacy_test_comment_02.expected23
-rw-r--r--test/data/legacy_test_comment_02.json (renamed from test/data/test_comment_02.json)11
-rw-r--r--test/data/legacy_test_complex_01.expected (renamed from test/data/test_complex_01.expected)0
-rw-r--r--test/data/legacy_test_complex_01.json (renamed from test/data/test_complex_01.json)0
-rw-r--r--test/data/legacy_test_integer_01.expected (renamed from test/data/test_integer_01.expected)0
-rw-r--r--test/data/legacy_test_integer_01.json (renamed from test/data/test_integer_01.json)0
-rw-r--r--test/data/legacy_test_integer_02.expected (renamed from test/data/test_integer_02.expected)0
-rw-r--r--test/data/legacy_test_integer_02.json (renamed from test/data/test_integer_02.json)0
-rw-r--r--test/data/legacy_test_integer_03.expected (renamed from test/data/test_integer_03.expected)0
-rw-r--r--test/data/legacy_test_integer_03.json (renamed from test/data/test_integer_03.json)0
-rw-r--r--test/data/legacy_test_integer_04.expected (renamed from test/data/test_integer_04.expected)0
-rw-r--r--test/data/legacy_test_integer_04.json (renamed from test/data/test_integer_04.json)0
-rw-r--r--test/data/legacy_test_integer_05.expected (renamed from test/data/test_integer_05.expected)0
-rw-r--r--test/data/legacy_test_integer_05.json (renamed from test/data/test_integer_05.json)0
-rw-r--r--test/data/legacy_test_integer_06_64bits.expected (renamed from test/data/test_integer_06_64bits.expected)0
-rw-r--r--test/data/legacy_test_integer_06_64bits.json (renamed from test/data/test_integer_06_64bits.json)0
-rw-r--r--test/data/legacy_test_integer_07_64bits.expected (renamed from test/data/test_integer_07_64bits.expected)0
-rw-r--r--test/data/legacy_test_integer_07_64bits.json (renamed from test/data/test_integer_07_64bits.json)0
-rw-r--r--test/data/legacy_test_integer_08_64bits.expected (renamed from test/data/test_integer_08_64bits.expected)0
-rw-r--r--test/data/legacy_test_integer_08_64bits.json (renamed from test/data/test_integer_08_64bits.json)0
-rw-r--r--test/data/legacy_test_large_01.expected (renamed from test/data/test_large_01.expected)0
-rw-r--r--test/data/legacy_test_large_01.json (renamed from test/data/test_large_01.json)0
-rw-r--r--test/data/legacy_test_object_01.expected (renamed from test/data/test_object_01.expected)0
-rw-r--r--test/data/legacy_test_object_01.json (renamed from test/data/test_object_01.json)0
-rw-r--r--test/data/legacy_test_object_02.expected (renamed from test/data/test_object_02.expected)0
-rw-r--r--test/data/legacy_test_object_02.json (renamed from test/data/test_object_02.json)0
-rw-r--r--test/data/legacy_test_object_03.expected (renamed from test/data/test_object_03.expected)0
-rw-r--r--test/data/legacy_test_object_03.json (renamed from test/data/test_object_03.json)0
-rw-r--r--test/data/legacy_test_object_04.expected (renamed from test/data/test_object_04.expected)0
-rw-r--r--test/data/legacy_test_object_04.json (renamed from test/data/test_object_04.json)0
-rw-r--r--test/data/legacy_test_preserve_comment_01.expected (renamed from test/data/test_preserve_comment_01.expected)0
-rw-r--r--test/data/legacy_test_preserve_comment_01.json (renamed from test/data/test_preserve_comment_01.json)0
-rw-r--r--test/data/legacy_test_real_01.expected (renamed from test/data/test_real_01.expected)0
-rw-r--r--test/data/legacy_test_real_01.json (renamed from test/data/test_real_01.json)0
-rw-r--r--test/data/legacy_test_real_02.expected (renamed from test/data/test_real_02.expected)0
-rw-r--r--test/data/legacy_test_real_02.json (renamed from test/data/test_real_02.json)0
-rw-r--r--test/data/legacy_test_real_03.expected (renamed from test/data/test_real_03.expected)0
-rw-r--r--test/data/legacy_test_real_03.json (renamed from test/data/test_real_03.json)0
-rw-r--r--test/data/legacy_test_real_04.expected (renamed from test/data/test_real_04.expected)0
-rw-r--r--test/data/legacy_test_real_04.json (renamed from test/data/test_real_04.json)0
-rw-r--r--test/data/legacy_test_real_05.expected (renamed from test/data/test_real_05.expected)0
-rw-r--r--test/data/legacy_test_real_05.json (renamed from test/data/test_real_05.json)0
-rw-r--r--test/data/legacy_test_real_06.expected (renamed from test/data/test_real_06.expected)0
-rw-r--r--test/data/legacy_test_real_06.json (renamed from test/data/test_real_06.json)0
-rw-r--r--test/data/legacy_test_real_07.expected (renamed from test/data/test_real_07.expected)0
-rw-r--r--test/data/legacy_test_real_07.json (renamed from test/data/test_real_07.json)0
-rw-r--r--test/data/legacy_test_real_08.expected (renamed from test/data/test_real_08.expected)0
-rw-r--r--test/data/legacy_test_real_08.json (renamed from test/data/test_real_08.json)0
-rw-r--r--test/data/legacy_test_real_09.expected (renamed from test/data/test_real_09.expected)0
-rw-r--r--test/data/legacy_test_real_09.json (renamed from test/data/test_real_09.json)0
-rw-r--r--test/data/legacy_test_real_10.expected (renamed from test/data/test_real_10.expected)0
-rw-r--r--test/data/legacy_test_real_10.json (renamed from test/data/test_real_10.json)0
-rw-r--r--test/data/legacy_test_real_11.expected (renamed from test/data/test_real_11.expected)0
-rw-r--r--test/data/legacy_test_real_11.json (renamed from test/data/test_real_11.json)0
-rw-r--r--test/data/legacy_test_real_12.expected (renamed from test/data/test_real_12.expected)0
-rw-r--r--test/data/legacy_test_real_12.json (renamed from test/data/test_real_12.json)0
-rw-r--r--test/data/legacy_test_string_01.expected (renamed from test/data/test_string_01.expected)0
-rw-r--r--test/data/legacy_test_string_01.json (renamed from test/data/test_string_01.json)0
-rw-r--r--test/data/legacy_test_string_02.expected (renamed from test/data/test_string_02.expected)0
-rw-r--r--test/data/legacy_test_string_02.json (renamed from test/data/test_string_02.json)0
-rw-r--r--test/data/legacy_test_string_03.expected (renamed from test/data/test_string_03.expected)0
-rw-r--r--test/data/legacy_test_string_03.json (renamed from test/data/test_string_03.json)0
-rw-r--r--test/data/legacy_test_string_04.expected (renamed from test/data/test_string_04.expected)0
-rw-r--r--test/data/legacy_test_string_04.json (renamed from test/data/test_string_04.json)0
-rw-r--r--test/data/legacy_test_string_05.expected (renamed from test/data/test_string_05.expected)0
-rw-r--r--test/data/legacy_test_string_05.json (renamed from test/data/test_string_05.json)0
-rw-r--r--test/data/legacy_test_string_unicode_01.expected (renamed from test/data/test_string_unicode_01.expected)0
-rw-r--r--test/data/legacy_test_string_unicode_01.json (renamed from test/data/test_string_unicode_01.json)0
-rw-r--r--test/data/legacy_test_string_unicode_02.expected (renamed from test/data/test_string_unicode_02.expected)0
-rw-r--r--test/data/legacy_test_string_unicode_02.json (renamed from test/data/test_string_unicode_02.json)0
-rw-r--r--test/data/legacy_test_string_unicode_03.expected (renamed from test/data/test_string_unicode_03.expected)0
-rw-r--r--test/data/legacy_test_string_unicode_03.json (renamed from test/data/test_string_unicode_03.json)0
-rw-r--r--test/data/legacy_test_string_unicode_04.expected (renamed from test/data/test_string_unicode_04.expected)0
-rw-r--r--test/data/legacy_test_string_unicode_04.json (renamed from test/data/test_string_unicode_04.json)0
-rw-r--r--test/data/legacy_test_string_unicode_05.expected (renamed from test/data/test_string_unicode_05.expected)0
-rw-r--r--test/data/legacy_test_string_unicode_05.json (renamed from test/data/test_string_unicode_05.json)0
-rw-r--r--test/data/test_array_08.expected2
-rw-r--r--test/data/test_array_08.json1
-rw-r--r--test/data/test_comment_02.expected14
-rw-r--r--test/data/test_object_05.expected2
-rw-r--r--test/data/test_object_05.json1
-rw-r--r--test/generate_expected.py9
-rw-r--r--test/pyjsontestrunner.py57
-rw-r--r--test/runjsontests.py144
-rw-r--r--test/rununittests.py46
126 files changed, 232 insertions, 107 deletions
diff --git a/test/cleantests.py b/test/cleantests.py
index c38fd8f..36d5b9b 100644
--- a/test/cleantests.py
+++ b/test/cleantests.py
@@ -1,10 +1,16 @@
-# removes all files created during testing
+# Copyright 2007 Baptiste Lepilleur and The JsonCpp Authors
+# Distributed under MIT license, or public domain if desired and
+# recognized in your jurisdiction.
+# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+"""Removes all files created during testing."""
+
import glob
import os
paths = []
for pattern in [ '*.actual', '*.actual-rewrite', '*.rewrite', '*.process-output' ]:
- paths += glob.glob( 'data/' + pattern )
+ paths += glob.glob('data/' + pattern)
for path in paths:
- os.unlink( path )
+ os.unlink(path)
diff --git a/test/data/fail_invalid_quote.json b/test/data/fail_invalid_quote.json
new file mode 100644
index 0000000..dae27f5
--- /dev/null
+++ b/test/data/fail_invalid_quote.json
@@ -0,0 +1 @@
+{'//this is bad JSON.'} \ No newline at end of file
diff --git a/test/data/fail_test_array_02.json b/test/data/fail_test_array_02.json
new file mode 100644
index 0000000..222a1b4
--- /dev/null
+++ b/test/data/fail_test_array_02.json
@@ -0,0 +1 @@
+[1,,]
diff --git a/test/data/fail_test_object_01.json b/test/data/fail_test_object_01.json
new file mode 100644
index 0000000..46fd39a
--- /dev/null
+++ b/test/data/fail_test_object_01.json
@@ -0,0 +1 @@
+{ "count" : 1234,, }
diff --git a/test/data/fail_test_stack_limit.json b/test/data/fail_test_stack_limit.json
new file mode 100644
index 0000000..7524e0b
--- /dev/null
+++ b/test/data/fail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
+++ b/test/data/legacy_test_array_01.expected
diff --git a/test/data/test_array_01.json b/test/data/legacy_test_array_01.json
index fe51488..fe51488 100644
--- a/test/data/test_array_01.json
+++ b/test/data/legacy_test_array_01.json
diff --git a/test/data/test_array_02.expected b/test/data/legacy_test_array_02.expected
index ef1f262..ef1f262 100644
--- a/test/data/test_array_02.expected
+++ b/test/data/legacy_test_array_02.expected
diff --git a/test/data/test_array_02.json b/test/data/legacy_test_array_02.json
index 7660873..7660873 100644
--- a/test/data/test_array_02.json
+++ b/test/data/legacy_test_array_02.json
diff --git a/test/data/test_array_03.expected b/test/data/legacy_test_array_03.expected
index 3d8dc18..3d8dc18 100644
--- a/test/data/test_array_03.expected
+++ b/test/data/legacy_test_array_03.expected
diff --git a/test/data/test_array_03.json b/test/data/legacy_test_array_03.json
index 9b3f924..9b3f924 100644
--- a/test/data/test_array_03.json
+++ b/test/data/legacy_test_array_03.json
diff --git a/test/data/test_array_04.expected b/test/data/legacy_test_array_04.expected
index ad4add9..ad4add9 100644
--- a/test/data/test_array_04.expected
+++ b/test/data/legacy_test_array_04.expected
diff --git a/test/data/test_array_04.json b/test/data/legacy_test_array_04.json
index ecca546..ecca546 100644
--- a/test/data/test_array_04.json
+++ b/test/data/legacy_test_array_04.json
diff --git a/test/data/test_array_05.expected b/test/data/legacy_test_array_05.expected
index 76cff87..76cff87 100644
--- a/test/data/test_array_05.expected
+++ b/test/data/legacy_test_array_05.expected
diff --git a/test/data/test_array_05.json b/test/data/legacy_test_array_05.json
index 7809d6c..7809d6c 100644
--- a/test/data/test_array_05.json
+++ b/test/data/legacy_test_array_05.json
diff --git a/test/data/test_array_06.expected b/test/data/legacy_test_array_06.expected
index 5c9f48e..5c9f48e 100644
--- a/test/data/test_array_06.expected
+++ b/test/data/legacy_test_array_06.expected
diff --git a/test/data/test_array_06.json b/test/data/legacy_test_array_06.json
index 7f6c516..7f6c516 100644
--- a/test/data/test_array_06.json
+++ b/test/data/legacy_test_array_06.json
diff --git a/test/data/test_array_07.expected b/test/data/legacy_test_array_07.expected
index ee2fafc..ee2fafc 100644
--- a/test/data/test_array_07.expected
+++ b/test/data/legacy_test_array_07.expected
diff --git a/test/data/test_array_07.json b/test/data/legacy_test_array_07.json
index e4ab4cd..e4ab4cd 100644
--- a/test/data/test_array_07.json
+++ b/test/data/legacy_test_array_07.json
diff --git a/test/data/test_basic_01.expected b/test/data/legacy_test_basic_01.expected
index d761fce..d761fce 100644
--- a/test/data/test_basic_01.expected
+++ b/test/data/legacy_test_basic_01.expected
diff --git a/test/data/test_basic_01.json b/test/data/legacy_test_basic_01.json
index 11f11f9..11f11f9 100644
--- a/test/data/test_basic_01.json
+++ b/test/data/legacy_test_basic_01.json
diff --git a/test/data/test_basic_02.expected b/test/data/legacy_test_basic_02.expected
index 650e37c..650e37c 100644
--- a/test/data/test_basic_02.expected
+++ b/test/data/legacy_test_basic_02.expected
diff --git a/test/data/test_basic_02.json b/test/data/legacy_test_basic_02.json
index bf11bce..bf11bce 100644
--- a/test/data/test_basic_02.json
+++ b/test/data/legacy_test_basic_02.json
diff --git a/test/data/test_basic_03.expected b/test/data/legacy_test_basic_03.expected
index 1da2d39..1da2d39 100644
--- a/test/data/test_basic_03.expected
+++ b/test/data/legacy_test_basic_03.expected
diff --git a/test/data/test_basic_03.json b/test/data/legacy_test_basic_03.json
index a92b6bd..a92b6bd 100644
--- a/test/data/test_basic_03.json
+++ b/test/data/legacy_test_basic_03.json
diff --git a/test/data/test_basic_04.expected b/test/data/legacy_test_basic_04.expected
index 013f424..013f424 100644
--- a/test/data/test_basic_04.expected
+++ b/test/data/legacy_test_basic_04.expected
diff --git a/test/data/test_basic_04.json b/test/data/legacy_test_basic_04.json
index 17eeb99..17eeb99 100644
--- a/test/data/test_basic_04.json
+++ b/test/data/legacy_test_basic_04.json
diff --git a/test/data/test_basic_05.expected b/test/data/legacy_test_basic_05.expected
index c8db822..c8db822 100644
--- a/test/data/test_basic_05.expected
+++ b/test/data/legacy_test_basic_05.expected
diff --git a/test/data/test_basic_05.json b/test/data/legacy_test_basic_05.json
index d0aaea2..d0aaea2 100644
--- a/test/data/test_basic_05.json
+++ b/test/data/legacy_test_basic_05.json
diff --git a/test/data/test_basic_06.expected b/test/data/legacy_test_basic_06.expected
index 49be55a..49be55a 100644
--- a/test/data/test_basic_06.expected
+++ b/test/data/legacy_test_basic_06.expected
diff --git a/test/data/test_basic_06.json b/test/data/legacy_test_basic_06.json
index 7eead1e..7eead1e 100644
--- a/test/data/test_basic_06.json
+++ b/test/data/legacy_test_basic_06.json
diff --git a/test/data/test_basic_07.expected b/test/data/legacy_test_basic_07.expected
index fe55a6a..fe55a6a 100644
--- a/test/data/test_basic_07.expected
+++ b/test/data/legacy_test_basic_07.expected
diff --git a/test/data/test_basic_07.json b/test/data/legacy_test_basic_07.json
index a864bc4..a864bc4 100644
--- a/test/data/test_basic_07.json
+++ b/test/data/legacy_test_basic_07.json
diff --git a/test/data/test_basic_08.expected b/test/data/legacy_test_basic_08.expected
index caf5352..caf5352 100644
--- a/test/data/test_basic_08.expected
+++ b/test/data/legacy_test_basic_08.expected
diff --git a/test/data/test_basic_08.json b/test/data/legacy_test_basic_08.json
index fd78837..fd78837 100644
--- a/test/data/test_basic_08.json
+++ b/test/data/legacy_test_basic_08.json
diff --git a/test/data/test_basic_09.expected b/test/data/legacy_test_basic_09.expected
index 8b129da..8b129da 100644
--- a/test/data/test_basic_09.expected
+++ b/test/data/legacy_test_basic_09.expected
diff --git a/test/data/test_basic_09.json b/test/data/legacy_test_basic_09.json
index fc95f0f..fc95f0f 100644
--- a/test/data/test_basic_09.json
+++ b/test/data/legacy_test_basic_09.json
diff --git a/test/data/legacy_test_comment_00.expected b/test/data/legacy_test_comment_00.expected
new file mode 100644
index 0000000..284a797
--- /dev/null
+++ b/test/data/legacy_test_comment_00.expected
@@ -0,0 +1,4 @@
+// Comment for array
+.=[]
+// Comment within array
+.[0]="one-element"
diff --git a/test/data/legacy_test_comment_00.json b/test/data/legacy_test_comment_00.json
new file mode 100644
index 0000000..4df577a
--- /dev/null
+++ b/test/data/legacy_test_comment_00.json
@@ -0,0 +1,5 @@
+// Comment for array
+[
+ // Comment within array
+ "one-element"
+]
diff --git a/test/data/test_comment_01.expected b/test/data/legacy_test_comment_01.expected
index 2a7f00c..1ed01ba 100644
--- a/test/data/test_comment_01.expected
+++ b/test/data/legacy_test_comment_01.expected
@@ -1,5 +1,7 @@
.={}
+// Comment for array
.test=[]
+// Comment within array
.test[0]={}
.test[0].a="aaa"
.test[1]={}
diff --git a/test/data/test_comment_01.json b/test/data/legacy_test_comment_01.json
index 7363490..6defe40 100644
--- a/test/data/test_comment_01.json
+++ b/test/data/legacy_test_comment_01.json
@@ -1,6 +1,8 @@
{
"test":
+ // Comment for array
[
+ // Comment within array
{ "a" : "aaa" }, // Comment for a
{ "b" : "bbb" }, // Comment for b
{ "c" : "ccc" } // Comment for c
diff --git a/test/data/legacy_test_comment_02.expected b/test/data/legacy_test_comment_02.expected
new file mode 100644
index 0000000..8986dba
--- /dev/null
+++ b/test/data/legacy_test_comment_02.expected
@@ -0,0 +1,23 @@
+.={}
+/* C-style comment
+
+ C-style-2 comment */
+.c-test={}
+.c-test.a=1
+/* Internal comment c-style */
+.c-test.b=2
+// C++-style comment
+.cpp-test={}
+// Multiline comment cpp-style
+// Second line
+.cpp-test.c=3
+// Comment before double
+.cpp-test.d=4.1
+// Comment before string
+.cpp-test.e="e-string"
+// Comment before true
+.cpp-test.f=true
+// Comment before false
+.cpp-test.g=false
+// Comment before null
+.cpp-test.h=null
diff --git a/test/data/test_comment_02.json b/test/data/legacy_test_comment_02.json
index 297d889..f5042e0 100644
--- a/test/data/test_comment_02.json
+++ b/test/data/legacy_test_comment_02.json
@@ -12,6 +12,15 @@
// Multiline comment cpp-style
// Second line
"c" : 3,
- "d" : 4
+ // Comment before double
+ "d" : 4.1,
+ // Comment before string
+ "e" : "e-string",
+ // Comment before true
+ "f" : true,
+ // Comment before false
+ "g" : false,
+ // Comment before null
+ "h" : null
}
}
diff --git a/test/data/test_complex_01.expected b/test/data/legacy_test_complex_01.expected
index 7573c88..7573c88 100644
--- a/test/data/test_complex_01.expected
+++ b/test/data/legacy_test_complex_01.expected
diff --git a/test/data/test_complex_01.json b/test/data/legacy_test_complex_01.json
index cc0f30f..cc0f30f 100644
--- a/test/data/test_complex_01.json
+++ b/test/data/legacy_test_complex_01.json
diff --git a/test/data/test_integer_01.expected b/test/data/legacy_test_integer_01.expected
index 463e149..463e149 100644
--- a/test/data/test_integer_01.expected
+++ b/test/data/legacy_test_integer_01.expected
diff --git a/test/data/test_integer_01.json b/test/data/legacy_test_integer_01.json
index 5ab12ff..5ab12ff 100644
--- a/test/data/test_integer_01.json
+++ b/test/data/legacy_test_integer_01.json
diff --git a/test/data/test_integer_02.expected b/test/data/legacy_test_integer_02.expected
index 0773e08..0773e08 100644
--- a/test/data/test_integer_02.expected
+++ b/test/data/legacy_test_integer_02.expected
diff --git a/test/data/test_integer_02.json b/test/data/legacy_test_integer_02.json
index 056c850..056c850 100644
--- a/test/data/test_integer_02.json
+++ b/test/data/legacy_test_integer_02.json
diff --git a/test/data/test_integer_03.expected b/test/data/legacy_test_integer_03.expected
index c7efff7..c7efff7 100644
--- a/test/data/test_integer_03.expected
+++ b/test/data/legacy_test_integer_03.expected
diff --git a/test/data/test_integer_03.json b/test/data/legacy_test_integer_03.json
index 12ef3fb..12ef3fb 100644
--- a/test/data/test_integer_03.json
+++ b/test/data/legacy_test_integer_03.json
diff --git a/test/data/test_integer_04.expected b/test/data/legacy_test_integer_04.expected
index 39f8567..39f8567 100644
--- a/test/data/test_integer_04.expected
+++ b/test/data/legacy_test_integer_04.expected
diff --git a/test/data/test_integer_04.json b/test/data/legacy_test_integer_04.json
index bf81499..bf81499 100644
--- a/test/data/test_integer_04.json
+++ b/test/data/legacy_test_integer_04.json
diff --git a/test/data/test_integer_05.expected b/test/data/legacy_test_integer_05.expected
index 0caea9d..0caea9d 100644
--- a/test/data/test_integer_05.expected
+++ b/test/data/legacy_test_integer_05.expected
diff --git a/test/data/test_integer_05.json b/test/data/legacy_test_integer_05.json
index d474e1b..d474e1b 100644
--- a/test/data/test_integer_05.json
+++ b/test/data/legacy_test_integer_05.json
diff --git a/test/data/test_integer_06_64bits.expected b/test/data/legacy_test_integer_06_64bits.expected
index 131b085..131b085 100644
--- a/test/data/test_integer_06_64bits.expected
+++ b/test/data/legacy_test_integer_06_64bits.expected
diff --git a/test/data/test_integer_06_64bits.json b/test/data/legacy_test_integer_06_64bits.json
index cfedfe5..cfedfe5 100644
--- a/test/data/test_integer_06_64bits.json
+++ b/test/data/legacy_test_integer_06_64bits.json
diff --git a/test/data/test_integer_07_64bits.expected b/test/data/legacy_test_integer_07_64bits.expected
index c8524a3..c8524a3 100644
--- a/test/data/test_integer_07_64bits.expected
+++ b/test/data/legacy_test_integer_07_64bits.expected
diff --git a/test/data/test_integer_07_64bits.json b/test/data/legacy_test_integer_07_64bits.json
index a964ad2..a964ad2 100644
--- a/test/data/test_integer_07_64bits.json
+++ b/test/data/legacy_test_integer_07_64bits.json
diff --git a/test/data/test_integer_08_64bits.expected b/test/data/legacy_test_integer_08_64bits.expected
index 321bba5..321bba5 100644
--- a/test/data/test_integer_08_64bits.expected
+++ b/test/data/legacy_test_integer_08_64bits.expected
diff --git a/test/data/test_integer_08_64bits.json b/test/data/legacy_test_integer_08_64bits.json
index 4c15a01..4c15a01 100644
--- a/test/data/test_integer_08_64bits.json
+++ b/test/data/legacy_test_integer_08_64bits.json
diff --git a/test/data/test_large_01.expected b/test/data/legacy_test_large_01.expected
index ee2fafc..ee2fafc 100644
--- a/test/data/test_large_01.expected
+++ b/test/data/legacy_test_large_01.expected
diff --git a/test/data/test_large_01.json b/test/data/legacy_test_large_01.json
index e4ab4cd..e4ab4cd 100644
--- a/test/data/test_large_01.json
+++ b/test/data/legacy_test_large_01.json
diff --git a/test/data/test_object_01.expected b/test/data/legacy_test_object_01.expected
index 67444e5..67444e5 100644
--- a/test/data/test_object_01.expected
+++ b/test/data/legacy_test_object_01.expected
diff --git a/test/data/test_object_01.json b/test/data/legacy_test_object_01.json
index 0967ef4..0967ef4 100644
--- a/test/data/test_object_01.json
+++ b/test/data/legacy_test_object_01.json
diff --git a/test/data/test_object_02.expected b/test/data/legacy_test_object_02.expected
index 79391c2..79391c2 100644
--- a/test/data/test_object_02.expected
+++ b/test/data/legacy_test_object_02.expected
diff --git a/test/data/test_object_02.json b/test/data/legacy_test_object_02.json
index d0f2fac..d0f2fac 100644
--- a/test/data/test_object_02.json
+++ b/test/data/legacy_test_object_02.json
diff --git a/test/data/test_object_03.expected b/test/data/legacy_test_object_03.expected
index 5e96113..5e96113 100644
--- a/test/data/test_object_03.expected
+++ b/test/data/legacy_test_object_03.expected
diff --git a/test/data/test_object_03.json b/test/data/legacy_test_object_03.json
index 4fcd4d8..4fcd4d8 100644
--- a/test/data/test_object_03.json
+++ b/test/data/legacy_test_object_03.json
diff --git a/test/data/test_object_04.expected b/test/data/legacy_test_object_04.expected
index 812965b..812965b 100644
--- a/test/data/test_object_04.expected
+++ b/test/data/legacy_test_object_04.expected
diff --git a/test/data/test_object_04.json b/test/data/legacy_test_object_04.json
index 450762d..450762d 100644
--- a/test/data/test_object_04.json
+++ b/test/data/legacy_test_object_04.json
diff --git a/test/data/test_preserve_comment_01.expected b/test/data/legacy_test_preserve_comment_01.expected
index 2797aa7..2797aa7 100644
--- a/test/data/test_preserve_comment_01.expected
+++ b/test/data/legacy_test_preserve_comment_01.expected
diff --git a/test/data/test_preserve_comment_01.json b/test/data/legacy_test_preserve_comment_01.json
index fabd55d..fabd55d 100644
--- a/test/data/test_preserve_comment_01.json
+++ b/test/data/legacy_test_preserve_comment_01.json
diff --git a/test/data/test_real_01.expected b/test/data/legacy_test_real_01.expected
index 9514827..9514827 100644
--- a/test/data/test_real_01.expected
+++ b/test/data/legacy_test_real_01.expected
diff --git a/test/data/test_real_01.json b/test/data/legacy_test_real_01.json
index 358452d..358452d 100644
--- a/test/data/test_real_01.json
+++ b/test/data/legacy_test_real_01.json
diff --git a/test/data/test_real_02.expected b/test/data/legacy_test_real_02.expected
index b80c004..b80c004 100644
--- a/test/data/test_real_02.expected
+++ b/test/data/legacy_test_real_02.expected
diff --git a/test/data/test_real_02.json b/test/data/legacy_test_real_02.json
index 936c706..936c706 100644
--- a/test/data/test_real_02.json
+++ b/test/data/legacy_test_real_02.json
diff --git a/test/data/test_real_03.expected b/test/data/legacy_test_real_03.expected
index b80c004..b80c004 100644
--- a/test/data/test_real_03.expected
+++ b/test/data/legacy_test_real_03.expected
diff --git a/test/data/test_real_03.json b/test/data/legacy_test_real_03.json
index 936c706..936c706 100644
--- a/test/data/test_real_03.json
+++ b/test/data/legacy_test_real_03.json
diff --git a/test/data/test_real_04.expected b/test/data/legacy_test_real_04.expected
index ff71a23..ff71a23 100644
--- a/test/data/test_real_04.expected
+++ b/test/data/legacy_test_real_04.expected
diff --git a/test/data/test_real_04.json b/test/data/legacy_test_real_04.json
index a8eb6d0..a8eb6d0 100644
--- a/test/data/test_real_04.json
+++ b/test/data/legacy_test_real_04.json
diff --git a/test/data/test_real_05.expected b/test/data/legacy_test_real_05.expected
index 7a46093..7a46093 100644
--- a/test/data/test_real_05.expected
+++ b/test/data/legacy_test_real_05.expected
diff --git a/test/data/test_real_05.json b/test/data/legacy_test_real_05.json
index f7923ba..f7923ba 100644
--- a/test/data/test_real_05.json
+++ b/test/data/legacy_test_real_05.json
diff --git a/test/data/test_real_06.expected b/test/data/legacy_test_real_06.expected
index a4a004d..a4a004d 100644
--- a/test/data/test_real_06.expected
+++ b/test/data/legacy_test_real_06.expected
diff --git a/test/data/test_real_06.json b/test/data/legacy_test_real_06.json
index 485419a..485419a 100644
--- a/test/data/test_real_06.json
+++ b/test/data/legacy_test_real_06.json
diff --git a/test/data/test_real_07.expected b/test/data/legacy_test_real_07.expected
index dc02a89..dc02a89 100644
--- a/test/data/test_real_07.expected
+++ b/test/data/legacy_test_real_07.expected
diff --git a/test/data/test_real_07.json b/test/data/legacy_test_real_07.json
index 8013eb5..8013eb5 100644
--- a/test/data/test_real_07.json
+++ b/test/data/legacy_test_real_07.json
diff --git a/test/data/test_real_08.expected b/test/data/legacy_test_real_08.expected
index b1deef9..b1deef9 100644
--- a/test/data/test_real_08.expected
+++ b/test/data/legacy_test_real_08.expected
diff --git a/test/data/test_real_08.json b/test/data/legacy_test_real_08.json
index cca950d..cca950d 100644
--- a/test/data/test_real_08.json
+++ b/test/data/legacy_test_real_08.json
diff --git a/test/data/test_real_09.expected b/test/data/legacy_test_real_09.expected
index aa2dbb2..aa2dbb2 100644
--- a/test/data/test_real_09.expected
+++ b/test/data/legacy_test_real_09.expected
diff --git a/test/data/test_real_09.json b/test/data/legacy_test_real_09.json
index e65d50c..e65d50c 100644
--- a/test/data/test_real_09.json
+++ b/test/data/legacy_test_real_09.json
diff --git a/test/data/test_real_10.expected b/test/data/legacy_test_real_10.expected
index d28a430..d28a430 100644
--- a/test/data/test_real_10.expected
+++ b/test/data/legacy_test_real_10.expected
diff --git a/test/data/test_real_10.json b/test/data/legacy_test_real_10.json
index a6a8bce..a6a8bce 100644
--- a/test/data/test_real_10.json
+++ b/test/data/legacy_test_real_10.json
diff --git a/test/data/test_real_11.expected b/test/data/legacy_test_real_11.expected
index 2551946..2551946 100644
--- a/test/data/test_real_11.expected
+++ b/test/data/legacy_test_real_11.expected
diff --git a/test/data/test_real_11.json b/test/data/legacy_test_real_11.json
index 63cdb36..63cdb36 100644
--- a/test/data/test_real_11.json
+++ b/test/data/legacy_test_real_11.json
diff --git a/test/data/test_real_12.expected b/test/data/legacy_test_real_12.expected
index 93e2417..93e2417 100644
--- a/test/data/test_real_12.expected
+++ b/test/data/legacy_test_real_12.expected
diff --git a/test/data/test_real_12.json b/test/data/legacy_test_real_12.json
index 0a13eed..0a13eed 100644
--- a/test/data/test_real_12.json
+++ b/test/data/legacy_test_real_12.json
diff --git a/test/data/test_string_01.expected b/test/data/legacy_test_string_01.expected
index 8fd37b1..8fd37b1 100644
--- a/test/data/test_string_01.expected
+++ b/test/data/legacy_test_string_01.expected
diff --git a/test/data/test_string_01.json b/test/data/legacy_test_string_01.json
index 6cd0db4..6cd0db4 100644
--- a/test/data/test_string_01.json
+++ b/test/data/legacy_test_string_01.json
diff --git a/test/data/test_string_02.expected b/test/data/legacy_test_string_02.expected
index 0443bc3..0443bc3 100644
--- a/test/data/test_string_02.expected
+++ b/test/data/legacy_test_string_02.expected
diff --git a/test/data/test_string_02.json b/test/data/legacy_test_string_02.json
index 9a7e5dc..9a7e5dc 100644
--- a/test/data/test_string_02.json
+++ b/test/data/legacy_test_string_02.json
diff --git a/test/data/test_string_03.expected b/test/data/legacy_test_string_03.expected
index 6ed627a..6ed627a 100644
--- a/test/data/test_string_03.expected
+++ b/test/data/legacy_test_string_03.expected
diff --git a/test/data/test_string_03.json b/test/data/legacy_test_string_03.json
index 2d38180..2d38180 100644
--- a/test/data/test_string_03.json
+++ b/test/data/legacy_test_string_03.json
diff --git a/test/data/test_string_04.expected b/test/data/legacy_test_string_04.expected
index f57d525..f57d525 100644
--- a/test/data/test_string_04.expected
+++ b/test/data/legacy_test_string_04.expected
diff --git a/test/data/test_string_04.json b/test/data/legacy_test_string_04.json
index 01fe752..01fe752 100644
--- a/test/data/test_string_04.json
+++ b/test/data/legacy_test_string_04.json
diff --git a/test/data/test_string_05.expected b/test/data/legacy_test_string_05.expected
index 9794ddd..9794ddd 100644
--- a/test/data/test_string_05.expected
+++ b/test/data/legacy_test_string_05.expected
diff --git a/test/data/test_string_05.json b/test/data/legacy_test_string_05.json
index e156024..e156024 100644
--- a/test/data/test_string_05.json
+++ b/test/data/legacy_test_string_05.json
diff --git a/test/data/test_string_unicode_01.expected b/test/data/legacy_test_string_unicode_01.expected
index 1f3be7f..1f3be7f 100644
--- a/test/data/test_string_unicode_01.expected
+++ b/test/data/legacy_test_string_unicode_01.expected
diff --git a/test/data/test_string_unicode_01.json b/test/data/legacy_test_string_unicode_01.json
index 024114b..024114b 100644
--- a/test/data/test_string_unicode_01.json
+++ b/test/data/legacy_test_string_unicode_01.json
diff --git a/test/data/test_string_unicode_02.expected b/test/data/legacy_test_string_unicode_02.expected
index 1388f53..1388f53 100644
--- a/test/data/test_string_unicode_02.expected
+++ b/test/data/legacy_test_string_unicode_02.expected
diff --git a/test/data/test_string_unicode_02.json b/test/data/legacy_test_string_unicode_02.json
index 4961024..4961024 100644
--- a/test/data/test_string_unicode_02.json
+++ b/test/data/legacy_test_string_unicode_02.json
diff --git a/test/data/test_string_unicode_03.expected b/test/data/legacy_test_string_unicode_03.expected
index 9b80b27..9b80b27 100644
--- a/test/data/test_string_unicode_03.expected
+++ b/test/data/legacy_test_string_unicode_03.expected
diff --git a/test/data/test_string_unicode_03.json b/test/data/legacy_test_string_unicode_03.json
index e7e1a9e..e7e1a9e 100644
--- a/test/data/test_string_unicode_03.json
+++ b/test/data/legacy_test_string_unicode_03.json
diff --git a/test/data/test_string_unicode_04.expected b/test/data/legacy_test_string_unicode_04.expected
index b9e7fe3..b9e7fe3 100644
--- a/test/data/test_string_unicode_04.expected
+++ b/test/data/legacy_test_string_unicode_04.expected
diff --git a/test/data/test_string_unicode_04.json b/test/data/legacy_test_string_unicode_04.json
index dae65c5..dae65c5 100644
--- a/test/data/test_string_unicode_04.json
+++ b/test/data/legacy_test_string_unicode_04.json
diff --git a/test/data/test_string_unicode_05.expected b/test/data/legacy_test_string_unicode_05.expected
index c2e67f9..c2e67f9 100644
--- a/test/data/test_string_unicode_05.expected
+++ b/test/data/legacy_test_string_unicode_05.expected
diff --git a/test/data/test_string_unicode_05.json b/test/data/legacy_test_string_unicode_05.json
index 8770410..8770410 100644
--- a/test/data/test_string_unicode_05.json
+++ b/test/data/legacy_test_string_unicode_05.json
diff --git a/test/data/test_array_08.expected b/test/data/test_array_08.expected
new file mode 100644
index 0000000..ef1f262
--- /dev/null
+++ b/test/data/test_array_08.expected
@@ -0,0 +1,2 @@
+.=[]
+.[0]=1
diff --git a/test/data/test_array_08.json b/test/data/test_array_08.json
new file mode 100644
index 0000000..e8b1a17
--- /dev/null
+++ b/test/data/test_array_08.json
@@ -0,0 +1 @@
+[1,]
diff --git a/test/data/test_comment_02.expected b/test/data/test_comment_02.expected
deleted file mode 100644
index 88d2bd0..0000000
--- a/test/data/test_comment_02.expected
+++ /dev/null
@@ -1,14 +0,0 @@
-.={}
-/* C-style comment
-
- C-style-2 comment */
-.c-test={}
-.c-test.a=1
-/* Internal comment c-style */
-.c-test.b=2
-// C++-style comment
-.cpp-test={}
-// Multiline comment cpp-style
-// Second line
-.cpp-test.c=3
-.cpp-test.d=4
diff --git a/test/data/test_object_05.expected b/test/data/test_object_05.expected
new file mode 100644
index 0000000..79391c2
--- /dev/null
+++ b/test/data/test_object_05.expected
@@ -0,0 +1,2 @@
+.={}
+.count=1234
diff --git a/test/data/test_object_05.json b/test/data/test_object_05.json
new file mode 100644
index 0000000..c4344b1
--- /dev/null
+++ b/test/data/test_object_05.json
@@ -0,0 +1 @@
+{ "count" : 1234, }
diff --git a/test/generate_expected.py b/test/generate_expected.py
index f668da2..e049ab5 100644
--- a/test/generate_expected.py
+++ b/test/generate_expected.py
@@ -1,10 +1,15 @@
+# Copyright 2007 Baptiste Lepilleur and The JsonCpp Authors
+# Distributed under MIT license, or public domain if desired and
+# recognized in your jurisdiction.
+# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
from __future__ import print_function
import glob
import os.path
-for path in glob.glob( '*.json' ):
+for path in glob.glob('*.json'):
text = file(path,'rt').read()
target = os.path.splitext(path)[0] + '.expected'
- if os.path.exists( target ):
+ if os.path.exists(target):
print('skipping:', target)
else:
print('creating:', target)
diff --git a/test/pyjsontestrunner.py b/test/pyjsontestrunner.py
index 3f08a8a..bd749b5 100644
--- a/test/pyjsontestrunner.py
+++ b/test/pyjsontestrunner.py
@@ -1,4 +1,11 @@
-# Simple implementation of a json test runner to run the test against json-py.
+# Copyright 2007 Baptiste Lepilleur and The JsonCpp Authors
+# Distributed under MIT license, or public domain if desired and
+# recognized in your jurisdiction.
+# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+"""Simple implementation of a json test runner to run the test against
+json-py."""
+
from __future__ import print_function
import sys
import os.path
@@ -15,50 +22,50 @@ actual_path = base_path + '.actual'
rewrite_path = base_path + '.rewrite'
rewrite_actual_path = base_path + '.actual-rewrite'
-def valueTreeToString( fout, value, path = '.' ):
+def valueTreeToString(fout, value, path = '.'):
ty = type(value)
if ty is types.DictType:
- fout.write( '%s={}\n' % path )
+ fout.write('%s={}\n' % path)
suffix = path[-1] != '.' and '.' or ''
names = value.keys()
names.sort()
for name in names:
- valueTreeToString( fout, value[name], path + suffix + name )
+ valueTreeToString(fout, value[name], path + suffix + name)
elif ty is types.ListType:
- fout.write( '%s=[]\n' % path )
- for index, childValue in zip( xrange(0,len(value)), value ):
- valueTreeToString( fout, childValue, path + '[%d]' % index )
+ fout.write('%s=[]\n' % path)
+ for index, childValue in zip(xrange(0,len(value)), value):
+ valueTreeToString(fout, childValue, path + '[%d]' % index)
elif ty is types.StringType:
- fout.write( '%s="%s"\n' % (path,value) )
+ fout.write('%s="%s"\n' % (path,value))
elif ty is types.IntType:
- fout.write( '%s=%d\n' % (path,value) )
+ fout.write('%s=%d\n' % (path,value))
elif ty is types.FloatType:
- fout.write( '%s=%.16g\n' % (path,value) )
+ fout.write('%s=%.16g\n' % (path,value))
elif value is True:
- fout.write( '%s=true\n' % path )
+ fout.write('%s=true\n' % path)
elif value is False:
- fout.write( '%s=false\n' % path )
+ fout.write('%s=false\n' % path)
elif value is None:
- fout.write( '%s=null\n' % path )
+ fout.write('%s=null\n' % path)
else:
assert False and "Unexpected value type"
-def parseAndSaveValueTree( input, actual_path ):
- root = json.loads( input )
- fout = file( actual_path, 'wt' )
- valueTreeToString( fout, root )
+def parseAndSaveValueTree(input, actual_path):
+ root = json.loads(input)
+ fout = file(actual_path, 'wt')
+ valueTreeToString(fout, root)
fout.close()
return root
-def rewriteValueTree( value, rewrite_path ):
- rewrite = json.dumps( value )
+def rewriteValueTree(value, rewrite_path):
+ rewrite = json.dumps(value)
#rewrite = rewrite[1:-1] # Somehow the string is quoted ! jsonpy bug ?
- file( rewrite_path, 'wt').write( rewrite + '\n' )
+ file(rewrite_path, 'wt').write(rewrite + '\n')
return rewrite
-input = file( input_path, 'rt' ).read()
-root = parseAndSaveValueTree( input, actual_path )
-rewrite = rewriteValueTree( json.write( root ), rewrite_path )
-rewrite_root = parseAndSaveValueTree( rewrite, rewrite_actual_path )
+input = file(input_path, 'rt').read()
+root = parseAndSaveValueTree(input, actual_path)
+rewrite = rewriteValueTree(json.write(root), rewrite_path)
+rewrite_root = parseAndSaveValueTree(rewrite, rewrite_actual_path)
-sys.exit( 0 )
+sys.exit(0)
diff --git a/test/runjsontests.py b/test/runjsontests.py
index a1f6082..5496e2c 100644
--- a/test/runjsontests.py
+++ b/test/runjsontests.py
@@ -1,17 +1,41 @@
+# Copyright 2007 Baptiste Lepilleur and The JsonCpp Authors
+# Distributed under MIT license, or public domain if desired and
+# recognized in your jurisdiction.
+# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
from __future__ import print_function
+from __future__ import unicode_literals
+from io import open
+from glob import glob
import sys
import os
import os.path
-from glob import glob
import optparse
VALGRIND_CMD = 'valgrind --tool=memcheck --leak-check=yes --undef-value-errors=yes '
-def compareOutputs( expected, actual, message ):
+def getStatusOutput(cmd):
+ """
+ Return int, unicode (for both Python 2 and 3).
+ Note: os.popen().close() would return None for 0.
+ """
+ print(cmd, file=sys.stderr)
+ pipe = os.popen(cmd)
+ process_output = pipe.read()
+ try:
+ # We have been using os.popen(). When we read() the result
+ # we get 'str' (bytes) in py2, and 'str' (unicode) in py3.
+ # Ugh! There must be a better way to handle this.
+ process_output = process_output.decode('utf-8')
+ except AttributeError:
+ pass # python3
+ status = pipe.close()
+ return status, process_output
+def compareOutputs(expected, actual, message):
expected = expected.strip().replace('\r','').split('\n')
actual = actual.strip().replace('\r','').split('\n')
diff_line = 0
- max_line_to_compare = min( len(expected), len(actual) )
+ max_line_to_compare = min(len(expected), len(actual))
for index in range(0,max_line_to_compare):
if expected[index].strip() != actual[index].strip():
diff_line = index + 1
@@ -20,7 +44,7 @@ def compareOutputs( expected, actual, message ):
diff_line = max_line_to_compare+1
if diff_line == 0:
return None
- def safeGetLine( lines, index ):
+ def safeGetLine(lines, index):
index += -1
if index >= len(lines):
return ''
@@ -30,65 +54,86 @@ def compareOutputs( expected, actual, message ):
Actual: '%s'
""" % (message, diff_line,
safeGetLine(expected,diff_line),
- safeGetLine(actual,diff_line) )
-
-def safeReadFile( path ):
+ safeGetLine(actual,diff_line))
+
+def safeReadFile(path):
try:
- return file( path, 'rt' ).read()
+ return open(path, 'rt', encoding = 'utf-8').read()
except IOError as e:
return '<File "%s" is missing: %s>' % (path,e)
-def runAllTests( jsontest_executable_path, input_dir = None,
- use_valgrind=False, with_json_checker=False ):
+class FailError(Exception):
+ def __init__(self, msg):
+ super(Exception, self).__init__(msg)
+
+def runAllTests(jsontest_executable_path, input_dir = None,
+ use_valgrind=False, with_json_checker=False,
+ writerClass='StyledWriter'):
if not input_dir:
- input_dir = os.path.join( os.getcwd(), 'data' )
- tests = glob( os.path.join( input_dir, '*.json' ) )
+ input_dir = os.path.join(os.getcwd(), 'data')
+ tests = glob(os.path.join(input_dir, '*.json'))
if with_json_checker:
- test_jsonchecker = glob( os.path.join( input_dir, '../jsonchecker', '*.json' ) )
+ all_tests = glob(os.path.join(input_dir, '../jsonchecker', '*.json'))
+ # These tests fail with strict json support, but pass with JsonCPP's
+ # extra leniency features. When adding a new exclusion to this list,
+ # remember to add the test's number and reasoning here:
+ known = ["fail{}.json".format(n) for n in [
+ 4, 9, # fail because we allow trailing commas
+ 7, # fails because we allow commas after close
+ 8, # fails because we allow extra close
+ 10, # fails because we allow extra values after close
+ 13, # fails because we allow leading zeroes in numbers
+ 18, # fails because we allow deeply nested values
+ 25, # fails because we allow tab characters in strings
+ 27, # fails because we allow string line breaks
+ ]]
+ test_jsonchecker = [ test for test in all_tests
+ if os.path.basename(test) not in known]
+
else:
test_jsonchecker = []
+
failed_tests = []
valgrind_path = use_valgrind and VALGRIND_CMD or ''
for input_path in tests + test_jsonchecker:
- expect_failure = os.path.basename( input_path ).startswith( 'fail' )
+ expect_failure = os.path.basename(input_path).startswith('fail')
is_json_checker_test = (input_path in test_jsonchecker) or expect_failure
print('TESTING:', input_path, end=' ')
options = is_json_checker_test and '--json-checker' or ''
- pipe = os.popen( "%s%s %s %s" % (
- valgrind_path, jsontest_executable_path, options,
- input_path) )
- process_output = pipe.read()
- status = pipe.close()
+ options += ' --json-writer %s'%writerClass
+ cmd = '%s%s %s "%s"' % ( valgrind_path, jsontest_executable_path, options,
+ input_path)
+ status, process_output = getStatusOutput(cmd)
if is_json_checker_test:
if expect_failure:
- if status is None:
+ if not status:
print('FAILED')
- failed_tests.append( (input_path, 'Parsing should have failed:\n%s' %
- safeReadFile(input_path)) )
+ failed_tests.append((input_path, 'Parsing should have failed:\n%s' %
+ safeReadFile(input_path)))
else:
print('OK')
else:
- if status is not None:
+ if status:
print('FAILED')
- failed_tests.append( (input_path, 'Parsing failed:\n' + process_output) )
+ failed_tests.append((input_path, 'Parsing failed:\n' + process_output))
else:
print('OK')
else:
base_path = os.path.splitext(input_path)[0]
- actual_output = safeReadFile( base_path + '.actual' )
- actual_rewrite_output = safeReadFile( base_path + '.actual-rewrite' )
- file(base_path + '.process-output','wt').write( process_output )
+ actual_output = safeReadFile(base_path + '.actual')
+ actual_rewrite_output = safeReadFile(base_path + '.actual-rewrite')
+ open(base_path + '.process-output', 'wt', encoding = 'utf-8').write(process_output)
if status:
print('parsing failed')
- failed_tests.append( (input_path, 'Parsing failed:\n' + process_output) )
+ failed_tests.append((input_path, 'Parsing failed:\n' + process_output))
else:
expected_output_path = os.path.splitext(input_path)[0] + '.expected'
- expected_output = file( expected_output_path, 'rt' ).read()
- detail = ( compareOutputs( expected_output, actual_output, 'input' )
- or compareOutputs( expected_output, actual_rewrite_output, 'rewrite' ) )
+ expected_output = open(expected_output_path, 'rt', encoding = 'utf-8').read()
+ detail = (compareOutputs(expected_output, actual_output, 'input')
+ or compareOutputs(expected_output, actual_rewrite_output, 'rewrite'))
if detail:
print('FAILED')
- failed_tests.append( (input_path, detail) )
+ failed_tests.append((input_path, detail))
else:
print('OK')
@@ -100,15 +145,14 @@ def runAllTests( jsontest_executable_path, input_dir = None,
print(failed_test[1])
print()
print('Test results: %d passed, %d failed.' % (len(tests)-len(failed_tests),
- len(failed_tests) ))
- return 1
+ len(failed_tests)))
+ raise FailError(repr(failed_tests))
else:
print('All %d tests passed.' % len(tests))
- return 0
def main():
from optparse import OptionParser
- parser = OptionParser( usage="%prog [options] <path to jsontestrunner.exe> [test case directory]" )
+ parser = OptionParser(usage="%prog [options] <path to jsontestrunner.exe> [test case directory]")
parser.add_option("--valgrind",
action="store_true", dest="valgrind", default=False,
help="run all the tests using valgrind to detect memory leaks")
@@ -119,17 +163,29 @@ def main():
options, args = parser.parse_args()
if len(args) < 1 or len(args) > 2:
- parser.error( 'Must provides at least path to jsontestrunner executable.' )
- sys.exit( 1 )
+ parser.error('Must provides at least path to jsontestrunner executable.')
+ sys.exit(1)
- jsontest_executable_path = os.path.normpath( os.path.abspath( args[0] ) )
+ jsontest_executable_path = os.path.normpath(os.path.abspath(args[0]))
if len(args) > 1:
- input_path = os.path.normpath( os.path.abspath( args[1] ) )
+ input_path = os.path.normpath(os.path.abspath(args[1]))
else:
input_path = None
- status = runAllTests( jsontest_executable_path, input_path,
- use_valgrind=options.valgrind, with_json_checker=options.with_json_checker )
- sys.exit( status )
+ runAllTests(jsontest_executable_path, input_path,
+ use_valgrind=options.valgrind,
+ with_json_checker=options.with_json_checker,
+ writerClass='StyledWriter')
+ runAllTests(jsontest_executable_path, input_path,
+ use_valgrind=options.valgrind,
+ with_json_checker=options.with_json_checker,
+ writerClass='StyledStreamWriter')
+ runAllTests(jsontest_executable_path, input_path,
+ use_valgrind=options.valgrind,
+ with_json_checker=options.with_json_checker,
+ writerClass='BuiltStyledStreamWriter')
if __name__ == '__main__':
- main()
+ try:
+ main()
+ except FailError:
+ sys.exit(1)
diff --git a/test/rununittests.py b/test/rununittests.py
index 6279f80..6634e72 100644
--- a/test/rununittests.py
+++ b/test/rununittests.py
@@ -1,4 +1,11 @@
+# Copyright 2009 Baptiste Lepilleur and The JsonCpp Authors
+# Distributed under MIT license, or public domain if desired and
+# recognized in your jurisdiction.
+# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
from __future__ import print_function
+from __future__ import unicode_literals
+from io import open
from glob import glob
import sys
import os
@@ -9,37 +16,41 @@ import optparse
VALGRIND_CMD = 'valgrind --tool=memcheck --leak-check=yes --undef-value-errors=yes'
class TestProxy(object):
- def __init__( self, test_exe_path, use_valgrind=False ):
- self.test_exe_path = os.path.normpath( os.path.abspath( test_exe_path ) )
+ def __init__(self, test_exe_path, use_valgrind=False):
+ self.test_exe_path = os.path.normpath(os.path.abspath(test_exe_path))
self.use_valgrind = use_valgrind
- def run( self, options ):
+ def run(self, options):
if self.use_valgrind:
cmd = VALGRIND_CMD.split()
else:
cmd = []
- cmd.extend( [self.test_exe_path, '--test-auto'] + options )
- process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
+ cmd.extend([self.test_exe_path, '--test-auto'] + options)
+ try:
+ process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ except:
+ print(cmd)
+ raise
stdout = process.communicate()[0]
if process.returncode:
return False, stdout
return True, stdout
-def runAllTests( exe_path, use_valgrind=False ):
- test_proxy = TestProxy( exe_path, use_valgrind=use_valgrind )
- status, test_names = test_proxy.run( ['--list-tests'] )
+def runAllTests(exe_path, use_valgrind=False):
+ test_proxy = TestProxy(exe_path, use_valgrind=use_valgrind)
+ status, test_names = test_proxy.run(['--list-tests'])
if not status:
print("Failed to obtain unit tests list:\n" + test_names, file=sys.stderr)
return 1
- test_names = [name.strip() for name in test_names.strip().split('\n')]
+ test_names = [name.strip() for name in test_names.decode('utf-8').strip().split('\n')]
failures = []
for name in test_names:
print('TESTING %s:' % name, end=' ')
- succeed, result = test_proxy.run( ['--test', name] )
+ succeed, result = test_proxy.run(['--test', name])
if succeed:
print('OK')
else:
- failures.append( (name, result) )
+ failures.append((name, result))
print('FAILED')
failed_count = len(failures)
pass_count = len(test_names) - failed_count
@@ -47,8 +58,7 @@ def runAllTests( exe_path, use_valgrind=False ):
print()
for name, result in failures:
print(result)
- print('%d/%d tests passed (%d failure(s))' % (
- pass_count, len(test_names), failed_count))
+ print('%d/%d tests passed (%d failure(s))' % ( pass_count, len(test_names), failed_count))
return 1
else:
print('All %d tests passed' % len(test_names))
@@ -56,7 +66,7 @@ def runAllTests( exe_path, use_valgrind=False ):
def main():
from optparse import OptionParser
- parser = OptionParser( usage="%prog [options] <path to test_lib_json.exe>" )
+ parser = OptionParser(usage="%prog [options] <path to test_lib_json.exe>")
parser.add_option("--valgrind",
action="store_true", dest="valgrind", default=False,
help="run all the tests using valgrind to detect memory leaks")
@@ -64,11 +74,11 @@ def main():
options, args = parser.parse_args()
if len(args) != 1:
- parser.error( 'Must provides at least path to test_lib_json executable.' )
- sys.exit( 1 )
+ parser.error('Must provides at least path to test_lib_json executable.')
+ sys.exit(1)
- exit_code = runAllTests( args[0], use_valgrind=options.valgrind )
- sys.exit( exit_code )
+ exit_code = runAllTests(args[0], use_valgrind=options.valgrind)
+ sys.exit(exit_code)
if __name__ == '__main__':
main()