Skip to content

Commit d17df05

Browse files
committed
Skip tests if Erlang was compiled without docs, closes #13322
1 parent 41f6ee3 commit d17df05

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

lib/iex/test/iex/helpers_test.exs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,17 +332,20 @@ defmodule IEx.HelpersTest do
332332
assert help =~ "Welcome to Interactive Elixir"
333333
end
334334

335+
@tag :erlang_doc
335336
test "prints Erlang module documentation" do
336337
captured = capture_io(fn -> h(:timer) end)
337338
assert captured =~ "This module provides useful functions related to time."
338339
end
339340

341+
@tag :erlang_doc
340342
test "prints Erlang module function specs" do
341343
captured = capture_io(fn -> h(:timer.sleep() / 1) end)
342344
assert captured =~ ":timer.sleep/1"
343345
assert captured =~ "-spec sleep(Time) -> ok when Time :: timeout()."
344346
end
345347

348+
@tag :erlang_doc
346349
test "handles non-existing Erlang module function" do
347350
captured = capture_io(fn -> h(:timer.baz() / 1) end)
348351
assert captured =~ "No documentation for :timer.baz was found"
@@ -1008,13 +1011,15 @@ defmodule IEx.HelpersTest do
10081011
cleanup_modules([TypeSample])
10091012
end
10101013

1011-
test "prints all types in erlang module" do
1014+
@tag :erlang_doc
1015+
test "prints all types in Erlang module" do
10121016
captured = capture_io(fn -> t(:queue) end)
10131017
assert captured =~ "-type queue() :: queue(_)"
10141018
assert captured =~ "-opaque queue(Item)"
10151019
end
10161020

1017-
test "prints single type from erlang module" do
1021+
@tag :erlang_doc
1022+
test "prints single type from Erlang module" do
10181023
captured = capture_io(fn -> t(:erlang.iovec()) end)
10191024
assert captured =~ "-type iovec() :: [binary()]"
10201025
assert captured =~ "A list of binaries."
@@ -1024,7 +1029,8 @@ defmodule IEx.HelpersTest do
10241029
assert captured =~ "A list of binaries."
10251030
end
10261031

1027-
test "handles non-existing types from erlang module" do
1032+
@tag :erlang_doc
1033+
test "handles non-existing types from Erlang module" do
10281034
captured = capture_io(fn -> t(:erlang.foo()) end)
10291035
assert captured =~ "No type information for :erlang.foo was found or :erlang.foo is private"
10301036

lib/iex/test/test_helper.exs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ IEx.configure(colors: [enabled: false])
77
{line_exclude, line_include} =
88
if line = System.get_env("LINE"), do: {[:test], [line: line]}, else: {[], []}
99

10+
erlang_doc_exclude =
11+
if match?({:docs_v1, _, _, _, _, _, _}, Code.fetch_docs(:array)) do
12+
[]
13+
else
14+
IO.puts("Erlang/OTP compiled without docs, some tests are excluded...")
15+
[:erlang_doc]
16+
end
17+
1018
ExUnit.start(
1119
assert_receive_timeout: assert_timeout,
1220
trace: !!System.get_env("TRACE"),
1321
include: line_include,
14-
exclude: line_exclude
22+
exclude: line_exclude ++ erlang_doc_exclude
1523
)
1624

1725
defmodule IEx.Case do

0 commit comments

Comments
 (0)