Skip to content

Commit

Permalink
Better failure diagnostics for error paths in replutil tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Jul 12, 2017
1 parent d4229be commit c437fc4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/replutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,14 @@ macro except_str(expr, err_type)
end

macro except_strbt(expr, err_type)
errmsg = "expected failure, but no exception thrown for $expr"
return quote
let err = nothing
try
$(esc(expr))
catch err
end
err === nothing && error("expected failure, but no exception thrown")
err === nothing && error($errmsg)
@test typeof(err) === $(esc(err_type))
buf = IOBuffer()
showerror(buf, err, catch_backtrace())
Expand Down

0 comments on commit c437fc4

Please sign in to comment.