Skip to content

Commit ad791da

Browse files
committed
Add example of testing a fail()
1 parent 7920764 commit ad791da

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

doc/Language/testing.pod

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,12 @@ as a type object, or as a string containing its type name.
290290
291291
If an exception was thrown, it will also try to match the matcher hash, in
292292
which the key is the name of the method to be called on the exception, and
293-
the value is the value it should have to pass.
293+
the value is the value it should have to pass. For example:
294+
295+
=begin code
296+
sub frodo { fail "Oops. Frodo dies" unless $destroys-ring };
297+
throws-like { frodo }, Exception, message => /dies/;
298+
=end code
294299
295300
=comment Someone needs to clarify the preceding paragraph, because I have
296301
no idea what it is talking about... ;)

0 commit comments

Comments
 (0)