File: 09-import-override-reoverride.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 (26 lines) | stat: -rwxr-xr-x 683 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
# Test::MockRandom
use strict;

use Test::More tests => 6;

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

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

# SomeRandPackage has its own rand(), so we have to re-override
BEGIN { Test::MockRandom->export_rand_to('SomeRandPackage') }

for (qw ( rand srand oneish )) {
    can_ok( __PACKAGE__, $_ );
}

my $obj = SomeRandPackage->new;
isa_ok( $obj, 'SomeRandPackage' );
can_ok( $obj, qw ( rand ) );
srand(.5);
is( $obj->rand(), .5, 'testing $obj->rand == .5' );