Add MixUnused.Analyzer test for app: nil branch
This commit is contained in:
parent
4560dc0c6f
commit
2b1a06a6cd
1 changed files with 15 additions and 0 deletions
|
|
@ -104,6 +104,21 @@ defmodule MixUnused.AnalyzerTest do
|
|||
assert result == []
|
||||
end
|
||||
|
||||
test ":app=nil hits in_app?(_, nil) → true (no filtering)" do
|
||||
# When app is nil, in_app? returns true for every module — so the
|
||||
# analyzer scans everything in the compile path, not just the project.
|
||||
# This exercises line 86 (defp in_app?(_module, nil), do: true).
|
||||
tmp = Path.join(System.tmp_dir!(), "mu_app_nil_#{System.unique_integer([:positive])}")
|
||||
File.mkdir_p!(tmp)
|
||||
|
||||
try do
|
||||
result = Analyzer.analyze(app: nil, compile_path: tmp)
|
||||
assert result == []
|
||||
after
|
||||
File.rm_rf(tmp)
|
||||
end
|
||||
end
|
||||
|
||||
test "honors :compile_path option pointing to an empty directory" do
|
||||
tmp = Path.join(System.tmp_dir!(), "mu_empty_#{System.unique_integer([:positive])}")
|
||||
File.mkdir_p!(tmp)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue