couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [05/12] Replace ejson with jiffy
Date Mon, 23 Dec 2013 23:31:14 GMT
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().
+


Mime
View raw message