Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backports for 0.8.9 #400

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DocChecks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ end

function result_to_string(buf, value)
dis = text_display(buf)
value === nothing || display(dis, value)
value === nothing || eval(Expr(:call, display, dis, QuoteNode(value)))
sanitise(buf)
end

Expand Down
20 changes: 20 additions & 0 deletions test/examples/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@ module AutoDocs
end
end

module Issue398

immutable TestType{T} end

function _show end
Base.show(io::IO, t::TestType) = _show(io, t)

macro define_show_and_make_object(x, y)
z = Expr(:quote, x)
esc(quote
$(Issue398)._show(io::IO, t::$(Issue398).TestType{$z}) = print(io, $y)
const $x = $(Issue398).TestType{$z}()
end)
end

export @define_show_and_make_object

end # module

# Build example docs
using Documenter

Expand All @@ -89,6 +108,7 @@ examples_markdown_doc = makedocs(
debug = true,
root = examples_root,
build = "builds/markdown",
doctest = false,
)

info("Building mock package docs: HTMLWriter")
Expand Down
13 changes: 13 additions & 0 deletions test/examples/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,16 @@ julia> fullname(Base.Pkg)
julia> current_module()
Main
```

# Issue398

```@meta
DocTestSetup = quote
using Issue398
end
```

```jldoctest
julia> @define_show_and_make_object q "abcd"
abcd
```