Skip to content

Commit 795d0a9

Browse files
committed
More fixes
1 parent 1150eba commit 795d0a9

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

lib/ex_unit/test/ex_unit/capture_io_test.exs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,14 @@ defmodule ExUnit.CaptureIOTest do
216216
end)
217217

218218
capture_io("\"a", fn ->
219-
assert :io.scan_erl_form(~c">") == {:error, {1, :erl_scan, {:string, 34, ~c"a"}}, 1}
219+
error =
220+
if System.otp_release() >= "27" do
221+
{1, :erl_scan, {:unterminated, :string, ~c"a"}}
222+
else
223+
{1, :erl_scan, {:string, 34, ~c"a"}}
224+
end
225+
226+
assert :io.scan_erl_form(~c">") == {:error, error, 1}
220227
assert :io.scan_erl_form(~c">") == {:eof, 1}
221228
end)
222229

lib/iex/test/iex/helpers_test.exs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,13 @@ defmodule IEx.HelpersTest do
342342
test "prints Erlang module function specs" do
343343
captured = capture_io(fn -> h(:timer.sleep() / 1) end)
344344
assert captured =~ ":timer.sleep/1"
345-
assert captured =~ "-spec sleep(Time) -> ok when Time :: timeout()."
345+
346+
# TODO Fix for OTP 27 once specs are available
347+
if System.otp_release() < "27" do
348+
assert captured =~ "-spec sleep(Time) -> ok when Time :: timeout()."
349+
else
350+
assert captured =~ "sleep(Time)"
351+
end
346352
end
347353

348354
@tag :erlang_doc
@@ -1014,18 +1020,39 @@ defmodule IEx.HelpersTest do
10141020
@tag :erlang_doc
10151021
test "prints all types in Erlang module" do
10161022
captured = capture_io(fn -> t(:queue) end)
1017-
assert captured =~ "-type queue() :: queue(_)"
1018-
assert captured =~ "-opaque queue(Item)"
1023+
1024+
# TODO Fix for OTP 27 once specs are available
1025+
if System.otp_release() < "27" do
1026+
assert captured =~ "-type queue() :: queue(_)"
1027+
assert captured =~ "-opaque queue(Item)"
1028+
else
1029+
assert captured =~ "queue()"
1030+
assert captured =~ "queue(Item)"
1031+
end
10191032
end
10201033

10211034
@tag :erlang_doc
10221035
test "prints single type from Erlang module" do
10231036
captured = capture_io(fn -> t(:erlang.iovec()) end)
1024-
assert captured =~ "-type iovec() :: [binary()]"
1037+
1038+
# TODO Fix for OTP 27 once specs are available
1039+
if System.otp_release() < "27" do
1040+
assert captured =~ "-type iovec() :: [binary()]"
1041+
else
1042+
assert captured =~ "iovec()"
1043+
end
1044+
10251045
assert captured =~ "A list of binaries."
10261046

10271047
captured = capture_io(fn -> t(:erlang.iovec() / 0) end)
1028-
assert captured =~ "-type iovec() :: [binary()]"
1048+
1049+
# TODO Fix for OTP 27 once specs are available
1050+
if System.otp_release() < "27" do
1051+
assert captured =~ "-type iovec() :: [binary()]"
1052+
else
1053+
assert captured =~ "iovec()"
1054+
end
1055+
10291056
assert captured =~ "A list of binaries."
10301057
end
10311058

0 commit comments

Comments
 (0)