File: 10-case-insensitive-keys.t

package info (click to toggle)
libmodule-scandeps-perl 0.98-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 576 kB
  • ctags: 231
  • sloc: perl: 3,910; makefile: 10; ansic: 1
file content (66 lines) | stat: -rw-r--r-- 2,140 bytes parent folder | download | duplicates (5)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/perl

use strict;
use warnings;
use File::Spec;

use Test::More;
BEGIN {
    if(!File::Spec->case_tolerant()) {
        plan skip_all => 'Test irrelevant on case intolerant systems';
    } else {
        plan tests => 43;
    }
}

use lib qw(t t/data/case-insensitive-keys);
use Utils;

##############################################################
# Tests compilation of Module::ScanDeps
##############################################################
BEGIN { use_ok( 'Module::ScanDeps' ); }


##############################################################
# Static dependency check of scripts that reference the same
# module but in different cases
##############################################################
my @roots1 = qw(t/data/case-insensitive-keys/this_case.pl t/data/case-insensitive-keys/that_case.pl);
my $expected_rv1 =
{
  "Test.pm"      => {
                      file    => generic_abs_path("t/data/case-insensitive-keys/Test.pm"),
                      key     => "Test.pm",
                      type    => "module",
                      used_by => ["this_case.pl", "that_case.pl"],
                    },
  "that_case.pl" => {
                      file => generic_abs_path("t/data/case-insensitive-keys/that_case.pl"),
                      key  => "that_case.pl",
                      type => "data",
                      uses => ["Test.pm"],
                    },
  "this_case.pl" => {
                      file => generic_abs_path("t/data/case-insensitive-keys/this_case.pl"),
                      key  => "this_case.pl",
                      type => "data",
                      uses => ["Test.pm"],
                    },
};

# Functional i/f
my $rv1 = scan_deps(@roots1);
#use Data::Dump qw(dump);
#print dump($rv1), "\n";

compare_scandeps_rvs($rv1, $expected_rv1, \@roots1);

# Check that only one entry for Cwd is created.

my @roots2 = qw(t/data/case-insensitive-keys/Test2.pm);
my $rv2 = scan_deps(files => \@roots2);
my @keys = grep { lc($_) eq "cwd.pm" } keys %$rv2;
ok($#keys == 0, "contains only one match");

__END__