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

Doctest syntax error, how to find out where? #1556

Closed
fingolfin opened this issue Mar 18, 2021 · 1 comment · Fixed by #1557
Closed

Doctest syntax error, how to find out where? #1556

fingolfin opened this issue Mar 18, 2021 · 1 comment · Fixed by #1557

Comments

@fingolfin
Copy link
Contributor

(With Julia 1.5.4 and Documenter v0.26.3 on macOS 10.14.16)

I am running doctests in package where they were disabled for some times (due to issues), with the goal of making them pass again and enabling them again in CI.

Unfortunately, they run into an error, presumably a syntax error in one of the doctests. But I have no idea how to locate them from here.

Any ideas how to do that? Perhaps the doctest function could be modified to catch the exception and throw a different, nicer error indicating the location of the offending doctest?

...
[ Info: Doctest: running doctests.
ERROR: LoadError: LoadError: Base.Meta.ParseError("unexpected \",\"")
Stacktrace:
 [1] parse(::String, ::Int64; greedy::Bool, raise::Bool, depwarn::Bool) at ./meta.jl:184
 [2] parse(::String; raise::Bool, depwarn::Bool) at ./meta.jl:215
 [3] parse at ./meta.jl:215 [inlined]
 [4] doctest(::Documenter.DocTests.DocTestContext, ::Documenter.Utilities.Markdown2.CodeBlock) at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/DocTests.jl:142
 [5] (::Documenter.DocTests.var"#1#2"{Documenter.DocTests.DocTestContext})(::Documenter.Utilities.Markdown2.CodeBlock) at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/DocTests.jl:112
 [6] walk(::Documenter.DocTests.var"#1#2"{Documenter.DocTests.DocTestContext}, ::Documenter.Utilities.Markdown2.CodeBlock) at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/Utilities/Markdown2.jl:297
 [7] walk(::Function, ::Array{Documenter.Utilities.Markdown2.MarkdownBlockNode,1}) at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/Utilities/Markdown2.jl:306
 [8] walk(::Documenter.DocTests.var"#1#2"{Documenter.DocTests.DocTestContext}, ::Documenter.Utilities.Markdown2.MD) at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/Utilities/Markdown2.jl:299
 [9] doctest at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/DocTests.jl:109 [inlined]
 [10] doctest(::Base.Docs.DocStr, ::Module, ::Document) at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/DocTests.jl:89
 [11] doctest(::Documenter.Documents.DocumentBlueprint, ::Document) at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/DocTests.jl:57
 [12] runner(::Type{Documenter.Builder.Doctest}, ::Document) at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/Builder.jl:214
 [13] dispatch(::Type{Documenter.Builder.DocumentPipeline}, ::Document) at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/Utilities/Selectors.jl:170
 [14] #2 at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/Documenter.jl:249 [inlined]
 [15] cd(::Documenter.var"#2#3"{Document}, ::String) at ./file.jl:104
 [16] #makedocs#1 at /Users/mhorn/.julia/packages/Documenter/bFHi4/src/Documenter.jl:248 [inlined]
...
@KristofferC
Copy link
Member

The error is a syntax error somewhere in the <<<>>> part as shown below:

```jldoctest name; <<<key1 = value1, key2 = value2>>>
julia> 1+1
2
```

Should probably show where the error happens if this fails:

kwargs = Meta.parse("($(lang[nextind(lang, idx):end]),)")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants