strings returned as binaries

This commit is contained in:
alisdair sullivan 2011-10-27 23:11:26 -07:00
parent d5a91c0a06
commit 0ea61233c5
22 changed files with 86 additions and 98 deletions

View file

@ -1,8 +1,8 @@
{name, "array"}.
{jsx, [start_array,
{string,"foo"},
{string,"bar"},
{string,"baz"},
{string,<<"foo">>},
{string,<<"bar">>},
{string,<<"baz">>},
start_array,
{literal,true},
end_array,start_array,
@ -15,14 +15,14 @@
{literal,null},
{float,0.7},
start_object,
{key,"key"},
{string,"value"},
{key,<<"key">>},
{string,<<"value">>},
end_object,start_array,start_object,end_object,
{literal,null},
{literal,null},
{literal,null},
start_array,end_array,end_array,
{string,"\n\r\\"},
{string,<<"\n\r\\">>},
start_array,
{integer,-1},
end_array,end_array,end_json]}.

View file

@ -1,4 +1,4 @@
{name, "bad_low_surrogate_replaced"}.
{jsx, [start_array,{string, [16#fffd, 16#fffd]},end_array,end_json]}.
{jsx, [start_array,{string, <<16#fffd/utf8, 16#fffd/utf8>>},end_array,end_json]}.
{json, "bad_low_surrogate_replaced.json"}.
{jsx_flags, [loose_unicode]}.

View file

@ -1,3 +1,3 @@
{name, "encoded_surrogates"}.
{jsx, [start_array,{string,[66560]},end_array,end_json]}.
{jsx, [start_array,{string,<<66560/utf8>>},end_array,end_json]}.
{json, "encoded_surrogates.json"}.

View file

@ -1,4 +1,4 @@
{name, "escaped noncharacter (extended)"}.
{jsx, [{string, [16#fffd]}, end_json]}.
{jsx, [{string, <<16#fffd/utf8>>}, end_json]}.
{json, "escaped_noncharacter_ext.json"}.
{jsx_flags, [loose_unicode]}.

View file

@ -1,4 +1,4 @@
{name, "escaped noncharacter replacement"}.
{jsx, [{string,[16#fffd]},end_json]}.
{jsx, [{string,<<16#fffd/utf8>>},end_json]}.
{json, "escaped_noncharacter_replaced.json"}.
{jsx_flags, [loose_unicode]}.

View file

@ -1,4 +1,4 @@
{name, "escaped nullbyte replaced"}.
{jsx, [{string,[16#fffd]},end_json]}.
{jsx, [{string,<<16#fffd/utf8>>},end_json]}.
{json, "escaped_nullbyte_replaced.json"}.
{jsx_flags, [loose_unicode]}.

View file

@ -4,9 +4,9 @@
end_array,
{float,2.0e7},
start_object,
{key,"key"},
{key,<<"key">>},
{float,2.0e7},
{key,"another key"},
{key,<<"another key">>},
{float,2.0e7},
end_object,
{float,4.2e70},

View file

@ -4,14 +4,14 @@
end_array,
{float,2.0},
start_object,
{key,"key"},
{key,<<"key">>},
{float,2.0e7},
{key,"another key"},
{key,<<"another key">>},
{float,2.0e7},
end_object,start_object,
{key,"key"},
{key,<<"key">>},
{float,2.0},
{key,"another key"},
{key,<<"another key">>},
{float,2.0},
end_object,
{float,4.321},

View file

@ -4,9 +4,9 @@
end_array,
{integer,20},
start_object,
{key,"key"},
{key,<<"key">>},
{integer,20},
{key,"another key"},
{key,<<"another key">>},
{integer,20},
end_object,
{integer,42},

View file

@ -1,3 +1,3 @@
{name, "multibyte_utf"}.
{jsx, [start_array,{string,[32,119070,32]},end_array,end_json]}.
{jsx, [start_array,{string,<<32,119070/utf8,32>>},end_array,end_json]}.
{json, "multibyte_utf.json"}.

View file

@ -1,3 +1,3 @@
{name, "naked_string"}.
{jsx, [{string,"this is a naked string"},end_json]}.
{jsx, [{string,<<"this is a naked string">>},end_json]}.
{json, "naked_string.json"}.

View file

@ -4,9 +4,9 @@
end_array,
{integer,0},
start_object,
{key,"key"},
{key,<<"key">>},
{integer,0},
{key,"another key"},
{key,<<"another key">>},
{integer,0},
end_object,
{integer,0},

View file

@ -1,4 +1,4 @@
{name, "noncharacter replaced"}.
{jsx, [{string,[16#fffd]},end_json]}.
{jsx, [{string,<<16#fffd/utf8>>},end_json]}.
{json, "noncharacter_replaced.json"}.
{jsx_flags, [loose_unicode]}.

View file

@ -1,4 +1,4 @@
{name, "nullbyte replaced"}.
{jsx, [{string,[16#fffd]},end_json]}.
{jsx, [{string,<<16#fffd/utf8>>},end_json]}.
{json, "nullbyte_replaced.json"}.
{jsx_flags, [loose_unicode]}.

View file

@ -1,22 +1,22 @@
{name, "object"}.
{jsx, [start_object,
{key,"foo"},
{string,"bar"},
{key,"baz"},
{key,<<"foo">>},
{string,<<"bar">>},
{key,<<"baz">>},
{literal,true},
{key,"false"},
{key,<<"false">>},
{literal,null},
{key,"object"},
{key,<<"object">>},
start_object,
{key,"key"},
{string,"value"},
{key,<<"key">>},
{string,<<"value">>},
end_object,
{key,"list"},
{key,<<"list">>},
start_array,
{literal,null},
{literal,null},
{literal,null},
start_array,end_array,
{string,"\n\r\\"},
{string,<<"\n\r\\">>},
end_array,end_object,end_json]}.
{json, "object.json"}.

View file

@ -1,5 +1,5 @@
{name, "string"}.
{jsx, [start_array,
{string,"this is a random string with \n embedded escapes in it"},
{string,<<"this is a random string with \n embedded escapes in it">>},
end_array,end_json]}.
{json, "string.json"}.

View file

@ -1,12 +1,12 @@
{name, "string_escapes"}.
{jsx, [start_array,
{string,"\""},
{string,"\\"},
{string,"/"},
{string,"\b"},
{string,"\f"},
{string,"\n"},
{string,"\r"},
{string,"\t"},
{string,<<"\"">>},
{string,<<"\\">>},
{string,<<"/">>},
{string,<<"\b">>},
{string,<<"\f">>},
{string,<<"\n">>},
{string,<<"\r">>},
{string,<<"\t">>},
end_array,end_json]}.
{json, "string_escapes.json"}.

View file

@ -1,6 +1,6 @@
{name, "unicode_to_codepoint"}.
{jsx, [start_array,
{string,"arabic letter alef: "},
{string,[1575]},
{string,<<"arabic letter alef: ">>},
{string,<<1575/utf8>>},
end_array,end_json]}.
{json, "unicode_to_codepoint.json"}.

View file

@ -1,4 +1,4 @@
{name, "unpaired surrogate replaced"}.
{jsx, [start_array,{string,[65533,$b,$l,$a,$h]},end_array,end_json]}.
{jsx, [start_array,{string,<<65533/utf8,$b,$l,$a,$h>>},end_array,end_json]}.
{json, "unpaired_surrogate_replaced.json"}.
{jsx_flags, [loose_unicode]}.

View file

@ -4,9 +4,9 @@
end_array,
{integer,0},
start_object,
{key,"key"},
{key,<<"key">>},
{integer,0},
{key,"another key"},
{key,<<"another key">>},
{integer,0},
end_object,
{integer,0},