The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Stream::Plugin::Classic - Classing (Test::More) style is and is_deeply.

DEPRECATED

This distribution is deprecated in favor of Test2, Test2::Suite, and Test2::Workflow.

See Test::Stream::Manual::ToTest2 for a conversion guide.

DESCRIPTION

This provides is() and is_deeply() functions that behave close to the way they did in Test::More, unlike the Test::Stream::Plugin::Compare plugin which has enhanced them (or ruined them, depending on who you ask).

SYNOPSIS

    use Test::Stream 'Classic';

    is($got, $expect, "these are the same when stringified");
    isnt($got, $unexpect, "these are not the same when stringified");

    like($got, qr/.../, "'got' matches the pattern");
    unlike($got, qr/.../, "'got' does not match the pattern");

    is_deeply($got, $expect, "These structures are same when checked deeply");

EXPORTS

$bool = is($got, $expect)
$bool = is($got, $expect, $name)
$bool = is($got, $expect, $name, @diag)

This does a string comparison of the 2 arguments. If the 2 arguments are the same after stringification the test passes. The test will also pas sif both arguments are undef.

The test $name is optional.

The test @diag is optional, it is extra diagnostics messages that will be displayed if the test fails. The diagnostics are ignored if the test passes.

It is important to note that this tool considers "1" and "1.0" to not be equal as it uses a string comparison.

See Test::Stream::Plugin::Compare if you want a is() function that tries to be smarter for you.

$bool = isnt($got, $dont_expect)
$bool = isnt($got, $dont_expect, $name)
$bool = isnt($got, $dont_expect, $name, @diag)

This is the inverse of is(), it passes when the strings are not the same.

$bool = like($got, $pattern)
$bool = like($got, $pattern, $name)
$bool = like($got, $pattern, $name, @diag)

Check if $got matches the specified pattern. Will fail if it does not match.

The test $name is optional.

The test @diag is optional, it is extra diagnostics messages that will be displayed if the test fails. The diagnostics are ignored if the test passes.

$bool = unlike($got, $pattern)
$bool = unlike($got, $pattern, $name)
$bool = unlike($got, $pattern, $name, @diag)

This is the inverse of like(). This will fail if $got matches $pattern.

$bool = is_deeply($got, $expect)
$bool = is_deeply($got, $expect, $name)
$bool = is_deeply($got, $expect, $name, @diag)

This does a deep check, it compares the structures in $got with those in $expect. It will recurse into hashrefs, arrayrefs, and scalar refs. All other values will be stringified and compared as strings. It is important to note that this tool considers "1" and "1.0" to not be equal as it uses a string comparison.

This is the same as Test::Stream::Plugin::Compare::is().

$bool = isa_ok($thing, @types)

Check if $thing->isa($type) for each type. You can also check if a reference is a specific ref type.

SOURCE

The source code repository for Test::Stream can be found at http://github.com/Test-More/Test-Stream/.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright 2015 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/