Hi again,
Added some more simple tests to file 't/compilers/json/to_parrot.t'
related to backslashing testing. All the new tests pass. Attached to
this message you can find the patch file.
Best regards,
./smash
Index: t/compilers/json/to_parrot.t
===================================================================
--- t/compilers/json/to_parrot.t (revision 14622)
+++ t/compilers/json/to_parrot.t (working copy)
@@ -6,7 +6,7 @@
use lib qw( t . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 52;
+use Parrot::Test tests => 60;
=head1 NAME
@@ -34,6 +34,56 @@
"JSON" => "json"
OUT
+json_isnt('a', 'strings need quotes');
+
+json_dump_is(<<'JSON', <<'OUT', 'string with backslash "');
+"\"json\""
+JSON
+"JSON" => "\"json\""
+OUT
+
+json_dump_is(<<'JSON', <<'OUT', 'string with backslash \\');
+"\\json\\"
+JSON
+"JSON" => "\\json\\"
+OUT
+
+json_dump_is(<<'JSON', <<'OUT', 'string with backslash /',todo=>'parse error');
+"\/json\/"
+JSON
+"JSON" => "\/json\/"
+OUT
+
+json_dump_is(<<'JSON', <<'OUT', 'string with backslash b');
+"\bjson\b"
+JSON
+"JSON" => "\bjson\b"
+OUT
+
+json_dump_is(<<'JSON', <<'OUT', 'string with backslash f');
+"\fjson\f"
+JSON
+"JSON" => "\fjson\f"
+OUT
+
+json_dump_is(<<'JSON', <<'OUT', 'string with backslash n');
+"\njson\n"
+JSON
+"JSON" => "\njson\n"
+OUT
+
+json_dump_is(<<'JSON', <<'OUT', 'string with backslash r');
+"\rjson\r"
+JSON
+"JSON" => "\rjson\r"
+OUT
+
+json_dump_is(<<'JSON', <<'OUT', 'string with backslash t');
+"\tjson\t"
+JSON
+"JSON" => "\tjson\t"
+OUT
+
json_dump_is(<<'JSON', <<'OUT', 'number int');
1
JSON
@@ -628,7 +678,6 @@
]
OUT
-json_isnt('a', 'strings need quotes');
# XXX Need many more tests, exercising all aspects of http://www.json.org/