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

@debug the next REPL line before evaling it #2179

Merged
merged 4 commits into from
Jul 13, 2023
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
2 changes: 2 additions & 0 deletions src/DocTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ end
function eval_repl(block, sandbox, meta::Dict, doc::Documenter.Document, page)
for (input, output) in repl_splitter(block.code)
result = Result(block, input, output, meta[:CurrentFile])
src_lines = Documenter.find_block_in_file(result.block.code, result.file)
Copy link
Contributor Author

@musoke musoke Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, this would be more like

src_lines = Documenter.find_block_in_file(input, result.file)

to narrow down the exact line, but find_block_in_file finds the first match in the file, so lines that appear in more than one doctest are wrong. E.g. initial using statements.

As written, there may still be slight confusion if the same line appears twice in one doctest or major confusion if one doctest appears as a subset of another.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result.block should be the same as block, so maybe we can move this outside of the for loop? In other words, it's looking for the line range of the whole jldoctest code block anyway, right?

@debug "Evaluating doctest REPL line from $(Documenter.locrepr(result.file, src_lines))" input expected_output = output
for (ex, str) in Documenter.parseblock(input, doc, page; keywords = false, raise=false)
# Input containing a semi-colon gets suppressed in the final output.
result.hide = REPL.ends_with_semicolon(str)
Expand Down