From bef362ac0ebbbf35ded6ec7671d8b75fdbac2f5a Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Fri, 8 Feb 2013 21:44:15 -0800 Subject: [PATCH] include literals in compound list test --- src/jsx_tests.hrl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/jsx_tests.hrl b/src/jsx_tests.hrl index 776aff4..715ce47 100644 --- a/src/jsx_tests.hrl +++ b/src/jsx_tests.hrl @@ -68,7 +68,8 @@ naked_literals() -> literals() -> [ wrap_with_array(Test) || Test <- naked_literals() ] - ++ [ wrap_with_object(Test) || Test <- naked_literals() ]. + ++ [ wrap_with_object(Test) || Test <- naked_literals() ] + ++ [listify("array of literals", naked_literals())]. wrap_with_array({Title, JSON, Term, Events}) -> @@ -93,11 +94,11 @@ repeat(_, Test, 0) -> Test; repeat(Fun, Test, Times) -> repeat(Fun, Fun(Test), Times - 1). -listify(Title, Tests) -> listify(Title, Tests, Acc). +listify(Title, [{_, JSON, Term, Events}|Rest]) -> listify(Title, Rest, {Title, JSON, [Term], Events}). listify(Title, [], {_, JSON, Term, Events}) -> {Title, <<"["/utf8, JSON/binary, "]"/utf8>>, Term, Events}; listify(Title, [Test|Rest], Acc) -> - {_, A, M, X} = Test, - {_, B, N, Y} = Acc, - {Title, <>, M ++ N, X ++ Y}. + {_, A, M, X} = Acc, + {_, B, N, Y} = Test, + listify(Title, Rest, {Title, <>, M ++ [N], X ++ Y}).