Looking at the documentation, @test_warn
can’t test warnings generated with @warn
. You could use @test_logs
instead:
julia> @test_logs (:warn, "use an argument") foo()
1
(you should also be able to use @test_deprecated
in this situation, but then I think your message would have to be formatted more like deprecation warnings coming from @deprecate
)