diff --git a/test/mix_unused/analyzer_test.exs b/test/mix_unused/analyzer_test.exs index 59c7051..0574eab 100644 --- a/test/mix_unused/analyzer_test.exs +++ b/test/mix_unused/analyzer_test.exs @@ -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)