Skip to content

Commit 54516c5

Browse files
committed
Address tests on Erlang/OTP 26.1, closes #12975
1 parent 08d2bb1 commit 54516c5

File tree

3 files changed

+18
-33
lines changed

3 files changed

+18
-33
lines changed

lib/ex_unit/lib/ex_unit/callbacks.ex

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -549,14 +549,7 @@ defmodule ExUnit.Callbacks do
549549
end
550550

551551
child_spec = Supervisor.child_spec(child_spec_or_module, opts)
552-
553-
case Supervisor.start_child(sup, child_spec) do
554-
{:error, {:already_started, _pid}} ->
555-
{:error, {:duplicate_child_name, child_spec.id}}
556-
557-
other ->
558-
other
559-
end
552+
Supervisor.start_child(sup, child_spec)
560553
end
561554

562555
@doc """

lib/ex_unit/test/ex_unit/formatter_test.exs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -491,28 +491,25 @@ defmodule ExUnit.FormatterTest do
491491
test "inspect failure" do
492492
failure = [{:error, catch_assertion(assert :will_fail == %BadInspect{}), []}]
493493

494-
message = ~S'''
495-
got FunctionClauseError with message:
496-
497-
"""
498-
no function clause matching in Inspect.ExUnit.FormatterTest.BadInspect.inspect/2
499-
"""
500-
501-
while inspecting:
502-
503-
%{__struct__: ExUnit.FormatterTest.BadInspect, key: 0}
504-
505-
Stacktrace:
506-
'''
507-
508-
assert format_test_failure(test(), failure, 1, 80, &formatter/2) =~ """
494+
assert format_test_failure(test(), failure, 1, 80, &formatter/2) =~ ~s'''
509495
1) world (Hello)
510496
test/ex_unit/formatter_test.exs:1
511497
Assertion with == failed
512498
code: assert :will_fail == %BadInspect{}
513499
left: :will_fail
514-
right: #Inspect.Error<\n#{message}\
515-
"""
500+
right: #Inspect.Error<
501+
got FunctionClauseError with message:
502+
503+
"""
504+
no function clause matching in Inspect.ExUnit.FormatterTest.BadInspect.inspect/2
505+
"""
506+
507+
while inspecting:
508+
509+
#{inspect(%BadInspect{}, structs: false)}
510+
511+
Stacktrace:
512+
'''
516513
end
517514

518515
defmodule BadMessage do

lib/ex_unit/test/ex_unit/supervised_test.exs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,14 @@ defmodule ExUnit.SupervisedTest do
7373

7474
test "starts a supervised process with ID checks" do
7575
{:ok, pid} = start_supervised({MyAgent, 0})
76+
assert is_pid(pid)
7677

77-
assert {:error, {:duplicate_child_name, ExUnit.SupervisedTest.MyAgent}} =
78-
start_supervised({MyAgent, 0})
79-
80-
assert {:error, {{:already_started, ^pid}, _}} = start_supervised({MyAgent, 0}, id: :another)
78+
assert {:error, _} = start_supervised({MyAgent, 0})
79+
assert {:error, _} = start_supervised({MyAgent, 0}, id: :another)
8180

8281
assert_raise RuntimeError, ~r"Reason: bad child specification", fn ->
8382
start_supervised!(%{id: 1, start: :oops})
8483
end
85-
86-
assert_raise RuntimeError, ~r"Reason: already started", fn ->
87-
start_supervised!({MyAgent, 0}, id: :another)
88-
end
8984
end
9085

9186
test "stops a supervised process" do

0 commit comments

Comments
 (0)