From: Lucas Bajolet Date: Fri, 6 Nov 2015 20:02:27 +0000 (-0500) Subject: tests: Updated existing + added new test for escaping in JSON X-Git-Tag: v0.8~105^2 X-Git-Url: http://nitlanguage.org?hp=c992f9ef874161634e24430016131dc136d42fa1 tests: Updated existing + added new test for escaping in JSON Signed-off-by: Lucas Bajolet --- diff --git a/tests/sav/neo_doxygen_dump_args4.res b/tests/sav/fixme/neo_doxygen_dump_args4.res 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 --- a/tests/sav/neo_doxygen_dump_args4.res +++ b/tests/sav/fixme/neo_doxygen_dump_args4.res @@ -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":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"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":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"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":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"is_intro":true} Edge diff --git a/tests/sav/neo_doxygen_dump_args5.res b/tests/sav/fixme/neo_doxygen_dump_args5.res 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 --- a/tests/sav/neo_doxygen_dump_args5.res +++ b/tests/sav/fixme/neo_doxygen_dump_args5.res @@ -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":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"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":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"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":["“Answer to the Ultimate Question of Life, the Universe, and Everything.","“"],"is_intro":true} Edge diff --git a/tests/sav/test_json_static.res b/tests/sav/test_json_static.res index aaadfa3..7da4254 100644 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 index 0000000..c0f61cc --- /dev/null +++ b/tests/sav/test_json_unicode.res @@ -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 index 0000000..8800f3e --- /dev/null +++ b/tests/test_json_unicode.nit @@ -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