Skip to content

Commit f0150fc

Browse files
committed
test: avoid invalid call type warnings
1 parent d514237 commit f0150fc

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

test/chunx/chunk_test.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ defmodule Chunx.ChunkTest do
3636

3737
test "raises when text is not a binary" do
3838
assert_raise FunctionClauseError, fn ->
39-
Chunk.new(:not_a_string, 0, 10, 1)
39+
call_constructor([:not_a_string, 0, 10, 1])
4040
end
4141
end
4242
end
43+
44+
defp call_constructor(arguments), do: apply(Chunk, :new, arguments)
4345
end

test/chunx/sentence_chunk_test.exs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,16 @@ defmodule Chunx.SentenceChunkTest do
3838

3939
test "raises when text is not a binary" do
4040
assert_raise FunctionClauseError, fn ->
41-
SentenceChunk.new(:not_a_string, 0, 10, 1, [])
41+
call_constructor([:not_a_string, 0, 10, 1, []])
4242
end
4343
end
4444

4545
test "raises when sentences is not a list" do
4646
assert_raise FunctionClauseError, fn ->
47-
SentenceChunk.new("text", 0, 10, 1, "not a list")
47+
call_constructor(["text", 0, 10, 1, "not a list"])
4848
end
4949
end
5050
end
51+
52+
defp call_constructor(arguments), do: apply(SentenceChunk, :new, arguments)
5153
end

0 commit comments

Comments
 (0)