@@ -341,48 +341,67 @@ defmodule Mix.Tasks.EscriptTest do
341341 end )
342342 end
343343
344- test "escript.install from Git" do
345- in_fixture ( "git_repo" , fn ->
346- File . mkdir_p! ( "config" )
347-
348- File . write! ( "config/config.exs" , """
349- import Config
350- config :git_repo, :escript_config, true
351- """ )
352-
353- File . write! ( "lib/git_repo.ex" , """
354- require Application
355- true = Application.compile_env!(:git_repo, :escript_config)
356-
357- defmodule GitRepo.Escript do
358- def main(_argv) do
359- IO.puts("TEST")
344+ for count <- [ 1 , 2 ] do
345+ test "escript.install from Git (with MIX_OS_DEPS_COMPILE_PARTITION_COUNT=#{ count } )" do
346+ System . put_env ( "MIX_OS_DEPS_COMPILE_PARTITION_COUNT" , "#{ unquote ( count ) } " )
347+
348+ in_fixture ( "deps_status" , fn ->
349+ File . mkdir_p! ( "config" )
350+ File . mkdir_p! ( "lib" )
351+
352+ File . write! ( "config/config.exs" , """
353+ import Config
354+ config :source_repo, :escript_config, true
355+ """ )
356+
357+ File . write! ( "lib/source_repo.ex" , """
358+ require Application
359+ true = Application.compile_env!(:source_repo, :escript_config)
360+
361+ defmodule SourceRepo.Escript do
362+ def main(_argv) do
363+ IO.puts("TEST")
364+ end
360365 end
361- end
362- """ )
363-
364- File . write! ( "mix.exs" , """
365- defmodule GitRepo.MixProject do
366- use Mix.Project
367-
368- def project do
369- [app: :git_repo, version: "0.1.0", escript: [main_module: GitRepo.Escript]]
366+ """ )
367+
368+ File . write! ( "mix.exs" , """
369+ defmodule SourceRepo.MixProject do
370+ use Mix.Project
371+
372+ def project do
373+ [
374+ app: :source_repo,
375+ version: "0.1.0",
376+ escript: [main_module: SourceRepo.Escript],
377+ deps: [
378+ {:git_repo, path: "#{ MixTest.Case . fixture_path ( "git_repo" ) } "},
379+ {:git_rebar, path: "#{ MixTest.Case . fixture_path ( "git_rebar" ) } ", manager: :rebar3},
380+ {:ok, path: "deps/ok"},
381+ ]
382+ ]
383+ end
370384 end
371- end
372- """ )
385+ """ )
373386
374- System . cmd ( "git" , ~w[ add .] )
375- System . cmd ( "git" , ~w[ commit -m "ok"] )
387+ System . cmd ( "git" , ~w[ init] )
388+ System . cmd ( "git" , ~w[ add .] )
389+ System . cmd ( "git" , ~w[ commit -m "ok"] )
376390
377- send ( self ( ) , { :mix_shell_input , :yes? , true } )
378- Mix.Tasks.Escript.Install . run ( [ "git" , File . cwd! ( ) ] )
379- assert_received { :mix_shell , :info , [ "Generated escript git_repo with MIX_ENV=prod" ] }
391+ ExUnit.CaptureIO . capture_io ( fn ->
392+ send ( self ( ) , { :mix_shell_input , :yes? , true } )
393+ Mix.Tasks.Escript.Install . run ( [ "git" , File . cwd! ( ) ] )
394+ end )
380395
381- escript_path = Path . join ( [ tmp_path ( ".mix" ) , "escripts" , "git_repo" ] )
382- assert System . cmd ( "escript" , [ escript_path ] ) == { "TEST\n " , 0 }
383- end )
384- after
385- purge ( [ GitRepo.Escript , GitRepo.MixProject , Mix.Local.Installer.MixProject ] )
396+ assert_received { :mix_shell , :info , [ "Generated escript source_repo with MIX_ENV=prod" ] }
397+
398+ escript_path = Path . join ( [ tmp_path ( ".mix" ) , "escripts" , "source_repo" ] )
399+ assert System . cmd ( "escript" , [ escript_path ] ) == { "TEST\n " , 0 }
400+ end )
401+ after
402+ System . delete_env ( "MIX_OS_DEPS_COMPILE_PARTITION_COUNT" )
403+ purge ( [ SourceRepo.Escript , SourceRepo.MixProject , Mix.Local.Installer.MixProject ] )
404+ end
386405 end
387406
388407 defp push_project_with_config ( module , config \\ [ ] ) do
0 commit comments