1Test::Unit::Assertion(3U)ser Contributed Perl DocumentatiToenst::Unit::Assertion(3)
2
3
4
6 Test::Unit::Assertion - The abstract base class for assertions
7
9 Any assertion class that expects to plug into Test::Unit::Assert needs
10 to implement this interface.
11
12 Required methods
13 new Creates a new assertion object. Takes whatever arguments you
14 desire. Isn't strictly necessary for the framework to work with
15 this class but is generally considered a good idea.
16
17 do_assertion
18 This is the important one. If Test::Unit::Assert::assert is called
19 with an object as its first argument then it does:
20
21 $_[0]->do_assertion(@_[1 .. $#_]) ||
22 $self->fail("Assertion failed");
23
24 This means that "do_assertion" should return true if the assertion
25 succeeds and false if it doesn't. Or, you can fail by throwing a
26 Test::Unit::Failure object, which will get caught further up the
27 stack and used to produce a sensible error report. Generally it's
28 good practice for do_assertion to die with a meaningful error on
29 assertion failure rather than just returning false.
30
32 Copyright (c) 2001 Piers Cawley <pdcawley@iterative-software.com>.
33
34 All rights reserved. This program is free software; you can
35 redistribute it and/or modify it under the same terms as Perl itself.
36
38 • Test::Unit::Assert
39
40 • Test::Unit::CodeRef
41
42 • Test::Unit::Regexp
43
44
45
46perl v5.34.0 2021-07-23 Test::Unit::Assertion(3)