File: subroutine-in-inc.t

package info (click to toggle)
liblocal-lib-perl 2.000029-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 344 kB
  • sloc: perl: 1,141; makefile: 13
file content (23 lines) | stat: -rw-r--r-- 516 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
use strict;
use warnings FATAL => 'all';

use Test::More tests => 2;

use lib 't/lib';
use TempDir;
use local::lib ();

my $dir = mk_temp_ll_dir;

my $base = scalar grep { ref eq 'CODE' } @INC;
my $sub = sub { () };
unshift @INC, $sub;
splice @INC, 3, 1, $sub;
push @INC, $sub;

local::lib->import($dir);

my $diff = (scalar grep { ref eq 'CODE' } @INC) - $base;
is $diff, 3, "found correct number of code refs in \@INC";
my $found = scalar grep { $_ eq $sub } @INC;
is $diff, 3, "found correct code refs in \@INC";