Apocalypse > Test-Apocalypse > Test::Apocalypse

Download:
Test-Apocalypse-1.002.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  4
Open  1
View/Report Bugs
Module Version: 1.002   Source  

NAME ^

Test::Apocalypse - Apocalypse's favorite tests bundled into a simple interface

VERSION ^

  This document describes v1.002 of Test::Apocalypse - released April 21, 2011 as part of Test-Apocalypse.

SYNOPSIS ^

        #!/usr/bin/perl
        use strict; use warnings;

        use Test::More;
        eval "use Test::Apocalypse";
        if ( $@ ) {
                plan skip_all => 'Test::Apocalypse required for validating the distribution';
        } else {
                is_apocalypse_here();
        }

DESCRIPTION ^

This module greatly simplifies common author tests for modules heading towards CPAN. I was sick of copy/pasting the tons of t/foo.t scripts + managing them in every distro. I thought it would be nice to bundle all of it into one module and toss it on CPAN :) That way, every time I update this module all of my dists would be magically updated!

This module respects the RELEASE_TESTING/AUTOMATED_TESTING env variable, if it is not set it will skip the entire testsuite. Normally end-users should not run it; but you can if you want to see how bad my dists are, ha! The scheme is exactly the same as the one Alias proposed in Test::XT and in his blog post, http://use.perl.org/~Alias/journal/38822.

This module uses Module::Pluggable to have custom "backends" that process various tests. We wrap them in a hackish Test::Block block per-plugin and it seems to work nicely. If you want to write your own, it should be a breeze once you look at some of my plugins and see how it works. ( more documentation to come )

Usage

In order to use this, you would need to be familiar with the "standard" steps in order to fully exercise the testsuite. There are a few steps we require, because our plugins need stuff to be prepared for them. For starters, you would need a test file in your distribution similar to the one in SYNOPSIS. Once that is done and added to your MANIFEST and etc, you can do this:

        perl Build.PL                   # sets up the dist ( duh, hah )
        ./Build dist                    # makes the tarball ( so certain plugins can process it )
        RELEASE_TESTING=1 ./Build test  # runs the testsuite!

Methods ^

is_apocalypse_here()

This is the main entry point for this testsuite. By default, it runs every plugin in the testsuite. You can enable/disable specific plugins if you desire. It accepts a single argument: a hashref or a hash. It can contain various options, but as of now it only supports two options. If you try to use allow and deny at the same time, this module will throw an exception.

allow

Setting "allow" to a string or a precompiled regex will run only the plugins that match the regex. If passed a string, this module will compile it via qr/$str/i.

        # run only the EOL test and disable all other tests
        is_apocalypse_here( {
                allow   => qr/^EOL$/,
        } );

        # run all "dist" tests
        is_apocalypse_here( {
                allow   => 'dist',
        } );

deny

Setting "deny" to a string or a precompiled regex will not run the plugins that match the regex. If passed a string, this module will compile it via qr/$str/i.

        # disable Pod_Coverage test and enable all other tests
        is_apocalypse_here( {
                deny    => qr/^Pod_Coverage$/,
        } );

        # disable all pod tests
        is_apocalypse_here( {
                deny    => 'pod',
        } );

plugins()

Since this module uses Module::Pluggable you can use this method on the package to find out what plugins are available. Handy if you need to know what plugins to skip, for example.

        my @tests = Test::Apocalypse->plugins;

EXPORT ^

Automatically exports the "is_apocalypse_here" sub.

MORE IDEAS ^

Modules that I considered but decided against using

SUPPORT ^

Perldoc

You can find documentation for this module with the perldoc command.

  perldoc Test::Apocalypse

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Email

You can email the author of this module at APOCAL at cpan.org asking for help with any problems you have.

Internet Relay Chat

You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is, please read this excellent guide: http://en.wikipedia.org/wiki/Internet_Relay_Chat. Please be courteous and patient when talking to us, as we might be busy or sleeping! You can join those networks/channels and get help:

Bugs / Feature Requests

Please report any bugs or feature requests by email to bug-test-apocalypse at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Apocalypse. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

http://github.com/apocalypse/perl-test-apocalypse

  git clone git://github.com/apocalypse/perl-test-apocalypse.git

AUTHOR ^

Apocalypse <APOCAL@cpan.org>

ACKNOWLEDGEMENTS ^

Thanks to jawnsy@cpan.org for the prodding and help in getting this package ready to be bundled into debian!

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2011 by Apocalypse.

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

The full text of the license can be found in the LICENSE file included with this distribution.

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.

syntax highlighting: