You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2013/12/24 00:31:14 UTC
[05/12] Replace ejson with jiffy
http://git-wip-us.apache.org/repos/asf/couchdb/blob/2e6092e4/src/jiffy/test/006-maps.t
----------------------------------------------------------------------
diff --git a/src/jiffy/test/006-maps.t b/src/jiffy/test/006-maps.t
new file mode 100755
index 0000000..45e715c
--- /dev/null
+++ b/src/jiffy/test/006-maps.t
@@ -0,0 +1,36 @@
+#! /usr/bin/env escript
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+main([]) ->
+ code:add_pathz("ebin"),
+ code:add_pathz("test"),
+
+ etap:plan(15),
+ util:test_good(good()),
+ util:test_errors(errors()),
+ etap:end_tests().
+
+good() ->
+ [
+ {<<"{}">>, {[]}},
+ {<<"{\"foo\": \"bar\"}">>,
+ {[{<<"foo">>, <<"bar">>}]},
+ <<"{\"foo\":\"bar\"}">>},
+ {<<"\n\n{\"foo\":\r \"bar\",\n \"baz\"\t: 123 }">>,
+ {[{<<"foo">>, <<"bar">>}, {<<"baz">>, 123}]},
+ <<"{\"foo\":\"bar\",\"baz\":123}">>}
+ ].
+
+errors() ->
+ [
+ <<"{">>,
+ <<"{,}">>,
+ <<"{123:true}">>,
+ <<"{false:123}">>,
+ <<"{:\"stuff\"}">>,
+ <<"{\"key\":}">>,
+ <<"{\"key\": 123">>,
+ <<"{\"key\": 123 true">>,
+ <<"{\"key\": 123,}">>
+ ].
http://git-wip-us.apache.org/repos/asf/couchdb/blob/2e6092e4/src/jiffy/test/007-compound.t
----------------------------------------------------------------------
diff --git a/src/jiffy/test/007-compound.t b/src/jiffy/test/007-compound.t
new file mode 100755
index 0000000..2770971
--- /dev/null
+++ b/src/jiffy/test/007-compound.t
@@ -0,0 +1,41 @@
+#! /usr/bin/env escript
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+main([]) ->
+ code:add_pathz("ebin"),
+ code:add_pathz("test"),
+
+ etap:plan(12),
+ util:test_good(good()),
+ util:test_errors(errors()),
+ etap:end_tests().
+
+good() ->
+ [
+ {<<"[{}]">>, [{[]}]},
+ {<<"{\"foo\":[123]}">>, {[{<<"foo">>, [123]}]}},
+ {<<"{\"foo\":{\"bar\":true}}">>,
+ {[{<<"foo">>, {[{<<"bar">>, true}]} }]} },
+ {<<"{\"foo\":[],\"bar\":{\"baz\":true},\"alice\":\"bob\"}">>,
+ {[
+ {<<"foo">>, []},
+ {<<"bar">>, {[{<<"baz">>, true}]}},
+ {<<"alice">>, <<"bob">>}
+ ]}
+ },
+ {<<"[-123,\"foo\",{\"bar\":[]},null]">>,
+ [
+ -123,
+ <<"foo">>,
+ {[{<<"bar">>, []}]},
+ null
+ ]
+ }
+ ].
+
+errors() ->
+ [
+ <<"[{}">>,
+ <<"}]">>
+ ].
http://git-wip-us.apache.org/repos/asf/couchdb/blob/2e6092e4/src/jiffy/test/008-halfword.t
----------------------------------------------------------------------
diff --git a/src/jiffy/test/008-halfword.t b/src/jiffy/test/008-halfword.t
new file mode 100755
index 0000000..56f0439
--- /dev/null
+++ b/src/jiffy/test/008-halfword.t
@@ -0,0 +1,15 @@
+#! /usr/bin/env escript
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+main([]) ->
+ code:add_pathz("ebin"),
+ code:add_pathz("test"),
+
+ etap:plan(unknown),
+
+ etap:is(jiffy:decode(<<"1">>) =:= 1, true, "1 =:= 1"),
+ etap:is(jiffy:decode(<<"1">>) == 1, true, "1 == 1"),
+
+ etap:end_tests().
+