JuliaDocs/Documenter.jl

`doctest(...; fix=true)` does not always work (escaping issues)

Open

#1.495 geöffnet am 9. Dez. 2020

Auf GitHub ansehen
 (1 Kommentar) (1 Reaktion) (0 zugewiesene Personen)Julia (513 Forks)batch import
Type: Bughelp wanted

Repository-Metriken

Stars
 (910 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 16T 9h) (3 gemergte PRs in 30 T)

Beschreibung

If you have a function like

module TestPkg

"""
    greet([io=stdout])

## Example

```jldoctest
julia> using TestPkg

julia> sprint(TestPkg.greet)
"Hello World! I am \"greet\""


```
"""
greet(io=stdout) = print(io, "Hello World! I am \"greet\"")

end # module

then the doctests fail and doctest(TestPkg; manual=false, fix=true) does not fix it (you need \\"greet\\" instead of \"greet\"). Also, putting in a @docs raw"""... block doesn't help.

Is this already known? I couldn't find an issue. It would be great if this worked, because I think doctests and fix=true are a great way to test printing things (because it's easy to update if you change the printing, and easy to read the test to check that it's printing how you think it should), but exactly this kind of escaping issue comes up if you test io methods with sprint (as I am in https://github.com/beacon-biosignals/KeywordSearch.jl/pull/11).

Contributor Guide