@@ -195,7 +195,7 @@ defmodule Mix.Tasks.Compile.ElixirTest do
195195 end )
196196 end
197197
198- test "compiles mtime changed files if content changed but not length " do
198+ test "compiles mtime changed files" do
199199 in_fixture ( "no_mixfile" , fn ->
200200 assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :ok , [ ] }
201201 assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
@@ -204,8 +204,6 @@ defmodule Mix.Tasks.Compile.ElixirTest do
204204 Mix . shell ( ) . flush
205205 purge ( [ A , B ] )
206206
207- same_length_content = "lib/a.ex" |> File . read! ( ) |> String . replace ( "A" , "Z" )
208- File . write! ( "lib/a.ex" , same_length_content )
209207 future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
210208 File . touch! ( "lib/a.ex" , future )
211209 Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
@@ -227,71 +225,6 @@ defmodule Mix.Tasks.Compile.ElixirTest do
227225 end )
228226 end
229227
230- test "does not recompile mtime changed but identical files" do
231- in_fixture ( "no_mixfile" , fn ->
232- assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :ok , [ ] }
233- assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
234- assert_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
235-
236- Mix . shell ( ) . flush
237- purge ( [ A , B ] )
238-
239- future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
240- File . touch! ( "lib/a.ex" , future )
241- Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
242-
243- message =
244- "warning: mtime (modified time) for \" lib/a.ex\" was set to the future, resetting to now"
245-
246- assert_received { :mix_shell , :error , [ ^ message ] }
247-
248- message =
249- "warning: mtime (modified time) for \" lib/b.ex\" was set to the future, resetting to now"
250-
251- refute_received { :mix_shell , :error , [ ^ message ] }
252- refute_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
253- refute_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
254-
255- File . touch! ( "_build/dev/lib/sample/.mix/compile.elixir" , future )
256- assert Mix.Tasks.Compile.Elixir . run ( [ ] ) == { :noop , [ ] }
257- end )
258- end
259-
260- test "does recompile a file restored after a compile error (and .beam file were deleted)" do
261- in_fixture ( "no_mixfile" , fn ->
262- assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :ok , [ ] }
263- assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
264- assert_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
265-
266- Mix . shell ( ) . flush
267- purge ( [ A , B ] )
268-
269- # Compile with error
270- original_content = File . read! ( "lib/b.ex" )
271- File . write! ( "lib/b.ex" , "this will not compile" )
272-
273- assert capture_io ( fn ->
274- { :error , _ } = Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
275- end ) =~ "Compilation error in file lib/b.ex"
276-
277- assert_received { :mix_shell , :info , [ "Compiling 1 file (.ex)" ] }
278-
279- # Revert change
280- File . write! ( "lib/b.ex" , original_content )
281- future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
282- File . touch! ( "lib/b.ex" , future )
283-
284- Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
285-
286- message =
287- "warning: mtime (modified time) for \" lib/b.ex\" was set to the future, resetting to now"
288-
289- assert_received { :mix_shell , :error , [ ^ message ] }
290- assert_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
291- refute_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
292- end )
293- end
294-
295228 test "compiles size changed files" do
296229 in_fixture ( "no_mixfile" , fn ->
297230 past = { { 2010 , 1 , 1 } , { 0 , 0 , 0 } }
@@ -324,7 +257,8 @@ defmodule Mix.Tasks.Compile.ElixirTest do
324257 Mix . shell ( ) . flush
325258 purge ( [ A , B ] )
326259
327- force_recompilation ( "lib/b.ex" )
260+ future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
261+ File . touch! ( "lib/b.ex" , future )
328262 Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
329263
330264 assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
@@ -349,7 +283,7 @@ defmodule Mix.Tasks.Compile.ElixirTest do
349283
350284 Code . put_compiler_option ( :ignore_module_conflict , true )
351285 Code . compile_file ( "lib/b.ex" )
352- force_recompilation ( "lib/a.ex" )
286+ File . touch! ( "lib/a.ex" , { { 2038 , 1 , 1 } , { 0 , 0 , 0 } } )
353287
354288 Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
355289 assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
@@ -538,7 +472,8 @@ defmodule Mix.Tasks.Compile.ElixirTest do
538472 assert_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
539473 purge ( [ A , B ] )
540474
541- force_recompilation ( "lib/a.ex" )
475+ future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
476+ File . touch! ( "lib/a.ex" , future )
542477
543478 assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :ok , [ ] }
544479 assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
@@ -680,7 +615,8 @@ defmodule Mix.Tasks.Compile.ElixirTest do
680615 Mix . shell ( ) . flush
681616 purge ( [ A , B ] )
682617
683- force_recompilation ( "lib/a.ex" )
618+ future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
619+ File . touch! ( "lib/a.ex" , future )
684620 Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
685621
686622 assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
0 commit comments