Hi again,

Haded some more tests to check for white spaces problems. Some tests
fail to parse and so are marked todo. Attached to this message is the
patch for the file 't/compilers/json/to_parrot.t'.

Best regards,
./smash

On 9/7/06, Nuno Carvalho <[EMAIL PROTECTED]> wrote:
Hi all,

 I haded some more tests to t/compilers/json/to_parrot.t file to test
some objects/array combinations. All tests pass at this point, except
for tests:

#17 - something about null value in a array
#25 - just added that random sequence, it does not parse not quite sure why.

Attached to this message you have the patch for file:
t/compilers/json/to_parrot.t

Best regards,
./smash

On 9/7/06, via RT Will Coleda <[EMAIL PROTECTED]> wrote:
> # New Ticket Created by  Will Coleda
> # Please include the string:  [perl #40292]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40292 >
>
>
> There is now a "JSON" compiler: perldoc compilers/json/JSON.pir
>
> We need more tests (t/compilers/json/to_parrot.t) that test the
> _dumper() output of a PMC generated by converting from a JSON string.
>
> E.g.:
>
> ""
>
> Would convert to an empty string, which would then be dumped as:
>
> "JSON" => ""
>
> See http://www.json.org/ for a description of the JSON grammar: all
> elements of that grammar should be tested.
>
> For failing tests, TODO them, and I'll be happy to fix the compiler.
> Unless you beat me to it, which is fine.
>
> As of the opening of this ticket, expect arrays and objects to fail
> (need TGE support), true/false/null to work, and strings & numbers to
> partially work.
>
> Regards.
>
> --
> Will "Coke" Coleda
> [EMAIL PROTECTED]
>
>
>



Index: t/compilers/json/to_parrot.t
===================================================================
--- t/compilers/json/to_parrot.t	(revision 14493)
+++ 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 => 35;
+use Parrot::Test tests => 41;
 
 =head1 NAME
 
@@ -81,6 +81,17 @@
 ]
 OUT
 
+json_dump_is(<<'JSON', <<'OUT', 'simple array (check white spaces)',todo=>'parse error');
+[    1 , 2    ,  3   ]
+JSON
+"JSON" => ResizablePMCArray (size:3) [
+    1,
+    2,
+    3
+]
+OUT
+
+
 json_dump_is(<<'JSON', <<'OUT', 'array of empty arrays');
 [[],[],[]]
 JSON
@@ -94,6 +105,20 @@
 ]
 OUT
 
+json_dump_is(<<'JSON', <<'OUT', 'array of empty arrays (check white spaces)');
+[    []  ,  [] , []     ]
+JSON
+"JSON" => ResizablePMCArray (size:3) [
+    ResizablePMCArray (size:0) [
+    ],
+    ResizablePMCArray (size:0) [
+    ],
+    ResizablePMCArray (size:0) [
+    ]
+]
+OUT
+
+
 json_dump_is(<<'JSON', <<'OUT', 'array of arrays of integers');
 [[1,2,3],[1,2,3],[1,2,3]]
 JSON
@@ -149,6 +174,19 @@
 ]
 OUT
 
+json_dump_is(<<'JSON', <<'OUT', 'array of empty objects (check white spaces)');
+[    {} , {}  , {}    ]
+JSON
+"JSON" => ResizablePMCArray (size:3) [
+    Hash {
+    },
+    Hash {
+    },
+    Hash {
+    }
+]
+OUT
+
 json_dump_is(<<'JSON', <<'OUT', 'array of objects with one element');
 [{"one":1},{"two":2},{"three":3}]
 JSON
@@ -165,6 +203,23 @@
 ]
 OUT
 
+json_dump_is(<<'JSON', <<'OUT', 'array of objects with one element (white space check)');
+[  { "one"  : 1 }  , {    "two"    :  2 } , {"three"  : 3} ]
+JSON
+"JSON" => ResizablePMCArray (size:3) [
+    Hash {
+        "one" => 1
+    },
+    Hash {
+        "two" => 2
+    },
+    Hash {
+        "three" => 3
+    }
+]
+OUT
+
+
 json_dump_is(<<'JSON', <<'OUT', 'array of objects with multiple elements');
 [{"one":1,"two":2,"three":3},{"one":1,"two":2,"three":3},{"one":1,"two":2,"three":3}]
 JSON
@@ -233,6 +288,17 @@
 }
 OUT
 
+json_dump_is(<<'JSON', <<'OUT', 'object with strings (white space check)',todo=>'parse error');
+{  "one" : "string a"    ,   "two"  :  "string b" , "three"   : "string c"    }
+JSON
+"JSON" => Hash {
+    "one" => "string a",
+    "three" => "string c",
+    "two" => "string b"
+}
+OUT
+
+
 json_dump_is(<<'JSON', <<'OUT', 'object with one empty object');
 {"one":{}}
 JSON
@@ -276,6 +342,19 @@
 }
 OUT
 
+json_dump_is(<<'JSON', <<'OUT', 'object with one object of various element with strings (check white spaces)',todo=>'parse error');
+{   "one" :  { "one" :   "string a" , "two"  : "string b"  ,  "three" :  "string c"   }    }
+JSON
+"JSON" => Hash {
+    "one" => Hash {
+        "one" => "string a",
+        "three" => "string c",
+        "two" => "string b"
+    }
+}
+OUT
+
+
 json_dump_is(<<'JSON', <<'OUT', 'object with more than one empty object');
 {"one":{},"two":{},"three":{}}
 JSON

Reply via email to