-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed RT#38302: Module::Find doesn't work with symlinks
- Loading branch information
Showing
2 changed files
with
95 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use Test::More tests => 13; | ||
|
||
use Module::Find qw(ignoresymlinks followsymlinks findsubmod findallmod); | ||
|
||
use lib qw(./test); | ||
|
||
my $dirName = "ModuleFindTest"; | ||
my $linkName = "./test/ModuleFindTestSymLink"; | ||
|
||
SKIP: { | ||
eval { symlink($dirName, $linkName) }; | ||
skip "Symlinks not supported on this system", 13 if $@; | ||
|
||
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); | ||
} | ||
|
||
|
||
|