<NME> runtests.jl
<BEF> using Test

# Build the example docs
include("examples/make.jl")

# Test missing docs
include("missingdocs/make.jl")

# Primary @testset

# Error reporting.
println("="^50)
@info("The following errors are expected output.")
include(joinpath("errors", "make.jl"))
@info("END of expected error output.")
println("="^50)

@testset "Documenter" begin
    # Unit tests for module internals.
    include("utilities.jl")
    include("markdown2.jl")
    include("navnode.jl")

    # DocSystem unit tests.
    include("docsystem.jl")

    # CrossReferences
    include("crossreferences.jl")

    # DocTest unit tests.
    @info "Running tests in doctests/"
    include("doctests/docmeta.jl")
    include("doctests/doctestapi.jl")
    include("doctests/doctests.jl")
    include("doctests/fix/tests.jl")

    # DOM Tests.
    include("dom.jl")

    # MDFlatten tests.
    # MDFlatten tests.
    include("mdflatten.jl")

    # HTMLWriter
    include("htmlwriter.jl")

    include("latexwriter.jl")

    # Deployment configurations
    include("deployconfig.jl")
    include("deploydocs.jl")

    # Mock package docs.
    include("examples/tests.jl")

    # A simple build outside of a Git repository
    @info "Building nongit/tests.jl"

    # Passing a writer positionally (https://github.com/JuliaDocs/Documenter.jl/issues/1046)
    @test_throws ArgumentError makedocs(sitename="", HTML())
end

# Additional tests

## `Markdown.MD` to `DOM.Node` conversion tests.
module MarkdownToNode
    import Documenter.DocSystem
    import Documenter.Writers.HTMLWriter: mdconvert

    # Exhaustive Conversion from Markdown to Nodes.
    for mod in Base.Docs.modules
        for (binding, multidoc) in DocSystem.getmeta(mod)
            for (typesig, docstr) in multidoc.docs
                md = DocSystem.parsedoc(docstr)
                string(mdconvert(md))
            end
        end
    end
end

# Docstring signature syntax highlighting tests.
module HighlightSig
    using Test
    import Markdown
    import Documenter.Expanders: highlightsig!

    @testset "highlightsig!" begin
        s = """
                foo(bar::Baz)
            ---
                foo(bar::Baz)
            """
        original = Markdown.parse(s)
        md = Markdown.parse(s)
        highlightsig!(md)
        @test isempty(original.content[1].language)
        @test md.content[1].language == "julia"
        @test original.content[end].language == md.content[end].language

        s = """
            ```lang
             foo(bar::Baz)
            ```
            """
        original = Markdown.parse(s)
        md = Markdown.parse(s)
        highlightsig!(md)
        @test original == md
    end
end

include("manual.jl")
    @test_throws ArgumentError makedocs(sitename="", HTML())

    # Running doctest() on our own manual
    @info "doctest() Documenter's manual"
    @quietly include("manual.jl")
end

<MSG> Clean up the tests a bit (#1098)

* Move MD -> DOM conversion tests to htmlwriter.jl

* Move highlightsig! tests to expanders.jl

This way we now have everything in a single testset again.

* Make example building less verbose

* Actually move HighlightSig

* Put at-quietly into a separate file

<DFF> @@ -1,21 +1,26 @@
 using Test
+import Documenter
+include("TestUtilities.jl"); using .TestUtilities
 
-# Build the example docs
-include("examples/make.jl")
+@testset "Documenter" begin
+    # Test TestUtilities
+    TestUtilities.test()
 
-# Test missing docs
-include("missingdocs/make.jl")
+    # Build the example docs
+    @info "Building example/make.jl"
+    include("examples/make.jl")
 
-# Primary @testset
+    # Test missing docs
+    @info "Building missingdocs/make.jl"
+    @quietly include("missingdocs/make.jl")
 
-# Error reporting.
-println("="^50)
-@info("The following errors are expected output.")
-include(joinpath("errors", "make.jl"))
-@info("END of expected error output.")
-println("="^50)
+    # Error reporting.
+    println("="^50)
+    @info("The following errors are expected output.")
+    include("errors/make.jl")
+    @info("END of expected error output.")
+    println("="^50)
 
-@testset "Documenter" begin
     # Unit tests for module internals.
     include("utilities.jl")
     include("markdown2.jl")
@@ -41,6 +46,9 @@ println("="^50)
     # MDFlatten tests.
     include("mdflatten.jl")
 
+    # Expanders
+    include("expanders.jl")
+
     # HTMLWriter
     include("htmlwriter.jl")
 
@@ -58,55 +66,7 @@ println("="^50)
 
     # Passing a writer positionally (https://github.com/JuliaDocs/Documenter.jl/issues/1046)
     @test_throws ArgumentError makedocs(sitename="", HTML())
-end
 
-# Additional tests
-
-## `Markdown.MD` to `DOM.Node` conversion tests.
-module MarkdownToNode
-    import Documenter.DocSystem
-    import Documenter.Writers.HTMLWriter: mdconvert
-
-    # Exhaustive Conversion from Markdown to Nodes.
-    for mod in Base.Docs.modules
-        for (binding, multidoc) in DocSystem.getmeta(mod)
-            for (typesig, docstr) in multidoc.docs
-                md = DocSystem.parsedoc(docstr)
-                string(mdconvert(md))
-            end
-        end
-    end
+    # Running doctest() on our own manual
+    include("manual.jl")
 end
-
-# Docstring signature syntax highlighting tests.
-module HighlightSig
-    using Test
-    import Markdown
-    import Documenter.Expanders: highlightsig!
-
-    @testset "highlightsig!" begin
-        s = """
-                foo(bar::Baz)
-            ---
-                foo(bar::Baz)
-            """
-        original = Markdown.parse(s)
-        md = Markdown.parse(s)
-        highlightsig!(md)
-        @test isempty(original.content[1].language)
-        @test md.content[1].language == "julia"
-        @test original.content[end].language == md.content[end].language
-
-        s = """
-            ```lang
-             foo(bar::Baz)
-            ```
-            """
-        original = Markdown.parse(s)
-        md = Markdown.parse(s)
-        highlightsig!(md)
-        @test original == md
-    end
-end
-
-include("manual.jl")

Clean up the tests a bit (#1098)