Skip to content

Commit 05296c1

Browse files
committed
Fix tests
1 parent b5384ef commit 05296c1

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

test/ex_doc/language/erlang_test.exs

+5-3
Original file line numberDiff line numberDiff line change
@@ -728,9 +728,11 @@ defmodule ExDoc.Language.ErlangTest do
728728
~s|foo(X, Y)|
729729
end
730730

731-
test "nominal", c do
732-
assert autolink_spec("-nominal foo() :: t().", c) ==
733-
~s|foo() :: <a href="#t:t/0">t</a>().|
731+
if System.otp_release() >= "28" do
732+
test "nominal", c do
733+
assert autolink_spec("-nominal foo() :: t().", c) ==
734+
~s|foo() :: <a href="#t:t/0">t</a>().|
735+
end
734736
end
735737

736738
test "tuple", c do

test/ex_doc/retriever/erlang_test.exs

+13-12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ defmodule ExDoc.Retriever.ErlangTest do
44
import TestHelper
55

66
@moduletag :tmp_dir
7+
@nominal_type if System.otp_release() >= "28", do: :nominal, else: :type
78

89
describe "docs_from_modules/2" do
910
@describetag :otp_eep59
@@ -274,26 +275,26 @@ defmodule ExDoc.Retriever.ErlangTest do
274275
end
275276

276277
test "types", c do
277-
erlc(c, :mod, ~S"""
278+
erlc(c, :mod, """
278279
-module(mod).
279-
-export_type([type1/0, equiv_type1/0, opaque1/0]).
280+
-export_type([type1/0, equiv_type1/0, opaque1/0, nominal1/0]).
280281
281282
-doc("type1/0 docs.").
282283
-type type1() :: atom().
283284
284-
-doc #{ equiv => type1/1 }.
285+
-doc \#{equiv => type1/1}.
285286
-type equiv_type1() :: atom().
286287
287288
-doc("opaque1/0 docs.").
288289
-opaque opaque1() :: atom().
289290
290291
-doc("nominal1/0 docs.").
291-
-nominal nominal1() :: atom().
292+
-#{@nominal_type} nominal1() :: atom().
292293
""")
293294

294295
config = %ExDoc.Config{source_url_pattern: "%{path}:%{line}"}
295296
{[mod], []} = Retriever.docs_from_modules([:mod], config)
296-
[equiv_type1, opaque1, nominal1, type1] = mod.typespecs
297+
[equiv_type1, nominal1, opaque1, type1] = mod.typespecs
297298

298299
assert opaque1.id == "t:opaque1/0"
299300
assert opaque1.type == :opaque
@@ -305,7 +306,7 @@ defmodule ExDoc.Retriever.ErlangTest do
305306
"opaque1()"
306307

307308
assert nominal1.id == "t:nominal1/0"
308-
assert nominal1.type == :nominal
309+
assert nominal1.type == @nominal_type
309310
assert nominal1.group == :Types
310311
assert nominal1.signature == "nominal1()"
311312
assert nominal1.doc |> DocAST.to_string() =~ "nominal1/0 docs."
@@ -486,24 +487,24 @@ defmodule ExDoc.Retriever.ErlangTest do
486487
end
487488

488489
test "types", c do
489-
erlc(c, :mod, ~S"""
490+
erlc(c, :mod, """
490491
%% @doc Docs.
491492
-module(mod).
492-
-export_type([type1/0, opaque1/0]).
493+
-export_type([type1/0, opaque1/0, nominal1/0]).
493494
494495
-type type1() :: atom().
495496
%% type1/0 docs.
496497
497498
-opaque opaque1() :: atom().
498499
%% opaque1/0 docs.
499500
500-
-nominal nominal1() :: atom().
501-
%% -doc("nominal1/0 docs.").
501+
-#{@nominal_type} nominal1() :: atom().
502+
%% nominal1/0 docs.
502503
""")
503504

504505
config = %ExDoc.Config{source_url_pattern: "%{path}:%{line}"}
505506
{[mod], []} = Retriever.docs_from_modules([:mod], config)
506-
[opaque1, type1] = mod.typespecs
507+
[nominal1, opaque1, type1] = mod.typespecs
507508

508509
assert opaque1.id == "t:opaque1/0"
509510
assert opaque1.type == :opaque
@@ -514,7 +515,7 @@ defmodule ExDoc.Retriever.ErlangTest do
514515
"opaque1()"
515516

516517
assert nominal1.id == "t:nominal1/0"
517-
assert nominal1.type == :nominal
518+
assert nominal1.type == @nominal_type
518519
assert nominal1.group == :Types
519520
assert nominal1.signature == "nominal1/0"
520521
assert nominal1.doc |> DocAST.to_string() =~ "nominal1/0 docs."

0 commit comments

Comments
 (0)