From 5c96222cbf2dcd10c9a1d87c0a96ffc86d467f50 Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Tue, 12 Feb 2013 12:06:45 -0800 Subject: [PATCH] add additional comment tests --- src/jsx_decoder.erl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/jsx_decoder.erl b/src/jsx_decoder.erl index 9d452dd..38a2493 100644 --- a/src/jsx_decoder.erl +++ b/src/jsx_decoder.erl @@ -1423,6 +1423,22 @@ comments_test_() -> {"/**/ comment terminating exp", ?_assertEqual( decode(<<"[ 1e1/* comment */ ]">>, [comments]), [start_array, {float, 1.0e1}, end_array, end_json] + )}, + {"/**/ comment following /**/ comment", ?_assertEqual( + decode(<<"[/* comment *//* comment */true]">>, [comments]), + [start_array, {literal, true}, end_array, end_json] + )}, + {"/**/ comment following // comment", ?_assertEqual( + decode(<<"[// comment", ?newline, "/* comment */true]">>, [comments]), + [start_array, {literal, true}, end_array, end_json] + )}, + {"// comment following /**/ comment", ?_assertEqual( + decode(<<"[/* comment */// comment", ?newline, "true]">>, [comments]), + [start_array, {literal, true}, end_array, end_json] + )}, + {"// comment following // comment", ?_assertEqual( + decode(<<"[// comment", ?newline, "// comment", ?newline, "true]">>, [comments]), + [start_array, {literal, true}, end_array, end_json] )} ].