tests: Updated existing + added new test for escaping in JSON
authorLucas Bajolet <r4pass@hotmail.com>
Fri, 6 Nov 2015 20:02:27 +0000 (15:02 -0500)
committerLucas Bajolet <r4pass@hotmail.com>
Fri, 6 Nov 2015 21:33:50 +0000 (16:33 -0500)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

tests/sav/fixme/neo_doxygen_dump_args4.res [moved from tests/sav/neo_doxygen_dump_args4.res with 98% similarity]
tests/sav/fixme/neo_doxygen_dump_args5.res [moved from tests/sav/neo_doxygen_dump_args5.res with 98% similarity]
tests/sav/test_json_static.res
tests/sav/test_json_unicode.res [new file with mode: 0644]
tests/test_json_unicode.nit [new file with mode: 0644]

similarity index 98%
rename from tests/sav/neo_doxygen_dump_args4.res
rename to tests/sav/fixme/neo_doxygen_dump_args4.res
index a732359..66e13f0 100644 (file)
@@ -1457,7 +1457,7 @@ Edge
 8:MPropDef
 13:MAttributeDef
 =properties=JsonObject(5):
-{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"is_intro":true}
+{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["â\80\9cAnswer to the Ultimate Question of Life, the Universe, and Everything.","â\80\9c"],"is_intro":true}
 ----
 =to=Entity#0:
 =labels=Array(4):
@@ -1481,7 +1481,7 @@ Edge
 8:MPropDef
 13:MAttributeDef
 =properties=JsonObject(5):
-{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"is_intro":true}
+{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["â\80\9cAnswer to the Ultimate Question of Life, the Universe, and Everything.","â\80\9c"],"is_intro":true}
 ----
 =to=Entity#0:
 =labels=Array(4):
@@ -1722,7 +1722,7 @@ Edge
 8:MPropDef
 13:MAttributeDef
 =properties=JsonObject(5):
-{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"is_intro":true}
+{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["â\80\9cAnswer to the Ultimate Question of Life, the Universe, and Everything.","â\80\9c"],"is_intro":true}
 
 
 Edge
similarity index 98%
rename from tests/sav/neo_doxygen_dump_args5.res
rename to tests/sav/fixme/neo_doxygen_dump_args5.res
index 5e63fb7..33a8156 100644 (file)
@@ -1457,7 +1457,7 @@ Edge
 8:MPropDef
 13:MAttributeDef
 =properties=JsonObject(5):
-{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"is_intro":true}
+{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["â\80\9cAnswer to the Ultimate Question of Life, the Universe, and Everything.","â\80\9c"],"is_intro":true}
 ----
 =to=Entity#0:
 =labels=Array(4):
@@ -1481,7 +1481,7 @@ Edge
 8:MPropDef
 13:MAttributeDef
 =properties=JsonObject(5):
-{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"is_intro":true}
+{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["â\80\9cAnswer to the Ultimate Question of Life, the Universe, and Everything.","â\80\9c"],"is_intro":true}
 ----
 =to=Entity#0:
 =labels=Array(4):
@@ -1722,7 +1722,7 @@ Edge
 8:MPropDef
 13:MAttributeDef
 =properties=JsonObject(5):
-{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"is_intro":true}
+{"location":"%SOURCE_DIRECTORY%\/org\/example\/foo\/C.java:25,1---1,1","visibility":"public","name":"THE_ANSWER","mdoc":["â\80\9cAnswer to the Ultimate Question of Life, the Universe, and Everything.","â\80\9c"],"is_intro":true}
 
 
 Edge
index aaadfa3..7da4254 100644 (file)
Binary files a/tests/sav/test_json_static.res and b/tests/sav/test_json_static.res differ
diff --git a/tests/sav/test_json_unicode.res b/tests/sav/test_json_unicode.res
new file mode 100644 (file)
index 0000000..c0f61cc
--- /dev/null
@@ -0,0 +1,5 @@
+{
+       "beer": "test",
+       "name": "Gaëa"
+}
+
diff --git a/tests/test_json_unicode.nit b/tests/test_json_unicode.nit
new file mode 100644 (file)
index 0000000..8800f3e
--- /dev/null
@@ -0,0 +1,26 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import json
+
+var str = """{
+       "beer": "test",
+       "name": "Gaëa"
+}"""
+
+var json = str.parse_json
+
+assert json != null
+
+print json.to_pretty_json