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

NAME

Data::Semantic::Test - Testing Data::Semantic objects

VERSION

version 1.101620

DESCRIPTION

This class makes it easy to test new semantic data classes based on Data::Semantic. It uses the Test::CompanionClasses mechanism. So to test the subclass Data::Semantic::URI::http you would write a corresponding Data::Semantic::URI::http_TEST test class. In your test class you need to define the following structure:

    use constant TESTDATA => (
        {
            args => {},
            valid => [ qw(
                http://localhost/
                http://use.perl.org/~hanekomu/journal?entry=12345
            ) ],
            invalid  => [ qw(
                news://localhost/
                http://?123
                https://localhost/
            ) ],
            normalize => {
                foo => 'bar',
                baz => undef,
            },
        },
        {
            args => { scheme => 'https?' },
            valid => [ qw(
                http://localhost/
                http://use.perl.org/~hanekomu/journal?entry=12345
                https://localhost/
                https://use.perl.org/~hanekomu/journal?entry=12345
            ) ],
            invalid  => [ qw(
                news://localhost/
                http://?123
            ) ],
        },
        {
            args => { scheme => 'https' },
            valid => [ qw(
                https://localhost/
                https://use.perl.org/~hanekomu/journal?entry=12345
            ) ],
            invalid  => [ qw(
                http://localhost/
                http://use.perl.org/~hanekomu/journal?entry=12345
                http://?123
                news://localhost/
            ) ],
        },
    );

So you define one or more scenarios, each within its own hashref within the TESTDATA list. In each scenario you have a list of arguments to pass to the semantic data object constructor. Given those arguments, certain values will be considered valid and others invalid.

See Test::CompanionClasses for more information on how these tests are run.

METHODS

PLAN

FIXME

run

FIXME

munge_args

FIXME

test_is_invalid

FIXME

test_is_valid

FIXME

test_normalize

FIXME

INSTALLATION

See perlmodinstall for information and options on installing Perl modules.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests through the web interface at http://rt.cpan.org.

AVAILABILITY

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Data-Semantic/.

The development version lives at http://github.com/hanekomu/Data-Semantic/. Instead of sending patches, please fork this project using the standard git and github infrastructure.

AUTHOR

  Marcel Gruenauer <marcel@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2007 by Marcel Gruenauer.

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