<NME> runtests.jl
<BEF> using Test
import Documenter
include("TestUtilities.jl"); using Main.TestUtilities

@testset "Documenter" begin
    # Build the example docs
    @info "Building example/make.jl"
    include("examples/make.jl")

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

    # Error reporting.
    @info "Building errors/make.jl"
    @quietly include("errors/make.jl")

    # Unit tests for module internals.
    include("except.jl")
    include("utilities.jl")
    include("remotes.jl")

    # DocChecks tests
    include("docchecks.jl")

    # NavNode tests.
    include("navnode.jl")
using Base.Test
using Compat

# setup
# =====

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

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

    # A simple build evaluating code outside build directory
    @info "Building workdir/tests.jl"
    @quietly include("workdir/tests.jl")

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

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

<MSG> Filter docstring based on module.

<DFF> @@ -28,6 +28,33 @@ using Lapidary
 using Base.Test
 using Compat
 
+
+# Unit tests for module internals.
+
+module UnitTests
+
+type T end
+
+"Lapidary unit tests."
+Base.length(::T) = 1
+
+end
+
+let doc = @doc(length)
+    a = Lapidary.filterdocs(doc, Module[])
+    b = Lapidary.filterdocs(doc, Module[UnitTests])
+    c = Lapidary.filterdocs(doc, Module[Base])
+    d = Lapidary.filterdocs(doc, Module[Tests])
+
+    @test a === doc
+    @test contains(stringmime("text/plain", b), "Lapidary unit tests.")
+    @test !contains(stringmime("text/plain", c), "Lapidary unit tests.")
+    @test d === nothing
+end
+
+
+# Integration tests for module api.
+
 # setup
 # =====
 

Filter docstring based on module.