Skip to content

Commit 2ba98f2

Browse files
author
José Valim
committed
Continue passing :case to setup/setup_all/test
1 parent bc9b5ea commit 2ba98f2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/ex_unit/lib/ex_unit/runner.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,22 +181,22 @@ defmodule ExUnit.Runner do
181181
end
182182

183183
defp exec_module_setup(%ExUnit.TestModule{name: module} = test_module) do
184-
{:ok, test_module, module.__ex_unit__(:setup_all, %{module: module})}
184+
{:ok, test_module, module.__ex_unit__(:setup_all, %{module: module, case: module})}
185185
catch
186186
kind, error ->
187187
failed = failed(kind, error, pruned_stacktrace())
188188
{:error, %{test_module | state: failed}}
189189
end
190190

191-
defp run_test(true, config, test, context) do
192-
run_test([], config, test, context)
191+
defp run_test_with_capture_log(true, config, test, context) do
192+
run_test_with_capture_log([], config, test, context)
193193
end
194194

195-
defp run_test(false, config, test, context) do
195+
defp run_test_with_capture_log(false, config, test, context) do
196196
spawn_test(config, test, context)
197197
end
198198

199-
defp run_test(opts, config, test, context) do
199+
defp run_test_with_capture_log(opts, config, test, context) do
200200
ref = make_ref()
201201

202202
try do
@@ -224,7 +224,7 @@ defmodule ExUnit.Runner do
224224
test =
225225
if is_nil(test.state) do
226226
capture_log? = Map.get(tags, :capture_log, config.capture_log)
227-
run_test(capture_log?, config, test, Map.merge(tags, context))
227+
run_test_with_capture_log(capture_log?, config, test, Map.merge(tags, context))
228228
else
229229
test
230230
end

lib/ex_unit/test/ex_unit/case_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ defmodule ExUnit.CaseTest do
2121
test "tags", context do
2222
line = __ENV__.line - 1
2323
assert context[:module] == __MODULE__
24+
assert context[:case] == __MODULE__ # Deprecated
2425
assert context[:test] == __ENV__.function |> elem(0)
2526
assert context[:line] == line
2627
assert context[:async] == true

0 commit comments

Comments
 (0)