JuliaDocs/Documenter.jl

Add option to `doctest` individual functions

Open

#1,213 建立於 2019年12月12日

在 GitHub 查看
 (2 留言) (4 反應) (0 負責人)Julia (513 fork)batch import
Type: Enhancementhelp wanted

倉庫指標

Star
 (910 star)
PR 合併指標
 (平均合併 16天 9小時) (30 天內合併 3 個 PR)

描述

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.

貢獻者指南