Skip to content

Commit

Permalink
More coverage around source on parallel compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Dec 22, 2024
1 parent 182e4b5 commit 4b262d8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/elixir/test/elixir/kernel/parallel_compiler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,31 @@ defmodule Kernel.ParallelCompilerTest do
end)
end

test "gets both source and file on @file annotations" do
File.mkdir_p!(tmp_path())

[a] =
write_tmp(
"file_source",
a: """
defmodule FileAttr do
@file "unknown.foo.bar"
def fun, do: (unused = :ok)
end
"""
)

capture_io(:stderr, fn ->
assert {:ok, [FileAttr], %{compile_warnings: [%{source: ^a, file: file, message: _}]}} =
compile([a])

assert String.ends_with?(file, "unknown.foo.bar")
assert Path.type(file) == :absolute
end)
after
purge([FileAttr])
end

test "gets correct line number for UndefinedFunctionError" do
File.mkdir_p!(tmp_path())

Expand Down

0 comments on commit 4b262d8

Please sign in to comment.