@@ -57,7 +57,7 @@ function Base.show(io::IO, t::Pass)
57
57
end
58
58
59
59
"""
60
- Pass
60
+ Fail
61
61
62
62
The test condition was false, i.e. the expression evaluated to false or
63
63
the correct exception was not thrown.
71
71
function Base. show (io:: IO , t:: Fail )
72
72
print_with_color (:red , io, " Test Failed\n " )
73
73
print (io, " Expression: " , t. orig_expr)
74
- if t. test_type == :test_throws
75
- # Either no exception, or wrong exception
74
+ if t. test_type == :test_throws_wrong
75
+ # An exception was thrown, but it was of the wrong type
76
76
print (io, " \n Expected: " , t. expr)
77
77
print (io, " \n Thrown: " , typeof (t. value))
78
+ elseif t. test_type == :test_throws_nothing
79
+ # An exception was expected, but no exception was thrown
80
+ print (io, " \n Expected: " , t. expr)
81
+ print (io, " \n No exception thrown" )
78
82
elseif ! isa (t. expr, Expr)
79
83
# Maybe just a constant, like false
80
84
print (io, " \n Evaluated: " , t. expr)
@@ -212,14 +216,14 @@ function do_test_throws(predicate, orig_expr, bt, extype)
212
216
try
213
217
predicate ()
214
218
# If we hit this line, no exception was thrown. We treat
215
- # this as equivalent to the wrong exception being thrown.
216
- Fail (:test_throws , orig_expr, extype, nothing )
219
+ # this a failure equivalent to the wrong exception being thrown.
220
+ Fail (:test_throws_nothing , orig_expr, extype, nothing )
217
221
catch err
218
222
# Check the right type of exception was thrown
219
223
if isa (err, extype)
220
224
Pass (:test_throws , orig_expr, extype, err)
221
225
else
222
- Fail (:test_throws , orig_expr, extype, err)
226
+ Fail (:test_throws_wrong , orig_expr, extype, err)
223
227
end
224
228
end )
225
229
end
0 commit comments