source: for-distributions/trunk/bin/windows/perl/lib/Test/Harness/Assert.pm@ 14489

Last change on this file since 14489 was 14489, checked in by oranfry, 17 years ago

upgrading to perl 5.8

File size: 958 bytes
Line 
1# $Id: Assert.pm 250 2003-09-11 15:57:29Z andy $
2
3package Test::Harness::Assert;
4
5use strict;
6require Exporter;
7use 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
17Test::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
29A simple assert routine since we don't have Carp::Assert handy.
30
31B<For internal use by Test::Harness ONLY!>
32
33=head1 FUNCTIONS
34
35=head2 C<assert()>
36
37 assert( EXPR, $name );
38
39If the expression is false the program aborts.
40
41=cut
42
43sub 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
58Michael G Schwern C<< <[email protected]> >>
59
60=head1 SEE ALSO
61
62L<Carp::Assert>
63
64=cut
65
661;
Note: See TracBrowser for help on using the repository browser.