-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doctest() can now also doctest manual pages which makes it easier to include doctesting as part of the test suite.
- Loading branch information
Showing
6 changed files
with
147 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Hidden showcase page | ||
|
||
Currently exists just so that there would be doctests to run in manual pages of Documenter's | ||
manual. This page does not show up in navigation. | ||
|
||
```jldoctest | ||
julia> 2 + 2 | ||
4 | ||
``` | ||
|
||
The following doctests needs doctestsetup: | ||
|
||
```jldoctest; setup=:(using Documenter) | ||
julia> Documenter.Utilities.splitexpr(:(Foo.Bar.baz)) | ||
(:(Foo.Bar), :(:baz)) | ||
``` | ||
|
||
Let's also try `@meta` blocks: | ||
|
||
```@meta | ||
DocTestSetup = quote | ||
f(x) = x^2 | ||
end | ||
``` | ||
|
||
```jldoctest | ||
julia> f(2) | ||
4 | ||
``` | ||
|
||
```@meta | ||
DocTestSetup = nothing | ||
``` |
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,22 @@ | ||
using Documenter | ||
using Test | ||
|
||
@testset "Manual doctest" begin | ||
@info "Doctesting Documenter manual" | ||
@test doctest(Documenter) | ||
|
||
# Make sure that doctest() fails if there is a manual page with a failing doctest | ||
@info "Doctesting Documenter manual w/ failing doctest" | ||
tmpfile = joinpath(@__DIR__, "..", "docs", "src", "lib", "internals", "tmpfile.md") | ||
write(tmpfile, """ | ||
# Temporary source file w/ failing doctest | ||
```jldoctest | ||
julia> 2 + 2 | ||
42 | ||
``` | ||
""") | ||
@test isfile(tmpfile) | ||
@test !doctest(Documenter) | ||
rm(tmpfile) | ||
@test !isfile(tmpfile) | ||
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