Skip to content

Commit

Permalink
[bugfix] only pass line number to logger if code block was found, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ericphanson authored Sep 22, 2021
1 parent 50246d0 commit a7cb9a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/DocTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ import .Utilities.TextDiff
function report(result::Result, str, doc::Documents.Document)
diff = TextDiff.Diff{TextDiff.Words}(result.output, rstrip(str))
lines = Utilities.find_block_in_file(result.block.code, result.file)
line = lines === nothing ? nothing : first(lines)
@error("""
doctest failure in $(Utilities.locrepr(result.file, lines))
Expand All @@ -401,7 +402,7 @@ function report(result::Result, str, doc::Documents.Document)
$(result.output)
""", diff, _file=result.file, _line=lines[1])
""", diff, _file=result.file, _line=line)
end

function fix_doctest(result::Result, str, doc::Documents.Document)
Expand Down

0 comments on commit a7cb9a6

Please sign in to comment.