X-Git-Url: https://git.donarmstrong.com/?p=term-progressbar.git;a=blobdiff_plain;f=t%2Ftest.pm;fp=t%2Ftest.pm;h=0000000000000000000000000000000000000000;hp=f72ae085821bc3aec006892ee6c97bd40737d4dc;hb=14647cabb5bbb54629de8545e080519bd0be430f;hpb=8f87af0520c5dbcedbfe74dd6ef6e7826f200263 diff --git a/t/test.pm b/t/test.pm deleted file mode 100644 index f72ae08..0000000 --- a/t/test.pm +++ /dev/null @@ -1,174 +0,0 @@ -# (X)Emacs mode: -*- cperl -*- - -package test; - -=head1 NAME - -test - tools for helping in test suites (not including running externalprograms). - -=head1 SYNOPSIS - - ok evcheck(sub { - open my $fh, '>', 'foo'; - print $fh "$_\n" - for 'Bulgaria', 'Cholet'; - close $fh; - }, 'write foo'), 1, 'write foo'; - -=head1 DESCRIPTION - -This package provides some variables, and sets up an environment, for test -scripts, such as those used in F. - -This package does not including running external programs; that is provided by -C. This is so that suites not needing that can include only -test.pm, and so not require the presence of C. - -Setting up the environment includes: - -=over 4 - -=item Prepending F onto the path - -=item Pushing the module F dir onto the @INC var - -For internal C calls. - -=item Changing directory to a temporary directory - -To avoid cluttering the local dir, and/or allowing the local directory -structure to affect matters. - -=item Cleaning up the temporary directory afterwards - -Unless TEST_DEBUG is set in the environment. - -=back - -=cut - -# ---------------------------------------------------------------------------- - -# Pragmas ----------------------------- - -use 5.00503; -use strict; -use vars qw( @EXPORT_OK ); - -# Inheritance ------------------------- - -use base qw( Exporter ); - -=head2 EXPORTS - -The following symbols are exported upon request: - -=over 4 - -=item evcheck - -=back - -=cut - -@EXPORT_OK = qw( evcheck ); - -# Utility ----------------------------- - -use Carp qw( carp ); - - -$| = 1; - -# ------------------------------------- -# PACKAGE FUNCTIONS -# ------------------------------------- - -=head2 evcheck - -Eval code, return status - -=over 4 - -=item ARGUMENTS - -=over 4 - -=item code - -Coderef to eval - -=item name - -Name to use in error messages - -=back - -=item RETURNS - -=over 4 - -=item okay - -1 if eval was okay, 0 if not. - -=back - -=back - -=cut - -sub evcheck { - my ($code, $name) = @_; - - my $ok = 0; - - eval { - &$code; - $ok = 1; - }; if ( $@ ) { - carp "Code $name failed: $@\n" - if $ENV{TEST_DEBUG}; - $ok = 0; - } - - return $ok; -} - -# ------------------------------------- - -# defined further up to use in constants - -# ---------------------------------------------------------------------------- - -=head1 EXAMPLES - -Z<> - -=head1 BUGS - -Z<> - -=head1 REPORTING BUGS - -Email the author. - -=head1 AUTHOR - -Martyn J. Pearce C - -=head1 COPYRIGHT - -Copyright (c) 2001, 2002, 2004 Martyn J. Pearce. This program is free -software; you can redistribute it and/or modify it under the same terms as -Perl itself. - -=head1 SEE ALSO - -Z<> - -=cut - -1; # keep require happy. - -__END__