JuliaDocs/Documenter.jl

Add option to `doctest` individual functions

Open

#1213 aperta il 12 dic 2019

Vedi su GitHub
 (2 commenti) (4 reazioni) (0 assegnatari)Julia (513 fork)batch import
Type: Enhancementhelp wanted

Metriche repository

Star
 (910 star)
Metriche merge PR
 (Merge medio 16g 9h) (3 PR mergiate in 30 g)

Descrizione

It'd be nice if one could do something the following at the REPL:

julia> begin
       """
          f(x)

       add `1` to `x`
       ```jldoctest
       julia> f(1)
       2
       ```
       """
       f(x) = x + 1
       end
f

julia> doctest(f)
┌ Info: Testing the documentation for f: total 1 test
└ Test passed!
true

This way, one can use the doctest functionality without having to do all the other things documenter seems to require like having the function in a package, making doc directories, etc.

Guida contributor