Ensure dbg module is a compile-time dependency

Related to #12892.
This commit is contained in:
José Valim
2023-08-28 13:30:46 +02:00
parent 9f984f82d2
commit bd454e286d
3 changed files with 39 additions and 2 deletions
@@ -334,6 +334,31 @@ defmodule Kernel.LexicalTrackerTest do
assert URI in runtime
end
test "dbg adds a compile dependency" do
{{compile, exports, runtime, _}, _binding} =
Code.eval_string("""
defmodule Kernel.LexicalTrackerTest.Dbg do
def foo, do: dbg(:ok)
Kernel.LexicalTracker.references(__ENV__.lexical_tracker)
end |> elem(3)
""")
assert Macro in compile
refute Macro in exports
refute Macro in runtime
{{compile, exports, runtime, _}, _binding} =
Code.eval_string("""
defmodule Kernel.LexicalTrackerTest.NoDbg do
Kernel.LexicalTracker.references(__ENV__.lexical_tracker)
end |> elem(3)
""")
refute Macro in compile
refute Macro in exports
refute Macro in runtime
end
test "imports adds an export dependency" do
{{compile, exports, runtime, _}, _binding} =
Code.eval_string("""