JuliaDocs/Documenter.jl

Feature request: jldoctest examples without testing against expected results

Open

#452 opened on Mar 20, 2017

View on GitHub
 (16 comments) (5 reactions) (0 assignees)Julia (910 stars) (513 forks)batch import
Type: Enhancementhelp wanted

Description

Hi!

I want to add examples to my functions, but in many cases it is hard or not necessary to test the expected output. However, it may still be useful to test whether the functions/examples runs through or crashes. Is it possible to have a jldoctest with such a behavior? Perhaps by omitting the line(s) with expected outcomes as shown below:

"""
    func_with_untestable_output(invar)

```jldoctest
julia> func_with_untestable_output(invar)
# Nothing to test against
```
"""
function func_with_untestable_output(invar) ...

The behavior I am looking for is the equivalent to adding this piece of "code" to the markdown documents:

```@example
a = 1
b = 2
a + b
nothing # hide
```

However, I think it is more convenient to place the examples and testing whether they work or not directly in the files containing the Julia code, rather than in the markdown documents.

Contributor guide