Writing some tests yesterday I discovered the following weird behavior difference between a test inside and outside a @testset. This seems to be the case when returning a type (in this case Void) from the function being tested.
I realized I was making a mistake and should return nothing
instead, but I think still the two tests should pass in this case, or I’m misunderstanding something. This is in Julia v0.6.1 and also in the latest v0.5:
function someFunction(vec::Vector{String})
@assert length(vec) > 1 "Vector too small"
# yes, I know this is a bit weird here
return Void
end
using Base.Test
@testset "Some test set" begin
# this will fail and say it didn't throw
@test_throws AssertionError someFunction(String[])
end
# this test will pass
@test_throws AssertionError someFunction(String[])