Skip to content

Commit ee2719e

Browse files
committed
handle invalid zero-argument @testset
1 parent e8280f0 commit ee2719e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/ReTest.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ function parse_ts(source::LineNumberNode, mod::Module, args::Tuple, parent=nothi
130130
nothing, false
131131
end
132132

133+
isempty(args) &&
134+
return tserror("expected begin/end block or for loop as argument to @testset")
135+
133136
local desc
134137
options = Options()
135138
for arg in args[1:end-1]

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ end
830830
module TestsetErrors
831831
using ReTest
832832

833+
@testset
833834
@testset "a" notexistingoption=0 begin end
834835
@testset "b" {badsyntax} begin end
835836
@testset "c"
@@ -839,6 +840,7 @@ end
839840
@chapter "TestsetErrors" begin
840841
Test.@testset "TestsetErrors" begin
841842
@test_logs (
843+
:error, "expected begin/end block or for loop as argument to @testset") (
842844
:error, "unsupported @testset option") (
843845
:error, "unsupported @testset" ) (
844846
:error, "expected begin/end block or for loop as argument to @testset") (

0 commit comments

Comments
 (0)