Skip to content

Commit 06b4562

Browse files
committed
add docstrings for @addtest and runtests()
1 parent 43b0129 commit 06b4562

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/InlineTest.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,31 @@ function addtest(args::Tuple, m::Module)
2222
nothing
2323
end
2424

25+
"""
26+
@addtest args...
27+
28+
Similar to `@testset args...`, but the contained tests are not run immediately,
29+
and are instead stored for later execution, triggered by `runtests()`.
30+
Invocations of `@addtest` should appear only at the top level, and not be nested
31+
(`@testset` can be nested within `@addtest`).
32+
Internally, `@addtest` is converted to `@testset` at execution time.
33+
"""
2534
macro addtest(args...)
2635
Expr(:call, :addtest, args, __module__)
2736
end
2837

38+
"""
39+
runtests([m::Module]; [wrap::Bool])
40+
41+
Run all the tests declared in `@addtest` blocks, within `m` if specified,
42+
or within all currently loaded modules otherwise.
43+
The `wrap` keyword specifies whether the collection of `@testset` blocks derived
44+
from `@addtest` declarations should be grouped within a top-level `@testset`.
45+
The default is `wrap=false` when `m` is specified, `true` otherwise.
46+
47+
Note: this function executes each `@testset` block using `eval` *within* the module
48+
in which the corresponding `@addtest` block was written (e.g. `m`, when specified).
49+
"""
2950
function runtests(m::Module; wrap::Bool=false)
3051
Core.eval(m,
3152
if wrap

0 commit comments

Comments
 (0)