Tweaks to get Test::Builder::Tester's tests to work in the core.
[p5sagit/p5-mst-13.2.git] / lib / Test / Harness / Assert.pm
1 # $Id: Assert.pm 250 2003-09-11 15:57:29Z andy $
2
3 package Test::Harness::Assert;
4
5 use strict;
6 require Exporter;
7 use vars qw($VERSION @EXPORT @ISA);
8
9 $VERSION = '0.02';
10
11 @ISA = qw(Exporter);
12 @EXPORT = qw(assert);
13
14
15 =head1 NAME
16
17 Test::Harness::Assert - simple assert
18
19 =head1 SYNOPSIS
20
21   ### FOR INTERNAL USE ONLY ###
22
23   use Test::Harness::Assert;
24
25   assert( EXPR, $name );
26
27 =head1 DESCRIPTION
28
29 A simple assert routine since we don't have Carp::Assert handy.
30
31 B<For internal use by Test::Harness ONLY!>
32
33 =head1 FUNCTIONS
34
35 =head2 C<assert()>
36
37   assert( EXPR, $name );
38
39 If the expression is false the program aborts.
40
41 =cut
42
43 sub assert ($;$) {
44     my($assert, $name) = @_;
45
46     unless( $assert ) {
47         require Carp;
48         my $msg = 'Assert failed';
49         $msg .= " - '$name'" if defined $name;
50         $msg .= '!';
51         Carp::croak($msg);
52     }
53
54 }
55
56 =head1 AUTHOR
57
58 Michael G Schwern C<< <schwern@pobox.com> >>
59
60 =head1 SEE ALSO
61
62 L<Carp::Assert>
63
64 =cut
65
66 1;