two new tests for comments and one (tiny) fix for trailing comments
This commit is contained in:
parent
447e0b1356
commit
19402fbee4
5 changed files with 20 additions and 1 deletions
10
priv/test_cases/comment_style_a.json
Normal file
10
priv/test_cases/comment_style_a.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// comment
|
||||||
|
{ // comment
|
||||||
|
"key" // comment
|
||||||
|
: // comment
|
||||||
|
[ // comment
|
||||||
|
true // comment
|
||||||
|
, // comment
|
||||||
|
false // comment
|
||||||
|
] // comment
|
||||||
|
} // comment
|
4
priv/test_cases/comment_style_a.test
Normal file
4
priv/test_cases/comment_style_a.test
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{name, "comment_style_a"}.
|
||||||
|
{jsx, [start_object,{key, <<"key">>}, start_array, {literal, true}, {literal, false}, end_array, end_object,end_json]}.
|
||||||
|
{json, "comment_style_a.json"}.
|
||||||
|
{jsx_flags, [comments]}.
|
1
priv/test_cases/comment_style_b.json
Normal file
1
priv/test_cases/comment_style_b.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/* comment */ { /* comment */ "key" /* comment */ : /* comment */ [ /* comment */ true /* comment */ , /* comment */ false /* comment */ ] /* comment */ } /* comment */
|
4
priv/test_cases/comment_style_b.test
Normal file
4
priv/test_cases/comment_style_b.test
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{name, "comment_style_a"}.
|
||||||
|
{jsx, [start_object,{key, <<"key">>}, start_array, {literal, true}, {literal, false}, end_array, end_object,end_json]}.
|
||||||
|
{json, "comment_style_a.json"}.
|
||||||
|
{jsx_flags, [comments]}.
|
|
@ -972,7 +972,7 @@ single_comment(<<?newline, Rest/binary>>, Handler, Stack, Opts) ->
|
||||||
end_comment(Rest, Handler, Stack, Opts);
|
end_comment(Rest, Handler, Stack, Opts);
|
||||||
single_comment(<<_/utf8, Rest/binary>>, Handler, Stack, Opts) ->
|
single_comment(<<_/utf8, Rest/binary>>, Handler, Stack, Opts) ->
|
||||||
single_comment(Rest, Handler, Stack, Opts);
|
single_comment(Rest, Handler, Stack, Opts);
|
||||||
single_comment(<<>>, Handler, [done], Opts) ->
|
single_comment(<<>>, Handler, [done], Opts=#opts{explicit_end=false}) ->
|
||||||
end_comment(<<>>, Handler, [done], Opts);
|
end_comment(<<>>, Handler, [done], Opts);
|
||||||
single_comment(<<>>, Handler, Stack, Opts) ->
|
single_comment(<<>>, Handler, Stack, Opts) ->
|
||||||
?incomplete(single_comment, <<>>, Handler, Stack, Opts);
|
?incomplete(single_comment, <<>>, Handler, Stack, Opts);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue