tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / t / lib / Test / Harness / Assert.pm
blob29f6c7ada958dc720e5b8a7bdf5d3b9b3a027d04
1 package Test::Harness::Assert;
3 use strict;
4 require Exporter;
5 use vars qw($VERSION @EXPORT @ISA);
7 $VERSION = '0.02';
9 @ISA = qw(Exporter);
10 @EXPORT = qw(assert);
13 =head1 NAME
15 Test::Harness::Assert - simple assert
17 =head1 SYNOPSIS
19 ### FOR INTERNAL USE ONLY ###
21 use Test::Harness::Assert;
23 assert( EXPR, $name );
25 =head1 DESCRIPTION
27 A simple assert routine since we don't have Carp::Assert handy.
29 B<For internal use by Test::Harness ONLY!>
31 =head1 FUNCTIONS
33 =head2 C<assert()>
35 assert( EXPR, $name );
37 If the expression is false the program aborts.
39 =cut
41 sub assert ($;$) {
42 my($assert, $name) = @_;
44 unless( $assert ) {
45 require Carp;
46 my $msg = 'Assert failed';
47 $msg .= " - '$name'" if defined $name;
48 $msg .= '!';
49 Carp::croak($msg);
54 =head1 AUTHOR
56 Michael G Schwern C<< <schwern at pobox.com> >>
58 =head1 SEE ALSO
60 L<Carp::Assert>
62 =cut