Skip to content

Base.Test does not support continue statement #17908

@rprechelt

Description

@rprechelt

Using Base.Test on master,

@testset "Testing 1..3" for i=1:3
           @test 1 == 1
       end

results in

Test Summary: | Pass  Total
  Testing 1..3 |    1      1
Test Summary: | Pass  Total
  Testing 1..3 |    1      1
Test Summary: | Pass  Total
  Testing 1..3 |    1      1

as expected. However, adding a continue statement set to trigger on i=2, causes the whole testset to stop on i=2 and not continue to i=3.

@testset "Testing 1..3" for i=1:3
           if i%2 == 0
               continue
           end
           @test 1 == 1
       end

results in

Test Summary: | Pass  Total
  Testing 1..3 |    1      1

Furthermore, once I have run one testset in a REPL that contained a call to continue, any regular (non-continued) testset now returns Nothing. i.e.

@testset "Testing 1..3" for i=1:3
           @test 1 == 1
       end

returns

3-element Array{Union{Base.Test.DefaultTestSet,Base.Test.FallbackTestSet,Void},1}:
 nothing
 nothing
 nothing

and does not print any test results to the terminal.

I can confirm that this also happens on release-0.5

Maybe having the continue statement not interact with a testset is by design, but having one testset with a continue make all future REPL testset's not correct is definitely a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    REPLJulia's REPL (Read Eval Print Loop)bugIndicates an unexpected problem or unintended behaviortestsystemThe unit testing framework and Test stdlib

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions