@@ -322,6 +322,55 @@ defmodule Mix.Tasks.Compile.ElixirTest do
322322 :elixir_config . put ( :initial_dbg_callback , { Macro , :dbg , [ ] } )
323323 end
324324
325+ test "recompiles files on debug_info flag" do
326+ in_fixture ( "no_mixfile" , fn ->
327+ Mix.Project . push ( MixTest.Case.Sample )
328+
329+ File . write! ( "lib/a.ex" , """
330+ defmodule DebugInfo.A do
331+ def run, do: :ok
332+ end
333+ """ )
334+
335+ File . write! ( "lib/b.ex" , """
336+ defmodule DebugInfo.B do
337+ def run, do: DebugInfo.A.run()
338+ end
339+ """ )
340+
341+ File . write! ( "lib/c.ex" , """
342+ defmodule DebugInfo.C do
343+ @compile_time_value DebugInfo.A.run()
344+ def compile_time_value, do: @compile_time_value
345+ def run, do: DebugInfo.B.run()
346+ end
347+ """ )
348+
349+ assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :ok , [ ] }
350+ assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
351+ assert_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
352+ assert_received { :mix_shell , :info , [ "Compiled lib/c.ex" ] }
353+
354+ assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" , "--no-debug-info" ] ) == { :ok , [ ] }
355+ assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
356+ assert_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
357+ assert_received { :mix_shell , :info , [ "Compiled lib/c.ex" ] }
358+
359+ assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" , "--no-debug-info" ] ) == { :noop , [ ] }
360+
361+ File . write! ( "lib/a.ex" , """
362+ defmodule DebugInfo.A do
363+ def run, do: :error
364+ end
365+ """ )
366+
367+ assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" , "--no-debug-info" ] ) == { :ok , [ ] }
368+ assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
369+ refute_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
370+ assert_received { :mix_shell , :info , [ "Compiled lib/c.ex" ] }
371+ end )
372+ end
373+
325374 test "recompiles files when config changes export dependencies" do
326375 in_fixture ( "no_mixfile" , fn ->
327376 Mix.Project . push ( MixTest.Case.Sample )
0 commit comments