@test_warn, @test_nowarn, and @test_nothrow

testing

#1

Is there a way to test for warning throws? Like @test_throws does for exceptions.

Additionally, I would like tests that pass if a given code does not throw a Warning or an Exception. That is, I would also like a @test_does_not_throw (for exceptions) and a @test_does_not_warn (for warnings). How can I do these things?


#2

On 0.6 there is a @test_warn and a @test_nowarn. PR that implemented it at: https://github.com/JuliaLang/julia/pull/19903


#3

@kristoffer.carlsson Is there a @test_nothrow?


#4

That is basically @test


#5

It’s closer to @test_nowarn

Ref https://github.com/JuliaLang/julia/pull/19994#issuecomment-272322407
Ref https://github.com/JuliaLang/julia/issues/18780


#6

I don’t understand that. @test fails if a condition is false. That is not the same as failing if an exception is not thrown.


#7