Debian Codegraph @

upstream/mageia-cauldron/man3pm/Test2::Compare::Object.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "Test2::Compare::Object 3pm"
61 .TH Test2::Compare::Object 3pm 2025-06-24 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 Test2::Compare::Object \- Representation of an object during deep
68 comparison.
69 .SH DESCRIPTION
70 .IX Header "DESCRIPTION"
71 This class lets you specify an expected object in a deep comparison. You can
72 check the fields/elements of the underlying reference, call methods to verify
73 results, and do meta checks for object type and ref type.
74 .SH METHODS
75 .IX Header "METHODS"
76 .ie n .IP "$class = $obj\->meta_class" 4
77 .el .IP "\f(CW$class\fR = \f(CW$obj\fR\->meta_class" 4
78 .IX Item "$class = $obj->meta_class"
79 The meta\-class to be used when checking the object type. This is mainly listed
80 because it is useful to override for specialized object subclasses.
81 .Sp
82 This normally just returns Test2::Compare::Meta.
83 .ie n .IP "$class = $obj\->object_base" 4
84 .el .IP "\f(CW$class\fR = \f(CW$obj\fR\->object_base" 4
85 .IX Item "$class = $obj->object_base"
86 The base\-class to be expected when checking the object type. This is mainly
87 listed because it is useful to override for specialized object subclasses.
88 .Sp
89 This normally just returns \*(AqUNIVERSAL\*(Aq.
90 .ie n .IP $obj\->add_prop(...) 4
91 .el .IP \f(CW$obj\fR\->add_prop(...) 4
92 .IX Item "$obj->add_prop(...)"
93 Add a meta\-property to check, see Test2::Compare::Meta. This method
94 just delegates.
95 .ie n .IP $obj\->add_field(...) 4
96 .el .IP \f(CW$obj\fR\->add_field(...) 4
97 .IX Item "$obj->add_field(...)"
98 Add a hash\-field to check, see Test2::Compare::Hash. This method
99 just delegates.
100 .ie n .IP $obj\->add_item(...) 4
101 .el .IP \f(CW$obj\fR\->add_item(...) 4
102 .IX Item "$obj->add_item(...)"
103 Add an array item to check, see Test2::Compare::Array. This method
104 just delegates.
105 .ie n .IP "$obj\->add_call($method, $check)" 4
106 .el .IP "\f(CW$obj\fR\->add_call($method, \f(CW$check\fR)" 4
107 .IX Item "$obj->add_call($method, $check)"
108 .PD 0
109 .ie n .IP "$obj\->add_call($method, $check, $name)" 4
110 .el .IP "\f(CW$obj\fR\->add_call($method, \f(CW$check\fR, \f(CW$name\fR)" 4
111 .IX Item "$obj->add_call($method, $check, $name)"
112 .ie n .IP "$obj\->add_call($method, $check, $name, $context)" 4
113 .el .IP "\f(CW$obj\fR\->add_call($method, \f(CW$check\fR, \f(CW$name\fR, \f(CW$context\fR)" 4
114 .IX Item "$obj->add_call($method, $check, $name, $context)"
115 .PD
116 Add a method call check. This will call the specified method on your object and
117 verify the result. \f(CW$method\fR may be a method name, an array ref, or a coderef.
118 .Sp
119 If it\*(Aqs an arrayref, the first element must be the method name, and
120 the rest are arguments that will be passed to it.
121 .Sp
122 In the case of a coderef it can be helpful to provide an alternate
123 name. When no name is provided the name is either \f(CW$method\fR or the
124 string \*(Aq\e&CODE\*(Aq.
125 .Sp
126 If \f(CW$context\fR is \f(CW\*(Aqlist\*(Aq\fR, the method will be invoked in list
127 context, and the result will be an arrayref.
128 .Sp
129 If \f(CW$context\fR is \f(CW\*(Aqhash\*(Aq\fR, the method will be invoked in list
130 context, and the result will be a hashref (this will warn if the
131 method returns an odd number of values).
132 .SH SOURCE
133 .IX Header "SOURCE"
134 The source code repository for Test2\-Suite can be found at
135 \&\fIhttps://github.com/Test\-More/test\-more/\fR.
136 .SH MAINTAINERS
137 .IX Header "MAINTAINERS"
138 .IP "Chad Granum <[email protected]>" 4
139 .IX Item "Chad Granum <[email protected]>"
140 .SH AUTHORS
141 .IX Header "AUTHORS"
142 .IP "Chad Granum <[email protected]>" 4
143 .IX Item "Chad Granum <[email protected]>"
144 .SH COPYRIGHT
145 .IX Header "COPYRIGHT"
146 Copyright Chad Granum <[email protected]>.
147 .PP
148 This program is free software; you can redistribute it and/or
149 modify it under the same terms as Perl itself.
150 .PP
151 See \fIhttp://dev.perl.org/licenses/\fR