@@ -195,7 +195,7 @@ defmodule Mix.Tasks.Compile.ElixirTest do
195
195
end )
196
196
end
197
197
198
- test "compiles mtime changed files if content changed but not length " do
198
+ test "compiles mtime changed files" do
199
199
in_fixture ( "no_mixfile" , fn ->
200
200
assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :ok , [ ] }
201
201
assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
@@ -204,8 +204,6 @@ defmodule Mix.Tasks.Compile.ElixirTest do
204
204
Mix . shell ( ) . flush
205
205
purge ( [ A , B ] )
206
206
207
- same_length_content = "lib/a.ex" |> File . read! ( ) |> String . replace ( "A" , "Z" )
208
- File . write! ( "lib/a.ex" , same_length_content )
209
207
future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
210
208
File . touch! ( "lib/a.ex" , future )
211
209
Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
@@ -227,71 +225,6 @@ defmodule Mix.Tasks.Compile.ElixirTest do
227
225
end )
228
226
end
229
227
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
-
295
228
test "compiles size changed files" do
296
229
in_fixture ( "no_mixfile" , fn ->
297
230
past = { { 2010 , 1 , 1 } , { 0 , 0 , 0 } }
@@ -324,7 +257,8 @@ defmodule Mix.Tasks.Compile.ElixirTest do
324
257
Mix . shell ( ) . flush
325
258
purge ( [ A , B ] )
326
259
327
- force_recompilation ( "lib/b.ex" )
260
+ future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
261
+ File . touch! ( "lib/b.ex" , future )
328
262
Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
329
263
330
264
assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
@@ -349,7 +283,7 @@ defmodule Mix.Tasks.Compile.ElixirTest do
349
283
350
284
Code . put_compiler_option ( :ignore_module_conflict , true )
351
285
Code . compile_file ( "lib/b.ex" )
352
- force_recompilation ( "lib/a.ex" )
286
+ File . touch! ( "lib/a.ex" , { { 2038 , 1 , 1 } , { 0 , 0 , 0 } } )
353
287
354
288
Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
355
289
assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
@@ -538,7 +472,8 @@ defmodule Mix.Tasks.Compile.ElixirTest do
538
472
assert_received { :mix_shell , :info , [ "Compiled lib/b.ex" ] }
539
473
purge ( [ A , B ] )
540
474
541
- force_recompilation ( "lib/a.ex" )
475
+ future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
476
+ File . touch! ( "lib/a.ex" , future )
542
477
543
478
assert Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] ) == { :ok , [ ] }
544
479
assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
@@ -680,7 +615,8 @@ defmodule Mix.Tasks.Compile.ElixirTest do
680
615
Mix . shell ( ) . flush
681
616
purge ( [ A , B ] )
682
617
683
- force_recompilation ( "lib/a.ex" )
618
+ future = { { 2038 , 1 , 1 } , { 0 , 0 , 0 } }
619
+ File . touch! ( "lib/a.ex" , future )
684
620
Mix.Tasks.Compile.Elixir . run ( [ "--verbose" ] )
685
621
686
622
assert_received { :mix_shell , :info , [ "Compiled lib/a.ex" ] }
0 commit comments