@@ -83,7 +83,6 @@ defmodule Mix.Tasks.EscriptTest do
8383 test "generate escript with compile config" do
8484 in_fixture ( "escript_test" , fn ->
8585 push_project_with_config ( Escript )
86-
8786 File . mkdir_p! ( "config" )
8887
8988 File . write! ( "config/config.exs" , ~S"""
@@ -93,14 +92,14 @@ defmodule Mix.Tasks.EscriptTest do
9392
9493 Mix.Tasks.Escript.Build . run ( [ ] )
9594 assert_received { :mix_shell , :info , [ "Generated escript escript_test with MIX_ENV=dev" ] }
95+
9696 assert System . cmd ( "escript" , [ "escript_test" ] ) == { "COMPILE dev TARGET host\n " , 0 }
9797 end )
9898 end
9999
100100 test "generate escript with runtime config" do
101101 in_fixture ( "escript_test" , fn ->
102102 push_project_with_config ( Escript )
103-
104103 File . mkdir_p! ( "config" )
105104
106105 File . write! ( "config/config.exs" , """
@@ -127,7 +126,6 @@ defmodule Mix.Tasks.EscriptTest do
127126 test "generate escript with debug information" do
128127 in_fixture ( "escript_test" , fn ->
129128 push_project_with_config ( Escript , escript: [ main_module: EscriptTest , strip_beams: false ] )
130-
131129 Mix.Tasks.Escript.Build . run ( [ ] )
132130
133131 msg = "Generated escript escript_test with MIX_ENV=dev"
@@ -211,7 +209,6 @@ defmodule Mix.Tasks.EscriptTest do
211209 test "generate escript with Erlang and deps" do
212210 in_fixture ( "escript_test" , fn ->
213211 push_project_with_config ( EscriptErlangWithDeps )
214-
215212 Mix.Tasks.Escript.Build . run ( [ ] )
216213
217214 message = "Generated escript escript_test with MIX_ENV=dev"
@@ -261,7 +258,20 @@ defmodule Mix.Tasks.EscriptTest do
261258 end
262259
263260 test "escript install and uninstall" do
264- File . rm_rf! ( tmp_path ( ".mix/escripts" ) )
261+ escripts = tmp_path ( ".mix/escripts" )
262+ File . rm_rf! ( escripts )
263+
264+ # Configuration in the parent should not impact the escript
265+ in_tmp ( "config" , fn ->
266+ File . mkdir_p! ( "config" )
267+
268+ File . write! ( "config/config.exs" , ~S"""
269+ import Config
270+ config :foobar, :parent, "SET_ON_PARENT"
271+ """ )
272+
273+ Mix.Tasks.Loadconfig . run ( [ ] )
274+ end )
265275
266276 in_fixture ( "escript_test" , fn ->
267277 push_project_with_config ( Escript )
@@ -274,6 +284,10 @@ defmodule Mix.Tasks.EscriptTest do
274284 send ( self ( ) , { :mix_shell_input , :yes? , true } )
275285 Mix.Tasks.Escript.Install . run ( [ ] )
276286
287+ # execute the script
288+ assert System . cmd ( "escript" , [ Path . join ( escripts , "escript_test" ) , "--config" ] ) ==
289+ { "VALUE=TEST\n PARENT=NIL\n " , 0 }
290+
277291 # check that it shows in the list
278292 Mix.Tasks.Escript . run ( [ ] )
279293 assert_received { :mix_shell , :info , [ "* escript_test" ] }
@@ -400,7 +414,7 @@ defmodule Mix.Tasks.EscriptTest do
400414 end )
401415 after
402416 System . delete_env ( "MIX_OS_DEPS_COMPILE_PARTITION_COUNT" )
403- purge ( [ SourceRepo.Escript , SourceRepo.MixProject , Mix.Local.Installer.MixProject ] )
417+ purge ( [ GitRepo , SourceRepo.Escript , SourceRepo.MixProject , Mix.Local.Installer.MixProject ] )
404418 end
405419 end
406420
0 commit comments