my $manifest = File::Spec->catfile(File::Spec->updir(), 'MANIFEST');
-my @dont = qw/CON PRN AUX NUL COM1 COM2 COM3 COM4 COM5 COM6 COM7 COM8 COM9 LPT1 LPT2 LPT3 LPT4 LPT5 LPT6 LPT7 LPT8 LPT9/;
-my @more_dont = ('\s','\(','\&');
-
open my $m, '<', $manifest or die "Can't open '$manifest': $!";
my @files;
while (<$m>) {
my $path = shift;
my $filename = basename $path;
+ note("testing $path");
my @path_components = split('/',$path);
pop @path_components; # throw away the filename
for my $component (@path_components) {
- if ($component =~ /\..*?\./) {
- fail("$path has a directory component containing more than one '.'");
- return;
- }
-
- if (length($component) > 32) {
- fail("$path has a directory with a name over 32 characters. This fails on VOS");
- }
+ unlike($component, qr/\..*?\./,
+ "no directory components containing more than one '.'")
+ or return;
+
+ cmp_ok(length $component, '<=', 32,
+ "no directory with a name over 32 characters (VOS requirement)")
+ or return;
}
- if ($filename =~ m/^\-/) {
- fail("starts with -: $path");
- return;
- }
+ unlike($filename, qr/^\-/, "filename does not start with -");
my($before, $after) = split /\./, $filename;
- if (length $before > 39) {
- fail("more than 39 characters before the dot: $path");
- return;
- }
- if ($after and (length $after > 39)) {
- fail("more than 39 characters after the dot: $path");
- return;
+ cmp_ok(length $before, '<=', 39,
+ "filename has 39 or fewer characters before the dot");
+ if ($after) {
+ cmp_ok(length $after, '<=', 39,
+ "filename has 39 or fewer characters after the dot");
}
- foreach (@dont) {
- if ($filename =~ m/^$_\./i) {
- fail("found $_ before the dot: $path");
- return;
- }
- }
-
- foreach (@more_dont) {
- if ($filename =~ m/$_/) {
- fail("found $_: $path");
- return;
- }
- }
+ unlike($filename, qr/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])\./i,
+ "filename has a reserved name");
- ok($filename, $path);
+ unlike($filename, qr/\s|\(|\&/, "filename has a reserved character");
}
# EOF