1Test::Stream::Plugin::CUlsaesrsiCco(n3t)ributed Perl DocTuemsetn:t:aSttiroenam::Plugin::Classic(3)
2
3
4
6 Test::Stream::Plugin::Classic - Classing (Test::More) style is and
7 is_deeply.
8
10 This distribution is deprecated in favor of Test2, Test2::Suite, and
11 Test2::Workflow.
12
13 See Test::Stream::Manual::ToTest2 for a conversion guide.
14
16 This provides "is()" and "is_deeply()" functions that behave close to
17 the way they did in Test::More, unlike the
18 Test::Stream::Plugin::Compare plugin which has enhanced them (or ruined
19 them, depending on who you ask).
20
22 use Test::Stream 'Classic';
23
24 is($got, $expect, "these are the same when stringified");
25 isnt($got, $unexpect, "these are not the same when stringified");
26
27 like($got, qr/.../, "'got' matches the pattern");
28 unlike($got, qr/.../, "'got' does not match the pattern");
29
30 is_deeply($got, $expect, "These structures are same when checked deeply");
31
33 $bool = is($got, $expect)
34 $bool = is($got, $expect, $name)
35 $bool = is($got, $expect, $name, @diag)
36 This does a string comparison of the 2 arguments. If the 2
37 arguments are the same after stringification the test passes. The
38 test will also pas sif both arguments are undef.
39
40 The test $name is optional.
41
42 The test @diag is optional, it is extra diagnostics messages that
43 will be displayed if the test fails. The diagnostics are ignored if
44 the test passes.
45
46 It is important to note that this tool considers "1" and "1.0" to
47 not be equal as it uses a string comparison.
48
49 See Test::Stream::Plugin::Compare if you want a "is()" function
50 that tries to be smarter for you.
51
52 $bool = isnt($got, $dont_expect)
53 $bool = isnt($got, $dont_expect, $name)
54 $bool = isnt($got, $dont_expect, $name, @diag)
55 This is the inverse of "is()", it passes when the strings are not
56 the same.
57
58 $bool = like($got, $pattern)
59 $bool = like($got, $pattern, $name)
60 $bool = like($got, $pattern, $name, @diag)
61 Check if $got matches the specified pattern. Will fail if it does
62 not match.
63
64 The test $name is optional.
65
66 The test @diag is optional, it is extra diagnostics messages that
67 will be displayed if the test fails. The diagnostics are ignored if
68 the test passes.
69
70 $bool = unlike($got, $pattern)
71 $bool = unlike($got, $pattern, $name)
72 $bool = unlike($got, $pattern, $name, @diag)
73 This is the inverse of "like()". This will fail if $got matches
74 $pattern.
75
76 $bool = is_deeply($got, $expect)
77 $bool = is_deeply($got, $expect, $name)
78 $bool = is_deeply($got, $expect, $name, @diag)
79 This does a deep check, it compares the structures in $got with
80 those in $expect. It will recurse into hashrefs, arrayrefs, and
81 scalar refs. All other values will be stringified and compared as
82 strings. It is important to note that this tool considers "1" and
83 "1.0" to not be equal as it uses a string comparison.
84
85 This is the same as "Test::Stream::Plugin::Compare::is()".
86
87 $bool = isa_ok($thing, @types)
88 Check if "$thing->isa($type)" for each type. You can also check if
89 a reference is a specific ref type.
90
92 The source code repository for Test::Stream can be found at
93 http://github.com/Test-More/Test-Stream/.
94
96 Chad Granum <exodist@cpan.org>
97
99 Chad Granum <exodist@cpan.org>
100
102 Copyright 2015 Chad Granum <exodist7@gmail.com>.
103
104 This program is free software; you can redistribute it and/or modify it
105 under the same terms as Perl itself.
106
107 See http://dev.perl.org/licenses/
108
109
110
111perl v5.34.0 2021-07-27 Test::Stream::Plugin::Classic(3)