1Test2::Compare::Object(U3s)er Contributed Perl DocumentatTieosnt2::Compare::Object(3)
2
3
4

NAME

6       Test2::Compare::Object - Representation of an object during deep
7       comparison.
8

DESCRIPTION

10       This class lets you specify an expected object in a deep comparison.
11       You can check the fields/elements of the underlying reference, call
12       methods to verify results, and do meta checks for object type and ref
13       type.
14

METHODS

16       $class = $obj->meta_class
17           The meta-class to be used when checking the object type. This is
18           mainly listed because it is useful to override for specialized
19           object subclasses.
20
21           This normally just returns Test2::Compare::Meta.
22
23       $class = $obj->object_base
24           The base-class to be expected when checking the object type. This
25           is mainly listed because it is useful to override for specialized
26           object subclasses.
27
28           This normally just returns 'UNIVERSAL'.
29
30       $obj->add_prop(...)
31           Add a meta-property to check, see Test2::Compare::Meta. This method
32           just delegates.
33
34       $obj->add_field(...)
35           Add a hash-field to check, see Test2::Compare::Hash. This method
36           just delegates.
37
38       $obj->add_item(...)
39           Add an array item to check, see Test2::Compare::Array. This method
40           just delegates.
41
42       $obj->add_call($method, $check)
43       $obj->add_call($method, $check, $name)
44       $obj->add_call($method, $check, $name, $context)
45           Add a method call check. This will call the specified method on
46           your object and verify the result. $method may be a method name, an
47           array ref, or a coderef.
48
49           If it's an arrayref, the first element must be the method name, and
50           the rest are arguments that will be passed to it.
51
52           In the case of a coderef it can be helpful to provide an alternate
53           name. When no name is provided the name is either $method or the
54           string '\&CODE'.
55
56           If $context is 'list', the method will be invoked in list context,
57           and the result will be an arrayref.
58
59           If $context is 'hash', the method will be invoked in list context,
60           and the result will be a hashref (this will warn if the method
61           returns an odd number of values).
62

SOURCE

64       The source code repository for Test2-Suite can be found at
65       https://github.com/Test-More/Test2-Suite/.
66

MAINTAINERS

68       Chad Granum <exodist@cpan.org>
69

AUTHORS

71       Chad Granum <exodist@cpan.org>
72
74       Copyright 2018 Chad Granum <exodist@cpan.org>.
75
76       This program is free software; you can redistribute it and/or modify it
77       under the same terms as Perl itself.
78
79       See http://dev.perl.org/licenses/
80
81
82
83perl v5.32.1                      2021-01-27         Test2::Compare::Object(3)
Impressum