From b79bbdabea7d31d71f84a32751c590475df9ff6a Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 12 Aug 2020 18:30:56 +1200 Subject: [PATCH 1/6] Fix the nightly tests --- test/doctests/fix/broken.jl | 21 ++++++++--------- test/doctests/fix/broken.md | 19 ++++++++-------- test/doctests/fix/fixed.jl | 45 ++++++++++++++++++++++--------------- test/doctests/fix/fixed.md | 40 ++++++++++++++++++++------------- 4 files changed, 72 insertions(+), 53 deletions(-) diff --git a/test/doctests/fix/broken.jl b/test/doctests/fix/broken.jl index 9d4e264da5..5ce0911872 100644 --- a/test/doctests/fix/broken.jl +++ b/test/doctests/fix/broken.jl @@ -1,14 +1,15 @@ module Foo """ ```jldoctest -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 1 2 3 4 -julia> Int64[1, 2, 3, 4] +julia> reshape(Int64[1, 2, 3, 4], (4,1,1)) 4-element Array{Int64,1}: 1 2 @@ -16,14 +17,14 @@ julia> Int64[1, 2, 3, 4] 4 ``` ```jldoctest -julia> Int64[1, 2, 3, 4] +julia> reshape(Int64[1, 2, 3, 4], (4,1,1)) 4-element Array{Int64,1}: 1 2 3 4 -julia> Int64[1, 2, 3, 4] * 2 +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) 4-element Array{Int64,1}: 1 2 @@ -31,14 +32,14 @@ julia> Int64[1, 2, 3, 4] * 2 4 ``` ```jldoctest -julia> Int64[1, 2, 3, 4] * 2 +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) 4-element Array{Int64,1}: 1 2 3 4 -julia> Int64[1, 2, 3, 4] * 2 +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) 4-element Array{Int64,1}: 1 2 @@ -47,7 +48,7 @@ julia> Int64[1, 2, 3, 4] * 2 ``` ```jldoctest julia> begin - Int64[1, 2, 3, 4] * 2 + reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) end 4-element Array{Int64,1}: 1 @@ -56,7 +57,7 @@ julia> begin 4 ``` ```jldoctest -Int64[1, 2, 3, 4] * 2 +reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) # output @@ -81,7 +82,7 @@ foo() = 1 """ ```jldoctest julia> begin - Int64[1, 2, 3, 4] * 2 + reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) end 4-element Array{Int64,1}: 1 diff --git a/test/doctests/fix/broken.md b/test/doctests/fix/broken.md index c1d46eb243..6e74e34b8d 100644 --- a/test/doctests/fix/broken.md +++ b/test/doctests/fix/broken.md @@ -3,14 +3,15 @@ DocTestFixTest.Foo.foo ``` ```jldoctest -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 1 2 3 4 -julia> Int64[1, 2, 3, 4] +julia> reshape(Int64[1, 2, 3, 4], (4,1,1)) 4-element Array{Int64,1}: 1 2 @@ -18,14 +19,14 @@ julia> Int64[1, 2, 3, 4] 4 ``` ```jldoctest -julia> Int64[1, 2, 3, 4] +julia> reshape(Int64[1, 2, 3, 4], (4,1,1)) 4-element Array{Int64,1}: 1 2 3 4 -julia> Int64[1, 2, 3, 4] * 2 +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) 4-element Array{Int64,1}: 1 2 @@ -33,14 +34,14 @@ julia> Int64[1, 2, 3, 4] * 2 4 ``` ```jldoctest -julia> Int64[1, 2, 3, 4] * 2 +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) 4-element Array{Int64,1}: 1 2 3 4 -julia> Int64[1, 2, 3, 4] * 2 +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) 4-element Array{Int64,1}: 1 2 @@ -49,7 +50,7 @@ julia> Int64[1, 2, 3, 4] * 2 ``` ```jldoctest julia> begin - Int64[1, 2, 3, 4] * 2 + reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) end 4-element Array{Int64,1}: 1 @@ -58,7 +59,7 @@ julia> begin 4 ``` ```jldoctest -Int64[1, 2, 3, 4] * 2 +reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) # output diff --git a/test/doctests/fix/fixed.jl b/test/doctests/fix/fixed.jl index c6852bf8a5..7e1a7eff7d 100644 --- a/test/doctests/fix/fixed.jl +++ b/test/doctests/fix/fixed.jl @@ -1,45 +1,51 @@ module Foo """ ```jldoctest -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 8 -julia> Int64[1, 2, 3, 4] -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4], (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 1 2 3 4 ``` ```jldoctest -julia> Int64[1, 2, 3, 4] -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4], (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 1 2 3 4 -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 8 ``` ```jldoctest -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 8 -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 @@ -47,20 +53,22 @@ julia> Int64[1, 2, 3, 4] * 2 ``` ```jldoctest julia> begin - Int64[1, 2, 3, 4] * 2 + reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) end -4-element Array{Int64,1}: +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 8 ``` ```jldoctest -Int64[1, 2, 3, 4] * 2 +reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) # output -4-element Array{Int64,1}: +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 @@ -83,9 +91,10 @@ foo() = 1 """ ```jldoctest julia> begin - Int64[1, 2, 3, 4] * 2 + reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) end - 4-element Array{Int64,1}: + 4×1×1 Array{Int64,3}: + [:, :, 1] = 2 4 6 diff --git a/test/doctests/fix/fixed.md b/test/doctests/fix/fixed.md index d9f8b2d313..3227ffb4a9 100644 --- a/test/doctests/fix/fixed.md +++ b/test/doctests/fix/fixed.md @@ -3,45 +3,51 @@ DocTestFixTest.Foo.foo ``` ```jldoctest -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 8 -julia> Int64[1, 2, 3, 4] -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4], (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 1 2 3 4 ``` ```jldoctest -julia> Int64[1, 2, 3, 4] -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4], (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 1 2 3 4 -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 8 ``` ```jldoctest -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 8 -julia> Int64[1, 2, 3, 4] * 2 -4-element Array{Int64,1}: +julia> reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 @@ -49,20 +55,22 @@ julia> Int64[1, 2, 3, 4] * 2 ``` ```jldoctest julia> begin - Int64[1, 2, 3, 4] * 2 + reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) end -4-element Array{Int64,1}: +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 8 ``` ```jldoctest -Int64[1, 2, 3, 4] * 2 +reshape(Int64[1, 2, 3, 4] * 2, (4,1,1)) # output -4-element Array{Int64,1}: +4×1×1 Array{Int64,3}: +[:, :, 1] = 2 4 6 From d199f72228ed590f572816dd5a72f2d5e5b1867b Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 12 Aug 2020 18:38:51 +1200 Subject: [PATCH 2/6] Run the doctest fixing tests more quietly --- test/doctests/fix/tests.jl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/doctests/fix/tests.jl b/test/doctests/fix/tests.jl index 6e02cbc934..903d32442a 100644 --- a/test/doctests/fix/tests.jl +++ b/test/doctests/fix/tests.jl @@ -2,8 +2,10 @@ # # DOCUMENTER_TEST_DEBUG= JULIA_DEBUG=all julia test/doctests/fix/tests.jl # +isdefined(@__MODULE__, :TestUtilities) || (include("../../TestUtilities.jl"); using .TestUtilities) module DocTestFixTest using Documenter, Test +using ..TestUtilities: @quietly function test_doctest_fix(dir) srcdir = mktempdir(dir) @@ -30,15 +32,12 @@ function test_doctest_fix(dir) @test read(joinpath(srcdir, "src.jl"), String) == read(joinpath(@__DIR__, "fixed.jl"), String) end -println("="^50) -@info("Testing `doctest = :fix`") +@info "Testing `doctest = :fix` in $(@__FILE__)" if haskey(ENV, "DOCUMENTER_TEST_DEBUG") # in this mode the directories remain test_doctest_fix(mktempdir(@__DIR__)) else - mktempdir(test_doctest_fix, @__DIR__) + @quietly mktempdir(test_doctest_fix, @__DIR__) end -@info("Done testing `doctest = :fix`") -println("="^50) end # module From 0f402987d98314f7a7bd93d79ab41a163580fd14 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 12 Aug 2020 19:08:35 +1200 Subject: [PATCH 3/6] Run Appveyor with 1.5 --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 746cb95dc8..59b895272d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ environment: matrix: - julia_version: 1.0 - - julia_version: 1.4 + - julia_version: 1.5 - julia_version: nightly platform: From 253acfbfdbdee160ba476c11853f03293577dc68 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 12 Aug 2020 19:17:15 +1200 Subject: [PATCH 4/6] Also handle 1.6 stacktraces It seems that on 1.6, the filename and line number are on a separate line, with an @ in the beginning. The updated regex should handle both the old and new stacktraces. --- test/doctests/doctests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/doctests/doctests.jl b/test/doctests/doctests.jl index b0eea4f0e6..9f26390555 100644 --- a/test/doctests/doctests.jl +++ b/test/doctests/doctests.jl @@ -73,7 +73,7 @@ function onormalize(s) s = replace(s, r"(@ Documenter.DocTests )(.*)$"m => s"\1{PATH}") # Remove stacktraces - s = replace(s, r"(│\s+Stacktrace:)(\n(│\s+)\[[0-9]+\].*)+" => s"\1\\n\3{STACKTRACE}") + s = replace(s, r"(│\s+Stacktrace:)(\n(│\s+)\[[0-9]+\].*)(\n(│\s+)@.*)?+" => s"\1\\n\3{STACKTRACE}") return s end From 57c09d37a9851d3f04d47f37ff8470b9b4a7bd39 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 12 Aug 2020 19:21:27 +1200 Subject: [PATCH 5/6] Use MathJax2 constructor in HTMLWriter tests This removes the deprecation warnings from test logs. --- test/htmlwriter.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/htmlwriter.jl b/test/htmlwriter.jl index 6efa897c14..be38281cb8 100644 --- a/test/htmlwriter.jl +++ b/test/htmlwriter.jl @@ -74,7 +74,7 @@ end @test haskey(katex.config, :foo) end - let mathjax = MathJax() + let mathjax = MathJax2() @test length(mathjax.config) == 5 @test haskey(mathjax.config, :tex2jax) @test haskey(mathjax.config, :config) @@ -82,7 +82,7 @@ end @test haskey(mathjax.config, :extensions) @test haskey(mathjax.config, :TeX) end - let mathjax = MathJax(Dict(:foo => 1)) + let mathjax = MathJax2(Dict(:foo => 1)) @test length(mathjax.config) == 6 @test haskey(mathjax.config, :tex2jax) @test haskey(mathjax.config, :config) @@ -91,7 +91,7 @@ end @test haskey(mathjax.config, :TeX) @test haskey(mathjax.config, :foo) end - let mathjax = MathJax(Dict(:tex2jax => 1, :foo => 2)) + let mathjax = MathJax2(Dict(:tex2jax => 1, :foo => 2)) @test length(mathjax.config) == 6 @test haskey(mathjax.config, :tex2jax) @test haskey(mathjax.config, :config) From 0b99f6a7b30438cca6ed7edbe71dc36776879c21 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 12 Aug 2020 19:52:50 +1200 Subject: [PATCH 6/6] Test for log entries in expand_versions output This removes them from the output. --- test/htmlwriter.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/htmlwriter.jl b/test/htmlwriter.jl index be38281cb8..904798bbf1 100644 --- a/test/htmlwriter.jl +++ b/test/htmlwriter.jl @@ -145,7 +145,11 @@ end verify_version_file(versionfile, entries) versions = ["v^", "devel" => "dev", "foobar", "foo" => "bar"] - entries, symlinks = expand_versions(tmpdir, versions) + entries, symlinks = @test_logs( + (:warn, "no match for `versions` entry `\"foobar\"`"), + (:warn, "no match for `versions` entry `\"foo\" => \"bar\"`"), + expand_versions(tmpdir, versions) + ) @test entries == ["v2.1", "devel"] @test ("v2.1" => "2.1.1") in symlinks @test ("devel" => "dev") in symlinks