File: require_message.t

package info (click to toggle)
libperl5i-perl 2.13.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 996 kB
  • ctags: 343
  • sloc: perl: 6,259; makefile: 5
file content (50 lines) | stat: -rw-r--r-- 829 bytes parent folder | download | duplicates (2)
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
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl

use perl5i::latest;

use lib 't/lib';
use Test::More;
use Test::perl5i;

is( ref($INC[-1]), 'CODE', "Sub is at end" );
push @INC => './.././';
ok( !ref($INC[-1]), "Something is after our sub." );

lives_ok {
    require Data::Dumper;
} "Require things that are installed works";

throws_ok {
    require Fake::Thing;
}
qr/Can't locate Fake\/Thing\.pm in your Perl library\./,
"Useful message";

is( ref($INC[-1]), 'CODE' , "sub at end" );

{
    package NoFile;
    sub foo { 42 }
}

lives_ok {
    package Foo;
    eval <<'    EOT' || die $@;
    use perl5i::2;
    use base 'NoFile';
    1;
    EOT
} "same file base";


{
    no perl5i::latest;

    throws_ok {
        require Fake::Thing;
    }
    qr/^Can't locate Fake\/Thing\.pm in \@INC/,
    "Special message turned off out of scope";
}

done_testing;