Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Path-Class CPAN distribution.

Maintainer(s)' notes

I prefer that bugs & patches are filed on GitHub rather than on RT: https://github.com/kenahoo/Path-Class/issues. Thanks.

Report information
The Basics
Id: 12988
Status: open
Priority: 0/
Queue: Path-Class

People
Owner: Nobody in particular
Requestors: abeltje [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Fix some VMS issues in the tests
Hi, This patch gets the module to this state: t/03-filesystem.... # Failed test 8 in t/03-filesystem.t at line 29 # t/03-filesystem.t line 29 is: ok $stat->mtime > time() - 20; # Modified wi thin last 20 seconds # Test 29 got: "0. file." (t/03-filesystem.t at line 88) # Expected: "0 file" # t/03-filesystem.t line 88 is: ok $joined, '0 file'; FAILED tests 8, 29 Failed 2/42 tests, 95.24% okay Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t/03-filesystem.t 42 2 4.76% 8 29 Failed 1/3 test scripts, 66.67% okay. 2/124 subtests failed, 98.39% okay. I don't know about the mtime() error (test 8) Test 29 is an error in the basename() method IMO, that's why I didn't "fix" the test HTH+ Good luck, -- Abe.
diff -ruN ../Path-Class-0.11/t/02-foreign.t Path-Class-0.11/t/02-foreign.t --- ../Path-Class-0.11/t/02-foreign.t Tue May 17 03:09:23 2005 +++ Path-Class-0.11/t/02-foreign.t Sun May 29 13:44:08 2005 @@ -30,18 +30,18 @@ ok $dir->as_foreign('Mac'), ':dir:subdir:'; ok $dir->as_foreign('OS2'), 'dir/subdir'; +if ($^O eq 'VMS') { + ok $dir->as_foreign('VMS'), '[.dir.subdir]'; +} else { + skip "skip Can't test VMS code on other platforms", 1; +} + # Note that "\\" and '\\' are each a single backslash $dir = foreign_dir('Win32', 'C:\\'); ok $dir, 'C:\\'; $dir = foreign_dir('Win32', 'C:/'); ok $dir, 'C:\\'; ok $dir->subdir('Program Files'), 'C:\\Program Files'; - -if ($^O eq 'VMS') { - ok $dir->as_foreign('VMS'), '[.dir.subdir]'; -} else { - skip "skip Can't test VMS code on other platforms", 1; -} $dir = foreign_dir('Mac', ':dir:subdir:'); ok $dir, ':dir:subdir:'; diff -ruN ../Path-Class-0.11/t/03-filesystem.t Path-Class-0.11/t/03-filesystem.t --- ../Path-Class-0.11/t/03-filesystem.t Tue May 17 03:09:23 2005 +++ Path-Class-0.11/t/03-filesystem.t Sun May 29 14:08:25 2005 @@ -29,7 +29,8 @@ ok $stat->mtime > time() - 20; # Modified within last 20 seconds } -ok unlink $file; +1 while unlink $file; +ok ! -e $file; my $dir = dir('t', 'testdir'); ok $dir; @@ -46,8 +47,13 @@ ok $dh; my @files = readdir $dh; - ok @files, 3; - ok grep { $_ eq 'foo' } @files; + if ( $^O eq 'VMS' ) { # no updir() and curdir() + ok @files, 1; + ok grep { $_ eq 'foo.' } @files; + } else { + ok @files, 3; + ok grep { $_ eq 'foo' } @files; + } } ok $dir->rmtree; @@ -75,7 +81,8 @@ while (my $file = $dir->next) { push @contents, $file; } - ok @contents, 5; + my $entries = $^O eq 'VMS' ? 3 : 5; + ok @contents, $entries; my $joined = join ' ', map $_->basename, sort grep {-f $_} @contents; ok $joined, '0 file'; @@ -84,7 +91,9 @@ ok $subdir; ok -d $subdir, 1; - my ($file) = grep {$_ eq $dir->file('file')} @contents; + # vms adds a dot to filenames without an 'extension' + my $lookfor = $^O eq 'VMS' ? 'file.' : 'file'; + my ($file) = grep {$_ eq $dir->file($lookfor)} @contents; ok $file; ok -d $file, '';
Hi Abe, Thanks for the patch. Where possible, I'm modifying it to not have any VMS special-casing. For example, instead of creating "file" and then looking for "file." on VMS, I'm just creating "file.x" in the first place. I've also added some notes to the docs saying that this gotcha is waiting for people who create files with no extensions. Regarding the basename() issue, is it that you expected it to return the filename without any extension? It's documented to simply return the filename, and not strip the extension. This might be a poor choice of method name if it's going to be contrary to people's expectations. Let me know what you think. -Ken