Skip to content

Commit b169652

Browse files
committed
Add test cases from #32
1 parent 987eb6e commit b169652

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/spitfire_test.exs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2847,6 +2847,31 @@ defmodule SpitfireTest do
28472847
]
28482848
}} = Spitfire.container_cursor_to_quoted(code)
28492849
end
2850+
2851+
test "incomplete keyword list" do
2852+
code = "[foo: ]"
2853+
2854+
assert Spitfire.parse(code) ==
2855+
{:error, [{:foo, {:__block__, [error: true, line: 1, column: 7], []}}],
2856+
[{[line: 1, column: 7], "unknown token: ]"}, {[line: 1, column: 1], "missing closing bracket for list"}]}
2857+
end
2858+
2859+
test "incomplete keyword list in module attr" do
2860+
code = """
2861+
@tag foo: bar,
2862+
foo
2863+
"""
2864+
2865+
assert Spitfire.parse(code) ==
2866+
{
2867+
:ok,
2868+
{:@, [end_of_expression: [newlines: 1, line: 2, column: 6], line: 1, column: 1],
2869+
[
2870+
{:tag, [line: 1, column: 2],
2871+
[[{:foo, {:bar, [line: 1, column: 11], nil}}, {:foo, [line: 2, column: 3], nil}]]}
2872+
]}
2873+
}
2874+
end
28502875
end
28512876

28522877
defp s2q(code, opts \\ []) do

0 commit comments

Comments
 (0)