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::Template(3) User Contributed Perl Documentation Test::Lazy::Template(3)

Test::Lazy::Template

Build a template for running a similar set of tests repeatedly.

The purpose of this module is to provide a convenient way of testing a set of initial conditions in different ways.

The best way to show this is in an example:

        # Template up the intial condition template.
        my $template = new Test::Lazy::Template([ 
                [ "qw/1/" ],
                [ "qw/a/" ],
                [ "qw/apple/" ],
                [ "qw/2/" ],
                [ "qw/0/" ],
                [ "qw/-1/" ],
                [ "map { \$_ => \$_ * 2 } qw/0 1 2 3 4/" ],
        ]);

        # Run some different tests.
        # NOTE: Don't have to use '%?' if the statement will run without modification.
        $template->test("defined(%?)" => ok => undef);
        $template->test("length(%?) >= 1" => ok => undef);
        $template->test("length(%?)" => '>=' => 1);
        $template->test("length(%?)" => '<' => 10);
        $template->test([
                [ '%?' => is => 1 ],
                [ is => 'a' ],
                [ is => 'apple' ],
                [ is => 2 ],
                [ is => 0 ],
                [ is => is => -1 ],
                [ is => { 0 => 0, 1 => 2, 2 => 4, 3 => 6, 4 => 8 } ],
        ]);

Create a new "Test::Lazy::Template" object using the giving test specification.

If <template> is a SCALAR reference, then new will split <template> on each newline, ignoring empty lines and lines beginning with a pound (#).

                # You could do something like this:
                my $template = template(\<<_END_);
        qw/1/
        qw/a/
        qw/apple/
        qw/2/
        qw/0/
        qw/-1/

        # Let's test this one too.
        map { \$_ => \$_ * 2 } qw/0 1 2 3 4/
        _END_

Returns the new "Test::Lazy::Template" object

For each test in $template, modify and run each the test according to the corresponding entry in <template>.

Modify and then run each test in $template by using <test> to complete each test's specification.
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.