@@ -278,11 +278,9 @@ defmodule Mix.Tasks.Compile.ElixirTest do
278278 assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
279279 assert_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
280280
281- # Simulate a config change by updating both dbg_callback and initial_dbg_callback.
282- # This represents the case where the user actually changed the config file.
281+ # Change the dbg_callback at runtime
283282 File . touch! ( "_build/dev/lib/sample/.mix/compile.elixir" , @ old_time )
284283 Application . put_env ( :elixir , :dbg_callback , { __MODULE__ , :dbg , [ ] } )
285- :elixir_config . put ( :initial_dbg_callback , { __MODULE__ , :dbg , [ ] } )
286284
287285 assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :ok , [ ] }
288286 assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
@@ -291,35 +289,6 @@ defmodule Mix.Tasks.Compile.ElixirTest do
291289 end )
292290 after
293291 Application . put_env ( :elixir , :dbg_callback , { Macro , :dbg , [ ] } )
294- :elixir_config . put ( :initial_dbg_callback , { Macro , :dbg , [ ] } )
295- end
296-
297- test "does not recompile when dbg_callback is modified at runtime but initial is unchanged" do
298- in_fixture ( "no_mixfile" , fn ->
299- Mix.Project . push ( MixTest.Case.Sample )
300-
301- File . write! ( "lib/a.ex" , """
302- defmodule A do
303- def a, do: dbg(:ok)
304- end
305- """ )
306-
307- assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :ok , [ ] }
308- assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
309-
310- # Simulate a tool like Kino modifying dbg_callback at runtime.
311- # Since initial_dbg_callback remains unchanged, this should NOT trigger recompilation.
312- original_dbg = Application . fetch_env! ( :elixir , :dbg_callback )
313- :elixir_config . put ( :initial_dbg_callback , original_dbg )
314- Application . put_env ( :elixir , :dbg_callback , { SomeDebugTool , :dbg , [ original_dbg ] } )
315-
316- # Should NOT trigger recompilation since initial_dbg_callback is unchanged
317- assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :noop , [ ] }
318- refute_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
319- end )
320- after
321- Application . put_env ( :elixir , :dbg_callback , { Macro , :dbg , [ ] } )
322- :elixir_config . put ( :initial_dbg_callback , { Macro , :dbg , [ ] } )
323292 end
324293
325294 test "recompiles files on debug_info flag" do
0 commit comments