diff options
author | John Malmberg <wb8tyw@gmail.com> | 2009-01-04 13:06:54 -0600 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2009-01-08 16:06:10 -0600 |
commit | 6a164b5b33cb5272af43c3c4bc6dbfa7534d90db (patch) | |
tree | 6cac9ab93e2c0585c7779b48569a8ab98e2b6cdf /ext | |
parent | ca48d8be8832a77b6914b6e892f536b4d0b46f8a (diff) | |
download | perl-6a164b5b33cb5272af43c3c4bc6dbfa7534d90db.tar.gz |
ext/File/Gob/t/basic.t, ext/POSIX/t/posix.t vms fixes
Message-id: <496108CE.1060704@gmail.com>
The tests ext/File/Glob/t/basic.t and ext/POSIX/t/posix.t need to know
if VMS is in the UNIX compatible mode.
Diffstat (limited to 'ext')
-rwxr-xr-x | ext/File/Glob/t/basic.t | 19 | ||||
-rw-r--r-- | ext/POSIX/t/posix.t | 28 |
2 files changed, 43 insertions, 4 deletions
diff --git a/ext/File/Glob/t/basic.t b/ext/File/Glob/t/basic.t index bdb2c5773f..b9d46b1142 100755 --- a/ext/File/Glob/t/basic.t +++ b/ext/File/Glob/t/basic.t @@ -19,6 +19,23 @@ use Test::More tests => 14; BEGIN {use_ok('File::Glob', ':glob')}; use Cwd (); +my $vms_unix_rpt = 0; +my $vms_efs = 0; +my $vms_mode = 0; +if ($^O eq 'VMS') { + 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; + } + $vms_mode = 1 unless ($vms_unix_rpt); +} + + # look for the contents of the current directory $ENV{PATH} = "/bin"; delete @ENV{qw(BASH_ENV CDPATH ENV IFS)}; @@ -109,7 +126,7 @@ is_deeply(\@a, ['a', 'b']); print "# @a\n"; -is_deeply(\@a, [($^O eq 'VMS'? 'test.' : 'TEST'), 'a', 'b']); +is_deeply(\@a, [($vms_mode ? 'test.' : 'TEST'), 'a', 'b']); # "~" should expand to $ENV{HOME} $ENV{HOME} = "sweet home"; diff --git a/ext/POSIX/t/posix.t b/ext/POSIX/t/posix.t index 2da3b43bcc..93665325dd 100644 --- a/ext/POSIX/t/posix.t +++ b/ext/POSIX/t/posix.t @@ -28,6 +28,28 @@ $Is_OS2 = $^O eq 'os2'; $Is_UWin = $^O eq 'uwin'; $Is_OS390 = $^O eq 'os390'; +my $vms_unix_rpt = 0; +my $vms_efs = 0; +my $unix_mode = 1; + +if ($Is_VMS) { + $unix_mode = 0; + 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; + } + + # Traditional VMS mode only if VMS is not in UNIX compatible mode. + $unix_mode = ($vms_efs && $vms_unix_rpt); + +} + + ok( $testfd = open("TEST", O_RDONLY, 0), 'O_RDONLY with open' ); read($testfd, $buffer, 4) if $testfd > 2; is( $buffer, "#!./", ' with read' ); @@ -128,11 +150,11 @@ my $pat; if ($Is_MacOS) { $pat = qr/:t:$/; } -elsif ( $Is_VMS ) { - $pat = qr/\.T]/i; +elsif ( $unix_mode ) { + $pat = qr#[\\/]t$#i; } else { - $pat = qr#[\\/]t$#i; + $pat = qr/\.T]/i; } like( getcwd(), qr/$pat/, 'getcwd' ); |