summaryrefslogtreecommitdiff
path: root/lib/Test/Harness/t/assert.t
blob: 48d094b52b50a00e5e34630927a2388bc420aace (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl -w

BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't';
        @INC = ('../lib', 'lib');
    }
    else {
        unshift @INC, 't/lib';
    }
}

use strict;

use Test::More tests => 7;

BEGIN { use_ok( 'Test::Harness::Assert' ); }


ok( defined &assert,                'assert() exported' );

ok( !eval { assert( 0 ); 1 },       'assert( FALSE ) causes death' );
like( $@, '/Assert failed/',        '  with the right message' );

ok( eval { assert( 1 );  1 },       'assert( TRUE ) does nothing' );

ok( !eval { assert( 0, 'some name' ); 1 },  'assert( FALSE, NAME )' );
like( $@, '/some name/',                    '  has the name' );