-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Hexdocs format in :otp anchors #1908
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ | |
|
||
test "OTP function", c do | ||
assert autolink_edoc("{@link array:new/0}", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#new-0"><code>array:new/0</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#new/0"><code>array:new/0</code></a>| | ||
end | ||
|
||
test "OTP function when generating OTP docs", c do | ||
|
@@ -99,12 +99,12 @@ | |
|
||
test "ERTS function", c do | ||
assert autolink_edoc("{@link zlib:gunzip/1}", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/zlib.html#gunzip-1"><code>zlib:gunzip/1</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/zlib.html#gunzip/1"><code>zlib:gunzip/1</code></a>| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "app function", c do | ||
assert autolink_edoc("{@link //stdlib/array:new/0}", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#new-0"><code>array:new/0</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#new/0"><code>array:new/0</code></a>| | ||
end | ||
|
||
test "external function", c do | ||
|
@@ -124,12 +124,12 @@ | |
|
||
test "OTP type", c do | ||
assert autolink_edoc("{@link array:array()}", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#type-array"><code>array:array()</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#t:array/0"><code>array:array()</code></a>| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "app type", c do | ||
assert autolink_edoc("{@link //stdlib/array:array()}", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#type-array"><code>array:array()</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#t:array/0"><code>array:array()</code></a>| | ||
end | ||
|
||
@myList (if :erlang.system_info(:otp_release) >= ~c"27" do | ||
|
@@ -310,7 +310,7 @@ | |
|
||
test "function in module autoimport using slash", c do | ||
assert autolink_doc("`node/0`", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/erlang.html#node-0"><code class="inline">node/0</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/erlang.html#node/0"><code class="inline">node/0</code></a>| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "type in module autoimport", c do | ||
|
@@ -320,7 +320,7 @@ | |
|
||
test "type in module autoimport using slash", c do | ||
assert autolink_doc("`t:integer/0`", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/erlang.html#type-integer"><code class="inline">integer/0</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/erlang.html#t:integer/0"><code class="inline">integer/0</code></a>| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "bad function in module code", c do | ||
|
@@ -335,7 +335,7 @@ | |
|
||
test "linking to auto-imported nil works", c do | ||
assert autolink_doc("[`[]`](`t:nil/0`)", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/erlang.html#type-nil"><code class="inline">[]</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/erlang.html#t:nil/0"><code class="inline">[]</code></a>| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "linking to local nil works", c do | ||
|
@@ -543,7 +543,7 @@ | |
|
||
test "OTP function", c do | ||
assert autolink_extra("`lists:reverse/1`", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/lists.html#reverse-1"><code class="inline">lists:reverse/1</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/lists.html#reverse/1"><code class="inline">lists:reverse/1</code></a>| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "type", c do | ||
|
@@ -553,7 +553,7 @@ | |
|
||
test "OTP type", c do | ||
assert autolink_extra("`t:array:array/0`", c) == | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#type-array"><code class="inline">array:array/0</code></a>| | ||
~s|<a href="https://www.erlang.org/doc/man/array.html#t:array/0"><code class="inline">array:array/0</code></a>| | ||
end | ||
|
||
test "module", c do | ||
|
@@ -684,9 +684,9 @@ | |
|
||
test "spec when fun is called record", c do | ||
assert autolink_spec("-spec record(module()) -> [[{module(), atom()}]].", c) == | ||
~s|record(<a href="https://www.erlang.org/doc/man/erlang.html#type-module">module</a>())| <> | ||
~s| -> [[{<a href="https://www.erlang.org/doc/man/erlang.html#type-module">module</a>(),| <> | ||
~s| <a href="https://www.erlang.org/doc/man/erlang.html#type-atom">atom</a>()}]].| | ||
~s|record(<a href="https://www.erlang.org/doc/man/erlang.html#t:module/0">module</a>())| <> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
~s| -> [[{<a href="https://www.erlang.org/doc/man/erlang.html#t:module/0">module</a>(),| <> | ||
~s| <a href="https://www.erlang.org/doc/man/erlang.html#t:atom/0">atom</a>()}]].| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "callback", c do | ||
|
@@ -724,7 +724,7 @@ | |
~S"-spec foo() -> #{atom() := sets:set(integer()), float() => t()}.", | ||
c | ||
) == | ||
~S|foo() -> #{<a href="https://www.erlang.org/doc/man/erlang.html#type-atom">atom</a>() := <a href="https://www.erlang.org/doc/man/sets.html#type-set">sets:set</a>(<a href="https://www.erlang.org/doc/man/erlang.html#type-integer">integer</a>()), <a href="https://www.erlang.org/doc/man/erlang.html#type-float">float</a>() => <a href="#t:t/0">t</a>()}.| | ||
~S|foo() -> #{<a href="https://www.erlang.org/doc/man/erlang.html#t:atom/0">atom</a>() := <a href="https://www.erlang.org/doc/man/sets.html#t:set/1">sets:set</a>(<a href="https://www.erlang.org/doc/man/erlang.html#t:integer/0">integer</a>()), <a href="https://www.erlang.org/doc/man/erlang.html#t:float/0">float</a>() => <a href="#t:t/0">t</a>()}.| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "vars", c do | ||
|
@@ -744,12 +744,12 @@ | |
|
||
test "record - one field", c do | ||
assert autolink_spec(~s"-spec foo() -> #x{x :: atom()} | t().", c) == | ||
~s[foo() -> #x{x :: <a href="https://www.erlang.org/doc/man/erlang.html#type-atom">atom</a>()} | <a href="#t:t/0">t</a>().] | ||
~s[foo() -> #x{x :: <a href="https://www.erlang.org/doc/man/erlang.html#t:atom/0">atom</a>()} | <a href="#t:t/0">t</a>().] | ||
end | ||
|
||
test "record - two fields", c do | ||
assert autolink_spec(~s"-spec foo() -> #x{x :: atom(), y :: sets:set(integer())} | t().", c) == | ||
~s[foo() -> #x{x :: <a href="https://www.erlang.org/doc/man/erlang.html#type-atom">atom</a>(), y :: <a href="https://www.erlang.org/doc/man/sets.html#type-set">sets:set</a>(<a href="https://www.erlang.org/doc/man/erlang.html#type-integer">integer</a>())} | <a href="#t:t/0">t</a>().] | ||
~s[foo() -> #x{x :: <a href="https://www.erlang.org/doc/man/erlang.html#t:atom/0">atom</a>(), y :: <a href="https://www.erlang.org/doc/man/sets.html#t:set/1">sets:set</a>(<a href="https://www.erlang.org/doc/man/erlang.html#t:integer/0">integer</a>())} | <a href="#t:t/0">t</a>().] | ||
end | ||
|
||
test "record - two fields, known types", c do | ||
|
@@ -789,12 +789,12 @@ | |
|
||
test "OTP type", c do | ||
assert autolink_spec(~S"-spec foo() -> sets:set().", c) == | ||
~s|foo() -> <a href="https://www.erlang.org/doc/man/sets.html#type-set">sets:set</a>().| | ||
~s|foo() -> <a href="https://www.erlang.org/doc/man/sets.html#t:set/0">sets:set</a>().| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "OTP private type", c do | ||
assert autolink_spec(~S"-spec foo() -> array:array_indx().", c) == | ||
~s|foo() -> <a href="https://www.erlang.org/doc/man/array.html#type-array_indx">array:array_indx</a>().| | ||
~s|foo() -> array:array_indx().| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
|
||
test "skip typespec name", c do | ||
|
@@ -820,7 +820,7 @@ | |
test "bad remote type", c do | ||
assert warn(fn -> | ||
assert autolink_spec(~S"-spec foo() -> bad:bad(atom()).", c, warnings: :send) == | ||
~s|foo() -> bad:bad(<a href="https://www.erlang.org/doc/man/erlang.html#type-atom">atom</a>()).| | ||
~s|foo() -> bad:bad(<a href="https://www.erlang.org/doc/man/erlang.html#t:atom/0">atom</a>()).| | ||
end) =~ ~s|references type "bad:bad/1" but it is undefined or private| | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ https://www.erlang.org/doc/apps/stdlib/array.html#new/0