File: 39no-so.t

package info (click to toggle)
libdatetime-perl 2%3A1.50-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,504 kB
  • sloc: perl: 2,964; makefile: 3
file content (40 lines) | stat: -rw-r--r-- 776 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
29
30
31
32
33
34
35
36
37
38
39
40
# no pp test
# HARNESS-NO-PRELOAD

use strict;
use warnings;

use Test::Fatal;
use Test::More;

## no critic (TestingAndDebugging::ProhibitNoWarnings)
no warnings 'once', 'redefine';

require XSLoader;

my $orig = \&XSLoader::load;

my $sub = sub {
    if ( defined $_[0] && $_[0] eq 'DateTime' ) {
        die q{Can't locate loadable object for module DateTime in @INC};
    }
    else {
        goto $orig;
    }
};

*XSLoader::load = $sub;

is(
    exception { require DateTime },
    undef,, 'No error loading DateTime without DateTime.so file'
);
## no critic (Variables::ProhibitPackageVars)
ok( $DateTime::IsPurePerl, '$DateTime::IsPurePerl is true' );

ok(
    DateTime->new( year => 2005 ),
    'can make DateTime object without DateTime.so file'
);

done_testing();