File: 04-override-module.t

package info (click to toggle)
libtest-mockrandom-perl 1.01-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 256 kB
  • sloc: perl: 326; makefile: 2
file content (28 lines) | stat: -rwxr-xr-x 888 bytes parent folder | download | duplicates (3)
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
# Test::MockRandom
use strict;

use Test::More tests => 8;

#--------------------------------------------------------------------------#
# Test package overriding via import
#--------------------------------------------------------------------------#

use Test::MockRandom qw( SomePackage );
use lib qw( ./t );
use SomePackage;

can_ok( 'SomePackage', 'rand' );
can_ok( __PACKAGE__, $_ ) for qw ( srand oneish );

ok( !UNIVERSAL::can( __PACKAGE__, 'rand' ),
    "confirming that rand() wasn't imported into " . __PACKAGE__ );
ok( !UNIVERSAL::can( 'SomePackage', 'srand' ),
    "confirming that srand wasn't imported into SomePackage" );
ok( !UNIVERSAL::can( 'SomePackage', 'oneish' ),
    "confirming that oneish wasn't imported into SomePackage" );

my $obj = SomePackage->new;
isa_ok( $obj, 'SomePackage' );
srand(.5);
is( $obj->next_random(), .5, 'testing $obj->next_random == .5' );