GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Test::Lazy::Tester(3) User Contributed Perl Documentation Test::Lazy::Tester(3)

Test::Lazy::Tester

        use Test::Lazy::Tester;

    $tester = Test::Lazy::Tester->new;

    # Will evaluate the code and check it:
        $tester->try('qw/a/' => eq => 'a');
        $tester->try('qw/a/' => ne => 'b');
        $tester->try('qw/a/' => is => ['a']);

    # Don't evaluate, but still compare:
        $tester->check(1 => is => 1);
        $tester->check(0 => isnt => 1);
        $tester->check(a => like => qr/[a-zA-Z]/);
        $tester->check(0 => unlike => qr/a-zA-Z]/);
        $tester->check(1 => '>' => 0);
        $tester->check(0 => '<' => 1);

    # A failure example:

        $tester->check([qw/a b/] => is => [qw/a b c/]);

    # Failed test '['a','b'] is ['a','b','c']'
    # Compared array length of $data
    #    got : array with 2 element(s)
    # expect : array with 3 element(s)


    # Custom test explanation:

        $tester->try('2 + 2' => '==' => 5, "Math is hard: %?");

    # Failed test 'Math is hard: 2 + 2 == 5'
    #      got: 4
    # expected: 5

See Test::Lazy for more information.

Create a new Test::Lazy::Tester object, optionally amending the scalar comparison, structure comparison, and render subroutines using the supplied hashes.

For now, more information on customization can be gotten by:

    perldoc -m Test::Lazy::Tester

See Test::Lazy::check for details.

See Test::Lazy::try for details.

Creates a "Test::Lazy::Template" using $tester as the basis.

See Test::Lazy::Template for more details.

Returns a new Test::Lazy::Template object.

Render a gotten or expected value to a form suitable for the test notice/explanation.

This method will consult the $tester->render hash to see what if should do based on 'ref <value>'. By default, ARRAY and HASH are handled by Data::Dumper using the following:

        local $Data::Dumper::Indent = 0;
        local $Data::Dumper::Varname = 0;
        local $Data::Dumper::Terse = 1;

An undef value is a special case, handled by the $tester->render->{undef} subroutine. By default, the subroutine returns the string "undef"

Render the text explantaion message. You don't need to mess with this.
2007-11-05 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.