Skip to content

Commit 4b262d8

Browse files
committed
More coverage around source on parallel compiler
1 parent 182e4b5 commit 4b262d8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

lib/elixir/test/elixir/kernel/parallel_compiler_test.exs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,31 @@ defmodule Kernel.ParallelCompilerTest do
515515
end)
516516
end
517517

518+
test "gets both source and file on @file annotations" do
519+
File.mkdir_p!(tmp_path())
520+
521+
[a] =
522+
write_tmp(
523+
"file_source",
524+
a: """
525+
defmodule FileAttr do
526+
@file "unknown.foo.bar"
527+
def fun, do: (unused = :ok)
528+
end
529+
"""
530+
)
531+
532+
capture_io(:stderr, fn ->
533+
assert {:ok, [FileAttr], %{compile_warnings: [%{source: ^a, file: file, message: _}]}} =
534+
compile([a])
535+
536+
assert String.ends_with?(file, "unknown.foo.bar")
537+
assert Path.type(file) == :absolute
538+
end)
539+
after
540+
purge([FileAttr])
541+
end
542+
518543
test "gets correct line number for UndefinedFunctionError" do
519544
File.mkdir_p!(tmp_path())
520545

0 commit comments

Comments
 (0)