Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 07F70100DB for ; Mon, 23 Dec 2013 23:31:12 +0000 (UTC) Received: (qmail 44166 invoked by uid 500); 23 Dec 2013 23:31:10 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 44095 invoked by uid 500); 23 Dec 2013 23:31:10 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 43719 invoked by uid 99); 23 Dec 2013 23:31:10 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Dec 2013 23:31:10 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 34AF088FA7E; Mon, 23 Dec 2013 23:31:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rnewson@apache.org To: commits@couchdb.apache.org Date: Mon, 23 Dec 2013 23:31:14 -0000 Message-Id: In-Reply-To: <18dc336ee41843b89816808eee5e5e1b@git.apache.org> References: <18dc336ee41843b89816808eee5e5e1b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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(). +