Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/src/cmd/perl/lib/Test/Harness/t/assert.t

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/usr/bin/perl -Tw

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

use strict;

use Test::More tests => 6;

use 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' );

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.