Skip to content

Commit

Permalink
Fix doctest tests
Browse files Browse the repository at this point in the history
Note: doctest failures, if strict is set, now fail the build early.
  • Loading branch information
mortenpi committed Jun 8, 2019
1 parent 6f714fd commit 30054d9
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 37 deletions.
6 changes: 3 additions & 3 deletions test/doctests/doctests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ rfile(filename) = joinpath(@__DIR__, "stdouts", filename)

run_makedocs(["broken.md", "foobroken.md"]; modules=[FooBroken], strict=true) do result, success, backtrace, output
@test !success
@test_broken is_same_as_file(output, rfile("stdout.6"))
@test is_same_as_file(output, rfile("stdout.6"))
end

run_makedocs(["fooworking.md"]; modules=[FooWorking], strict=true) do result, success, backtrace, output
Expand All @@ -145,8 +145,8 @@ rfile(filename) = joinpath(@__DIR__, "stdouts", filename)
end

run_makedocs(["foobroken.md"]; modules=[FooBroken], strict=true) do result, success, backtrace, output
@test_broken !success
@test_broken is_same_as_file(output, rfile("stdout.8"))
@test !success
@test is_same_as_file(output, rfile("stdout.8"))
end

# Here we try the default (strict = false) -- output should say that doctest failed, but
Expand Down
1 change: 1 addition & 0 deletions test/doctests/stdouts/stdout.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
Expand Down
1 change: 1 addition & 0 deletions test/doctests/stdouts/stdout.11
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
Expand Down
11 changes: 6 additions & 5 deletions test/doctests/stdouts/stdout.12
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests2/tmpfiBBfP/tmpcviARh/broken.md:3-6
[ Info: Doctest: running doctests.
┌ Error: doctest failure in src/broken.md:3-6
│ ```jldoctest
│ julia> 2 + 2
Expand All @@ -24,7 +22,10 @@
│ diff =
│ Warning: Diff output requires color.
│ -64
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:266
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: HTMLWriter: rendering HTML pages.
9 changes: 3 additions & 6 deletions test/doctests/stdouts/stdout.2
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests2/tmp71nSFG/tmpUzYK6R/broken.md:3-6
[ Info: Doctest: running doctests.
┌ Error: doctest failure in src/broken.md:3-6
│ ```jldoctest
│ julia> 2 + 2
Expand All @@ -24,5 +22,4 @@
│ diff =
│ Warning: Diff output requires color.
│ -64
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:266
[ Info: Populate: populating indices.
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336
1 change: 1 addition & 0 deletions test/doctests/stdouts/stdout.3
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
Expand Down
9 changes: 3 additions & 6 deletions test/doctests/stdouts/stdout.4
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests2/src/FooBroken.jl:6-9
[ Info: Doctest: running doctests.
┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests/src/FooBroken.jl:6-9
│ ```jldoctest
│ julia> 2 + 2
Expand All @@ -24,5 +22,4 @@
│ diff =
│ Warning: Diff output requires color.
│ 424
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:266
[ Info: Populate: populating indices.
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336
9 changes: 3 additions & 6 deletions test/doctests/stdouts/stdout.5
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests2/tmp7FIKUN/tmp8Y5E0A/broken.md:3-6
[ Info: Doctest: running doctests.
┌ Error: doctest failure in src/broken.md:3-6
│ ```jldoctest
│ julia> 2 + 2
Expand All @@ -24,5 +22,4 @@
│ diff =
│ Warning: Diff output requires color.
│ -64
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:266
[ Info: Populate: populating indices.
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336
9 changes: 3 additions & 6 deletions test/doctests/stdouts/stdout.6
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Doctest: running doctests.
┌ Error: doctest failure in src/broken.md:3-6
│ ```jldoctest
Expand All @@ -24,7 +22,7 @@
│ diff =
│ Warning: Diff output requires color.
│ -64
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:266
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336
┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests/src/FooBroken.jl:6-9
│ ```jldoctest
Expand All @@ -47,5 +45,4 @@
│ diff =
│ Warning: Diff output requires color.
│ 424
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:266
[ Info: Populate: populating indices.
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336
1 change: 1 addition & 0 deletions test/doctests/stdouts/stdout.7
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
Expand Down
7 changes: 2 additions & 5 deletions test/doctests/stdouts/stdout.8
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Doctest: running doctests.
┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests/src/FooBroken.jl:6-9
│ ```jldoctest
Expand All @@ -24,5 +22,4 @@
│ diff =
│ Warning: Diff output requires color.
│ 424
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:266
[ Info: Populate: populating indices.
└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336

0 comments on commit 30054d9

Please sign in to comment.