Skip to content

Commit

Permalink
[test] JSON use new API, add to_parrot_2.t
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerd Pokorra authored and Reini Urban committed Oct 21, 2014
1 parent 303a4e4 commit b3c268a
Show file tree
Hide file tree
Showing 3 changed files with 736 additions and 11 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,7 @@ t/codingstd/tabs.t [test]
t/codingstd/trailing_space.t [test]
t/compilers/data_json/from_parrot.t [test]
t/compilers/data_json/to_parrot.t [test]
t/compilers/data_json/to_parrot_2.t [test]
t/compilers/imcc/reg/alloc.t [test]
t/compilers/imcc/reg/spill.t [test]
t/compilers/imcc/reg/spill_old.t [test]
Expand Down
18 changes: 7 additions & 11 deletions t/compilers/data_json/to_parrot.t
Original file line number Diff line number Diff line change
Expand Up @@ -707,13 +707,11 @@ sub json_dump_is {
return pir_output_is( <<"END_PIR", $dumped, $reason, %args );
.sub test :main
load_language 'data_json'
load_language 'JSON'
load_bytecode 'dumper.pbc'
.local pmc JSON, eval, result
JSON = compreg 'data_json'
eval = JSON.'compile'("$code")
result = eval()
.local pmc result
result = from_json("$code")
_dumper(result, "JSON")
.end
END_PIR
Expand All @@ -726,16 +724,14 @@ sub json_isnt {
$code =~ s{("|\\)}{\\$1}g;
$code =~ s{\n}{\\n}g;

return pir_error_output_like( <<"END_PIR", qr/not a valid JSON value/, $reason, %args );
return pir_error_output_like( <<"END_PIR", qr/Unable to parse source/, $reason, %args );
.sub test :main
load_language 'data_json'
load_language 'JSON'
.local pmc JSON, eval, result
.local pmc result
JSON = compreg 'data_json'
eval = JSON.'compile'("$code")
result = eval()
result = from_json("$code")
.end
END_PIR

Expand Down
Loading

0 comments on commit b3c268a

Please sign in to comment.