From a44013f0115add02f409d8ce0a963b74274c52cd Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 19 Jun 2019 15:49:48 +1200 Subject: [PATCH] Add tests for doctest=:only --- test/doctests/doctests.jl | 27 +++++++++++++++++++ test/doctests/stdouts/stdout.21 | 7 +++++ test/doctests/stdouts/stdout.22 | 25 +++++++++++++++++ test/doctests/stdouts/stdout.23 | 25 +++++++++++++++++ test/doctests/stdouts/stdout.24 | 48 +++++++++++++++++++++++++++++++++ test/doctests/stdouts/stdout.25 | 48 +++++++++++++++++++++++++++++++++ 6 files changed, 180 insertions(+) create mode 100644 test/doctests/stdouts/stdout.21 create mode 100644 test/doctests/stdouts/stdout.22 create mode 100644 test/doctests/stdouts/stdout.23 create mode 100644 test/doctests/stdouts/stdout.24 create mode 100644 test/doctests/stdouts/stdout.25 diff --git a/test/doctests/doctests.jl b/test/doctests/doctests.jl index 4843ae268c..d03443a6b1 100644 --- a/test/doctests/doctests.jl +++ b/test/doctests/doctests.jl @@ -160,6 +160,33 @@ rfile(filename) = joinpath(@__DIR__, "stdouts", filename) @test success @test is_same_as_file(output, rfile("stdout.12")) end + + # Tests for doctest = :only. The outout should reflect that the docs themselves do not + # get built. + run_makedocs(["working.md"]; modules=[FooWorking], doctest = :only) do result, success, backtrace, output + @test success + @test is_same_as_file(output, rfile("stdout.21")) + end + + run_makedocs(["working.md"]; modules=[FooBroken], doctest = :only) do result, success, backtrace, output + @test !success + @test is_same_as_file(output, rfile("stdout.22")) + end + + run_makedocs(["broken.md"]; modules=[FooWorking], doctest = :only) do result, success, backtrace, output + @test !success + @test is_same_as_file(output, rfile("stdout.23")) + end + + run_makedocs(["broken.md"]; modules=[FooBroken], doctest = :only) do result, success, backtrace, output + @test !success + @test is_same_as_file(output, rfile("stdout.24")) + end + # strict gets ignored with doctest = :only + run_makedocs(["broken.md"]; modules=[FooBroken], doctest = :only, strict=false) do result, success, backtrace, output + @test !success + @test is_same_as_file(output, rfile("stdout.25")) + end end end # module diff --git a/test/doctests/stdouts/stdout.21 b/test/doctests/stdouts/stdout.21 new file mode 100644 index 0000000000..145d4cdbc1 --- /dev/null +++ b/test/doctests/stdouts/stdout.21 @@ -0,0 +1,7 @@ +[ Info: SetupBuildDirectory: setting up build directory. +[ Info: Doctest: running doctests. +[ Info: Skipped ExpandTemplates step (doctest only). +[ Info: Skipped CrossReferences step (doctest only). +[ Info: Skipped CheckDocument step (doctest only). +[ Info: Skipped Populate step (doctest only). +[ Info: Skipped RenderDocument step (doctest only). diff --git a/test/doctests/stdouts/stdout.22 b/test/doctests/stdouts/stdout.22 new file mode 100644 index 0000000000..aa8ce4a368 --- /dev/null +++ b/test/doctests/stdouts/stdout.22 @@ -0,0 +1,25 @@ +[ Info: SetupBuildDirectory: setting up build directory. +[ Info: Doctest: running doctests. +┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests/src/FooBroken.jl:6-9 +│ +│ ```jldoctest +│ julia> 2 + 2 +│ 42 +│ ``` +│ +│ Subexpression: +│ +│ 2 + 2 +│ +│ Evaluated output: +│ +│ 4 +│ +│ Expected output: +│ +│ 42 +│ +│ diff = +│ Warning: Diff output requires color. +│ 424 +└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336 diff --git a/test/doctests/stdouts/stdout.23 b/test/doctests/stdouts/stdout.23 new file mode 100644 index 0000000000..617e4cf912 --- /dev/null +++ b/test/doctests/stdouts/stdout.23 @@ -0,0 +1,25 @@ +[ Info: SetupBuildDirectory: setting up build directory. +[ Info: Doctest: running doctests. +┌ Error: doctest failure in src/broken.md:3-6 +│ +│ ```jldoctest +│ julia> 2 + 2 +│ -6 +│ ``` +│ +│ Subexpression: +│ +│ 2 + 2 +│ +│ Evaluated output: +│ +│ 4 +│ +│ Expected output: +│ +│ -6 +│ +│ diff = +│ Warning: Diff output requires color. +│ -64 +└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336 diff --git a/test/doctests/stdouts/stdout.24 b/test/doctests/stdouts/stdout.24 new file mode 100644 index 0000000000..27a25c5cc3 --- /dev/null +++ b/test/doctests/stdouts/stdout.24 @@ -0,0 +1,48 @@ +[ Info: SetupBuildDirectory: setting up build directory. +[ Info: Doctest: running doctests. +┌ Error: doctest failure in src/broken.md:3-6 +│ +│ ```jldoctest +│ julia> 2 + 2 +│ -6 +│ ``` +│ +│ Subexpression: +│ +│ 2 + 2 +│ +│ Evaluated output: +│ +│ 4 +│ +│ Expected output: +│ +│ -6 +│ +│ diff = +│ Warning: Diff output requires color. +│ -64 +└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336 +┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests/src/FooBroken.jl:6-9 +│ +│ ```jldoctest +│ julia> 2 + 2 +│ 42 +│ ``` +│ +│ Subexpression: +│ +│ 2 + 2 +│ +│ Evaluated output: +│ +│ 4 +│ +│ Expected output: +│ +│ 42 +│ +│ diff = +│ Warning: Diff output requires color. +│ 424 +└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336 diff --git a/test/doctests/stdouts/stdout.25 b/test/doctests/stdouts/stdout.25 new file mode 100644 index 0000000000..27a25c5cc3 --- /dev/null +++ b/test/doctests/stdouts/stdout.25 @@ -0,0 +1,48 @@ +[ Info: SetupBuildDirectory: setting up build directory. +[ Info: Doctest: running doctests. +┌ Error: doctest failure in src/broken.md:3-6 +│ +│ ```jldoctest +│ julia> 2 + 2 +│ -6 +│ ``` +│ +│ Subexpression: +│ +│ 2 + 2 +│ +│ Evaluated output: +│ +│ 4 +│ +│ Expected output: +│ +│ -6 +│ +│ diff = +│ Warning: Diff output requires color. +│ -64 +└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336 +┌ Error: doctest failure in ~/Julia/JuliaDocs/Documenter/test/doctests/src/FooBroken.jl:6-9 +│ +│ ```jldoctest +│ julia> 2 + 2 +│ 42 +│ ``` +│ +│ Subexpression: +│ +│ 2 + 2 +│ +│ Evaluated output: +│ +│ 4 +│ +│ Expected output: +│ +│ 42 +│ +│ diff = +│ Warning: Diff output requires color. +│ 424 +└ @ Documenter.DocTests ~/Julia/JuliaDocs/Documenter/src/DocTests.jl:336