I’m using Julia 0.6.0 and would like to know the equivalent of this code in 0.4.x (taken from https://docs.julialang.org/en/release-0.4/stdlib/test/#handlers)
julia> using Base.Test
julia> custom_handler(r::Test.Success) = println("Success on $(r.expr)")
custom_handler (generic function with 1 method)
julia> custom_handler(r::Test.Failure) = error("Error on custom handler: $(r.expr)")
custom_handler (generic function with 2 methods)
julia> custom_handler(r::Test.Error) = rethrow(r)
custom_handler (generic function with 3 methods)
julia> Test.with_handler(custom_handler) do
@test 1 == 1
@test 1 != 1
end
Success on :((1==1))
ERROR: Error on custom handler: :((1!=1))
in error at error.jl:21
in custom_handler at none:1
in do_test at test.jl:39
in anonymous at no file:3
in task_local_storage at task.jl:28
in with_handler at test.jl:24
I want to print custom messages on PASS/FAIL of each test.