Skip to content

Commit 7cd98e1

Browse files
author
José Valim
committed
Speed up escriptize tests
1 parent 036d016 commit 7cd98e1

File tree

5 files changed

+53
-53
lines changed

5 files changed

+53
-53
lines changed

lib/mix/test/fixtures/escripttest/mix.exs

Lines changed: 0 additions & 9 deletions
This file was deleted.

lib/mix/test/fixtures/escripttestwithpath/lib/escripttestwithpath.ex

Lines changed: 0 additions & 9 deletions
This file was deleted.

lib/mix/test/fixtures/escripttestwithpath/mix.exs

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/mix/test/mix/escriptize_test.exs

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Code.require_file "../../test_helper.exs", __DIR__
2+
3+
defmodule Mix.Tasks.EscriptizeTest do
4+
use MixTest.Case
5+
6+
defmodule Escript do
7+
def project do
8+
[ app: :escripttest,
9+
version: "0.0.1",
10+
escript_embed_elixir: true ]
11+
end
12+
end
13+
14+
defmodule EscriptWithPath do
15+
def project do
16+
[ app: :escripttestwithpath,
17+
version: "0.0.1",
18+
escript_embed_elixir: true,
19+
escript_main_module: Escripttest,
20+
escript_name: :escripttestwithpath,
21+
escript_path: Path.join("ebin", "escripttestwithpath") ]
22+
end
23+
end
24+
25+
test "generate simple escript" do
26+
Mix.Project.push Escript
27+
28+
in_fixture "escripttest", fn ->
29+
Mix.Tasks.Escriptize.run []
30+
assert_received { :mix_shell, :info, ["Generated escript escripttest"] }
31+
assert System.cmd("escript escripttest") == "TEST\n"
32+
33+
Mix.Tasks.Escriptize.run []
34+
refute_received { :mix_shell, :info, ["Generated escript escripttest"] }
35+
end
36+
after
37+
purge [Escripttest]
38+
Mix.Project.pop
39+
end
40+
41+
test "generate simple escript with path" do
42+
Mix.Project.push EscriptWithPath
43+
44+
in_fixture "escripttest", fn ->
45+
Mix.Tasks.Escriptize.run []
46+
assert_received { :mix_shell, :info, ["Generated escript ebin/escripttestwithpath"] }
47+
assert System.cmd("escript ebin/escripttestwithpath") == "TEST\n"
48+
end
49+
after
50+
purge [Escripttest]
51+
Mix.Project.pop
52+
end
53+
end

0 commit comments

Comments
 (0)