summaryrefslogtreecommitdiff
path: root/dev-lang/elixir/files/elixir-1.16.1-skip-tests-requiring-erlang-docs.patch
blob: 187c45a7d9020e024741dfa9a9cd1cbffd817aad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Upstream-Commit: https://github.com/elixir-lang/elixir/commit/c50863615c0e8ac957e22ae01a6f9af23978c3f9

From c50863615c0e8ac957e22ae01a6f9af23978c3f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Valim?= <jose.valim@dashbit.co>
Date: Thu, 8 Feb 2024 08:08:03 +0100
Subject: [PATCH] Skip tests if Erlang was compiled without docs, closes #13322

---
 lib/iex/test/iex/helpers_test.exs | 12 +++++++++---
 lib/iex/test/test_helper.exs      | 10 +++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/lib/iex/test/iex/helpers_test.exs b/lib/iex/test/iex/helpers_test.exs
index 54f946516ce..171acc72abc 100644
--- a/lib/iex/test/iex/helpers_test.exs
+++ b/lib/iex/test/iex/helpers_test.exs
@@ -332,17 +332,20 @@ defmodule IEx.HelpersTest do
       assert help =~ "Welcome to Interactive Elixir"
     end
 
+    @tag :erlang_doc
     test "prints Erlang module documentation" do
       captured = capture_io(fn -> h(:timer) end)
       assert captured =~ "This module provides useful functions related to time."
     end
 
+    @tag :erlang_doc
     test "prints Erlang module function specs" do
       captured = capture_io(fn -> h(:timer.sleep() / 1) end)
       assert captured =~ ":timer.sleep/1"
       assert captured =~ "-spec sleep(Time) -> ok when Time :: timeout()."
     end
 
+    @tag :erlang_doc
     test "handles non-existing Erlang module function" do
       captured = capture_io(fn -> h(:timer.baz() / 1) end)
       assert captured =~ "No documentation for :timer.baz was found"
@@ -1008,13 +1011,15 @@ defmodule IEx.HelpersTest do
       cleanup_modules([TypeSample])
     end
 
-    test "prints all types in erlang module" do
+    @tag :erlang_doc
+    test "prints all types in Erlang module" do
       captured = capture_io(fn -> t(:queue) end)
       assert captured =~ "-type queue() :: queue(_)"
       assert captured =~ "-opaque queue(Item)"
     end
 
-    test "prints single type from erlang module" do
+    @tag :erlang_doc
+    test "prints single type from Erlang module" do
       captured = capture_io(fn -> t(:erlang.iovec()) end)
       assert captured =~ "-type iovec() :: [binary()]"
       assert captured =~ "A list of binaries."
@@ -1024,7 +1029,8 @@ defmodule IEx.HelpersTest do
       assert captured =~ "A list of binaries."
     end
 
-    test "handles non-existing types from erlang module" do
+    @tag :erlang_doc
+    test "handles non-existing types from Erlang module" do
       captured = capture_io(fn -> t(:erlang.foo()) end)
       assert captured =~ "No type information for :erlang.foo was found or :erlang.foo is private"
 
diff --git a/lib/iex/test/test_helper.exs b/lib/iex/test/test_helper.exs
index f5a55f0aa80..b32c8be4e91 100644
--- a/lib/iex/test/test_helper.exs
+++ b/lib/iex/test/test_helper.exs
@@ -7,11 +7,19 @@ IEx.configure(colors: [enabled: false])
 {line_exclude, line_include} =
   if line = System.get_env("LINE"), do: {[:test], [line: line]}, else: {[], []}
 
+erlang_doc_exclude =
+  if match?({:docs_v1, _, _, _, _, _, _}, Code.fetch_docs(:array)) do
+    []
+  else
+    IO.puts("Erlang/OTP compiled without docs, some tests are excluded...")
+    [:erlang_doc]
+  end
+
 ExUnit.start(
   assert_receive_timeout: assert_timeout,
   trace: !!System.get_env("TRACE"),
   include: line_include,
-  exclude: line_exclude
+  exclude: line_exclude ++ erlang_doc_exclude
 )
 
 defmodule IEx.Case do