Skip to content

Commit cd90daa

Browse files
committed
refactor(test): use shared assertion macros in spitfire_test
Replace remaining manual parse-vs-quoted assertions in regression cases with assert_conforms/1, and convert the fn-delimiter error regression checks to assert_errors/1. This keeps spitfire_test aligned with the shared Spitfire.Assertions helpers and reduces duplicated assertion boilerplate. Manual testing: - mix format - mix test (property-test failures in Spitfire.CharPropertyTest are known)
1 parent 622e514 commit cd90daa

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

test/spitfire_test.exs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule SpitfireTest do
22
use ExUnit.Case, async: true
33

4-
import Spitfire.Assertions, only: [assert_conforms: 1, s2q: 1, s2q: 2]
4+
import Spitfire.Assertions, only: [assert_conforms: 1, assert_errors: 1, s2q: 1, s2q: 2]
55

66
doctest Spitfire
77

@@ -2135,8 +2135,8 @@ defmodule SpitfireTest do
21352135
assert_conforms("%{s\\\\r => 1}")
21362136

21372137
# Fn args with semicolon/newline trivia
2138-
assert Spitfire.parse("fn ;\n -> :ok end") == s2q("fn ;\n -> :ok end")
2139-
assert Spitfire.parse("fn ; -> :ok end") == s2q("fn ; -> :ok end")
2138+
assert_conforms("fn ;\n -> :ok end")
2139+
assert_conforms("fn ; -> :ok end")
21402140

21412141
# Struct type with dot-call target
21422142
assert_conforms("%e.(){}")
@@ -2187,10 +2187,10 @@ defmodule SpitfireTest do
21872187

21882188
# https://github.com/elixir-lang/expert/issues/461
21892189
test "fn -> followed by closing delimiter does not hang" do
2190-
assert {:error, _ast, _errors} = Spitfire.parse("fn ->)")
2191-
assert {:error, _ast, _errors} = Spitfire.parse("fn ->")
2192-
assert {:error, _ast, _errors} = Spitfire.parse("Enum.map(fn ->)")
2193-
assert {:error, _ast, _errors} = Spitfire.parse("fn ->\n)")
2190+
assert_errors("fn ->)")
2191+
assert_errors("fn ->")
2192+
assert_errors("Enum.map(fn ->)")
2193+
assert_errors("fn ->\n)")
21942194
end
21952195

21962196
test "missing bitstring brackets" do

0 commit comments

Comments
 (0)