-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
linkcheck
for docstrings (#2330)
- Loading branch information
Showing
6 changed files
with
80 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module DocstringLinkTests | ||
using Test | ||
using Documenter | ||
import IOCapture | ||
|
||
|
||
module InvalidLinks | ||
export f | ||
|
||
"""Link to [invalid](http://domain.invalid/docstring.html)""" | ||
f(x) = x | ||
|
||
end | ||
|
||
|
||
@testset "invalid links in docstring" begin | ||
c = IOCapture.capture(; rethrow=Union{}) do | ||
makedocs(; | ||
root = dirname(@__FILE__), | ||
modules = InvalidLinks, | ||
sitename = "InvalidLinks Checks", | ||
warnonly = false, | ||
linkcheck = true, | ||
debug = false | ||
) | ||
end | ||
@test contains(c.output, r"Error:.*http://domain.invalid/index.html") | ||
@test contains(c.output, r"Error:.*http://domain.invalid/docstring.html") | ||
@test c.value isa ErrorException | ||
@test contains(c.value.msg, "`makedocs` encountered an error [:linkcheck]") | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
An [invalid link](http://domain.invalid/index.html) in the `.md` file. | ||
|
||
|
||
```@docs | ||
Main.OnlineLinkcheckTests.DocstringLinkTests.InvalidLinks.f | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters