Skip to content

Commit 43b0129

Browse files
committed
add a "wrap" option to runtests()
1 parent 04e27b9 commit 43b0129

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/InlineTest.jl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@ macro addtest(args...)
2626
Expr(:call, :addtest, args, __module__)
2727
end
2828

29-
function runtests(m::Module)
30-
tss = tests(m)
31-
tsm = :(@testset $("Tests for module $m") begin
32-
$(tss...)
33-
end)
34-
Core.eval(m, tsm)
29+
function runtests(m::Module; wrap::Bool=false)
30+
Core.eval(m,
31+
if wrap
32+
:(@testset $("Tests for module $m") begin
33+
$(tests(m)...)
34+
end)
35+
else
36+
Expr(:block, tests(m)...)
37+
end)
3538
nothing
3639
end
3740

38-
function runtests()
41+
function runtests(; wrap::Bool=true)
3942
foreach(values(Base.loaded_modules)) do m
4043
if isdefined(m, INLINE_TEST[]) # will automatically skip InlineTest and InlineTest.InlineTestTest
41-
ts = runtests(m)
44+
ts = runtests(m, wrap=wrap)
4245
end
4346
end
4447
end
@@ -57,6 +60,7 @@ end # module InlineTestTest
5760
@assert typeof(@__MODULE__) == Module
5861
@test 1 != 2
5962
runtests(InlineTestTest)
63+
runtests(InlineTestTest, wrap=true)
6064
end
6165

6266
end # module InlineTest

0 commit comments

Comments
 (0)