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

NAME

App::SimpleScan::TestSpec - store a test spec, and transform it into test code

VERSION

This document describes App::SimpleScan::TestSpec version 0.01

SYNOPSIS

    use App::SimpleScan:TestSpec;
    App::SimpleScan::TestSpec->app($app_simplescan_object);
    my $spec = App::SimpleScan::TestSpec->new($test_spec_line);

    # Fetch the (raw) URI portion of the test spec.
    my $uri  = $spec->uri();

    # Fetch the (raw) regex portion of the spec.
    my $regex = $spec->regex();

    # Fetch the regex delimiter.
    my $delim = $spec->delim;

    # Fetch the kind of test this is.
    my $delim = $spec->kind;

    # Fetch the comment.
    my $comment = $spec->comment();

    # Expand the test spec into test code.
    # Substitutions should already have been done at this point
    my @tests = $spec->as_tests();
  

DESCRIPTION

App::SimpleScan::TestSpec centralizes the parsing to test specifications and their transformation into code.

INTERFACE

app

Accessor for the owning App::SimpleScan object. Must be called before as_tests is used to permit access to any substitution pragma data.

new($test_spec)

Creates a new TestSpec object from a test specification line. Actually just extracts the appropriate data and prepares for later substitutions and assembly by as_tests.

raw

Returns the raw test spec text was originally passed in.

parse

Breaks up the raw line into the proper fields and sets the regex delimiter appropriately.

Since we're parsing a line which may or may not have substitution tokens in it, we have to break it on appropriate whitespace rather than by matching a "real" URI and a "real" regex.

uri

Accessor for the raw URI portion of the test spec.

delim

Accessor for the regex delimiter.

regex

Accessor for the regular expression itself.

kind

Accessor for the kind of test:

  • Y

    Pattern should match.

  • N

    Pattern should not match.

  • TY

    Pattern does not match currently, but should when code is working properly (TODO).

  • TN

    Pattern matches right now, but shouldn't when code is working properly (TODO).

  • SY

    This test should be skipped; later, it should match.

  • SN

    This test should be skipped; later, it should not match.

as_tests

Expands the test spec into one or more lines of Perl test code. This method should only be called on test specs that have already been through substitution in the main program.

EXTENDING APP::SIMPLESCAN

Adding new command-line options

Plugins can add new command-line options by defining an options class method which returns a set of parameters appropriate for install_options. App::SimpleScan will check for this method when you plugin is loaded, and call it to install your options automatically.

DIAGNOSTICS

None as yet.

CONFIGURATION AND ENVIRONMENT

App::SimpleScan requires no configuration files or environment variables.

DEPENDENCIES

Module::Pluggable and WWW::Mechanize::Pluggable.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

Using capturing parentheses in a regex that will be matching non-ASCII characters wil lead to confusion and heartbreak, as this will throw off the capturing of the accent characters. If you need to do this, do the capturing separate from the check of the accented characters.

Please report any bugs or feature requests to bug-app-simplescan@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Joe McMahon <mcmahon@yahoo-inc.com >

LICENCE AND COPYRIGHT

Copyright (c) 2005, Joe McMahon <mcmahon@yahoo-inc.com >. All rights reserved.

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

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.