blob: 47a21f0ae8a5592807cce1d24c65608096424cb5 (
plain)
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
|
use strict;
use warnings;
use Test::More tests => 13;
use Module::Find qw(ignoresymlinks followsymlinks findsubmod findallmod);
use lib qw(./t/test);
my $dirName = "ModuleFindTest";
my $linkName = "./t/test/ModuleFindTestSymLink";
SKIP: {
my $r = eval { symlink($dirName, $linkName) };
skip "Symlinks not supported on this system", 13 if $@;
skip "Unable to create symlink", 13 if $r == 0;
my @l;
# Default behaviour: follow symlinks -----------------------
@l = findsubmod ModuleFindTestSymLink;
ok($#l == 0);
ok($l[0] eq 'ModuleFindTestSymLink::SubMod');
@l = findallmod ModuleFindTestSymLink;
ok($#l == 1);
ok($l[0] eq 'ModuleFindTestSymLink::SubMod');
ok($l[1] eq 'ModuleFindTestSymLink::SubMod::SubSubMod');
# Switch off following symlinks ---------------------------
ignoresymlinks();
@l = findsubmod ModuleFindTestSymLink;
ok($#l == -1);
@l = findallmod ModuleFindTestSymLink;
ok($#l == -1);
# Re-enable it --------------------------------------------
followsymlinks();
@l = findsubmod ModuleFindTestSymLink;
ok($#l == 0);
ok($l[0] eq 'ModuleFindTestSymLink::SubMod');
@l = findallmod ModuleFindTestSymLink;
ok($#l == 1);
ok($l[0] eq 'ModuleFindTestSymLink::SubMod');
ok($l[1] eq 'ModuleFindTestSymLink::SubMod::SubSubMod');
# Clean up
unlink $linkName;
ok(!-e $linkName);
}
|