Skip to content

Commit 8522823

Browse files
committed
add failing cases
1 parent 9a5e88a commit 8522823

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

test/spitfire_test.exs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2929,12 +2929,51 @@ defmodule SpitfireTest do
29292929
end
29302930

29312931
test "parses quoted kw identifiers" do
2932-
# TODO this case fails to parse
2932+
# TODO this code crashes the parser
2933+
# ** (FunctionClauseError) no function clause matching in Spitfire.peek_token/1
2934+
2935+
# The following arguments were given to Spitfire.peek_token/1:
2936+
2937+
# # 1
2938+
# %{tokens: [nil | :eot], literal_encoder: nil, errors: [{[line: 1, column: 1], "missing closing bracket for list"}, {[], "unknown token: eot"}], current_token: {:"]", nil}, fuel: 150, peek_token: nil, nesting: 0}
2939+
2940+
# Attempted function clauses (showing 7 out of 7):
2941+
2942+
# defp peek_token(%{peek_token: {:stab_op, _, token}})
2943+
# defp peek_token(%{peek_token: {type, _, _, _}}) when type === :list_heredoc or type === :bin_heredoc
2944+
# defp peek_token(%{peek_token: {token, _, _}})
2945+
# defp peek_token(%{peek_token: {token, _}})
2946+
# defp peek_token(%{peek_token: {token, _, _, _, _, _, _}})
2947+
# defp peek_token(%{peek_token: :eof})
2948+
# defp peek_token(%{tokens: :eot})
2949+
2950+
# code: assert Spitfire.parse(code, existing_atoms_only: true) == {:ok, {:__block__, [], []}}
2951+
# stacktrace:
2952+
# (spitfire 0.1.5) lib/spitfire.ex:2386: Spitfire.peek_token/1
2953+
# (spitfire 0.1.5) lib/spitfire.ex:318: anonymous fn/7 in Spitfire.parse_expression/6
2954+
# (spitfire 0.1.5) lib/spitfire/while.ex:49: Spitfire.While.do_while/2
2955+
# (spitfire 0.1.5) lib/spitfire.ex:196: anonymous fn/1 in Spitfire.parse_program/1
2956+
# (spitfire 0.1.5) lib/spitfire/while.ex:5: Spitfire.While2.recurse/3
2957+
# (spitfire 0.1.5) lib/spitfire.ex:195: Spitfire.parse_program/1
2958+
# (spitfire 0.1.5) lib/spitfire.ex:140: Spitfire.parse/2
2959+
# test/spitfire_test.exs:2936: (test)
29332960
# code = "[\"abc#{Enum.random(1..10000)}\": 1]"
29342961

29352962
# # tokenizer return error
29362963
# assert Spitfire.parse(code, existing_atoms_only: true) == {:ok, {:__block__, [], []}}
29372964

2965+
# TODO this code errors with a wrong message
2966+
# {
2967+
# :error,
2968+
# {:%{}, [{:closing, []}, {:line, 1}, {:column, 1}], [{:__block__, [error: true], []}]},
2969+
# [{[], "unknown token: eot"}, {[], "missing closing brace for map"}]
2970+
# }
2971+
2972+
# code = "%{\"abc#{Enum.random(1..10000)}\": 1}"
2973+
2974+
# # tokenizer return error
2975+
# assert Spitfire.parse(code, existing_atoms_only: true) == {:ok, {:__block__, [], []}}
2976+
29382977
code = """
29392978
["abc\#{foo}": 1]
29402979
"""

0 commit comments

Comments
 (0)