Skip to content

Commit bb2f176

Browse files
committed
Test for compiler as atom and IEx
1 parent 9c6c315 commit bb2f176

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

lib/iex/lib/iex/helpers.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,8 @@ defmodule IEx.Helpers do
169169
end
170170

171171
defp reenable_tasks(config) do
172-
Mix.Task.reenable("compile")
173-
Mix.Task.reenable("compile.all")
174172
compilers = config[:compilers] || Mix.compilers()
175-
Enum.each(compilers, &Mix.Task.reenable("compile.#{&1}"))
173+
Mix.Task.Compiler.reenable(compilers: compilers)
176174
end
177175

178176
@doc """

lib/mix/test/mix/tasks/compile_test.exs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,27 +119,41 @@ defmodule Mix.Tasks.CompileTest do
119119

120120
File.mkdir_p!("lib/foo")
121121

122-
File.write!("lib/foo/z.ex", """
123-
defmodule Z do
122+
File.write!("lib/foo/z1.ex", """
123+
defmodule Z1 do
124124
def ok, do: :ok
125125
end
126126
""")
127127

128128
assert :ok = Mix.Task.reenable("compile")
129129
assert {:noop, []} = Mix.Task.run("compile")
130-
refute File.regular?("_build/dev/lib/sample/ebin/Elixir.Z.beam")
130+
refute File.regular?("_build/dev/lib/sample/ebin/Elixir.Z1.beam")
131131

132132
assert :ok = Mix.Task.Compiler.reenable(compilers: [])
133133
assert {:noop, []} = Mix.Task.run("compile")
134-
refute File.regular?("_build/dev/lib/sample/ebin/Elixir.Z.beam")
134+
refute File.regular?("_build/dev/lib/sample/ebin/Elixir.Z1.beam")
135135

136136
assert :ok = Mix.Task.Compiler.reenable(compilers: ["erlang"])
137137
assert {:noop, []} = Mix.Task.run("compile")
138-
refute File.regular?("_build/dev/lib/sample/ebin/Elixir.Z.beam")
138+
refute File.regular?("_build/dev/lib/sample/ebin/Elixir.Z1.beam")
139139

140140
assert :ok = Mix.Task.Compiler.reenable()
141141
assert {:ok, []} = Mix.Task.run("compile")
142-
assert File.regular?("_build/dev/lib/sample/ebin/Elixir.Z.beam")
142+
assert File.regular?("_build/dev/lib/sample/ebin/Elixir.Z1.beam")
143+
144+
File.write!("lib/foo/z2.ex", """
145+
defmodule Z2 do
146+
def ko, do: :ko
147+
end
148+
""")
149+
150+
assert :ok = Mix.Task.Compiler.reenable(compilers: [:erlang])
151+
assert {:noop, []} = Mix.Task.run("compile")
152+
refute File.regular?("_build/dev/lib/sample/ebin/Elixir.Z2.beam")
153+
154+
assert :ok = Mix.Task.Compiler.reenable(compilers: [:elixir])
155+
assert {:ok, []} = Mix.Task.run(:compile)
156+
assert File.regular?("_build/dev/lib/sample/ebin/Elixir.Z2.beam")
143157
end)
144158
end
145159

0 commit comments

Comments
 (0)