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

use valid identifiers for sandbox module names #1540

Merged
merged 3 commits into from
Mar 2, 2021
Merged
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion src/DocTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ function doctest(ctx::DocTestContext, block_immutable::Markdown2.CodeBlock)
if startswith(lang, "jldoctest")
# Define new module or reuse an old one from this page if we have a named doctest.
name = match(r"jldoctest[ ]?(.*)$", split(lang, ';', limit = 2)[1])[1]
sym = isempty(name) ? gensym("doctest-") : Symbol("doctest-", name)
if isempty(name)
sym = Symbol("__doctest__", filter(!=('#'), string(gensym())))
JeffBezanson marked this conversation as resolved.
Show resolved Hide resolved
else
sym = Symbol("__doctest__", name)
JeffBezanson marked this conversation as resolved.
Show resolved Hide resolved
end
sandbox = get!(() -> Expanders.get_new_sandbox(sym), ctx.meta, sym)

# Normalise line endings.
Expand Down