[blead-227-gbd2db5d] t/op/chdir.t, t/op/defins.t on VMS

[email protected] (John Malmberg)
Newsgroups perl.perl5.porters,perl.vmsperl
Message-ID <[email protected]>
The test t/op/chdir.t needs to expect that returned dir could be in 
either case or in VMS or UNIX formst.

The test t/op/defins.t needs to know of VMS is dropping dots on 
filenames when VMS is in the UNIX REPORT mode.

-John
[email protected]
t_op.patch (text/plain, 2.7 KB)
--- /rsync_root/perl/t/op/chdir.t	Tue May  1 13:24:10 2007
+++ t/op/chdir.t	Sun Nov 23 16:29:06 2008
@@ -14,6 +14,20 @@
 my $IsVMS   = $^O eq 'VMS';
 my $IsMacOS = $^O eq 'MacOS';
 
+my $vms_unix_rpt = 0;
+my $vms_efs = 0;
+if ($IsVMS) {
+    if (eval 'require VMS::Feature') {
+        $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
+        $vms_efs = VMS::Feature::current("efs_charset");
+    } else {
+        my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
+        my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
+        $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; 
+        $vms_efs = $efs_charset =~ /^[ET1]/i; 
+    }
+}
+
 # For an op regression test, I don't want to rely on "use constant" working.
 my $has_fchdir = ($Config{d_fchdir} || "") eq "define";
 
@@ -25,8 +39,6 @@
 # path separators than File::Spec.
 sub abs_path {
     my $d = rel2abs(curdir);
-
-    $d = uc($d) if $IsVMS;
     $d = lc($d) if $^O =~ /^uwin/;
     $d;
 }
@@ -36,8 +48,14 @@
 # Let's get to a known position
 SKIP: {
     my ($vol,$dir) = splitpath(abs_path,1);
-    my $test_dir = $IsVMS ? 'T' : 't';
-    skip("Already in t/", 2) if (splitdir($dir))[-1] eq $test_dir;
+    my $test_dir = 't';
+    my $compare_dir = (splitdir($dir))[-1];
+
+    # VMS is case insensitive but will preserve case in EFS mode.
+    # So we must normalize the case for the compare.
+ 
+    $compare_dir = lc($compare_dir) if $IsVMS;
+    skip("Already in t/", 2) if $compare_dir eq $test_dir;
 
     ok( chdir($test_dir),     'chdir($test_dir)');
     is( abs_path, catdir($Cwd, $test_dir),    '  abs_path() agrees' );
--- /rsync_root/perl/t/op/defins.t	Tue Jun 13 14:29:32 2006
+++ t/op/defins.t	Sun Jan  4 12:11:55 2009
@@ -12,7 +12,28 @@
 require 'test.pl';
 plan( tests => 19 );
 
-$wanted_filename = $^O eq 'VMS' ? '0.' : '0';
+my $unix_mode = 1;
+
+if ($^O eq 'VMS') {
+    # We have to know if VMS is in UNIX mode.  In UNIX mode, trailing dots
+    # should not be present.  There are actually two settings that control this.
+
+    $unix_mode = 0;
+    my $unix_rpt = 0;
+    my $drop_dot = 0;
+    if (eval 'require VMS::Feature') {
+        $unix_rpt = VMS::Feature::current('filename_unix_report');
+        $drop_dot = VMS::Feature::current('readdir_dropdotnotype');
+    } else {
+        my $unix_report = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
+        $unix_rpt = $unix_report =~ /^[ET1]/i; 
+        my $drop_dot_notype = $ENV{'DECC$READDIR_DROPDOTNOTYPE'} || '';
+        $drop_dot = $drop_dot_notype =~ /^[ET1]/i;
+    }
+    $unix_mode = 1 if $drop_dot && unix_rpt;
+}
+
+$wanted_filename = $unix_mode ? '0' : '0.';
 $saved_filename = $^O eq 'MacOS' ? ':0' : './0';
 
 cmp_ok($warns,'==',0,'no warns at start');
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.