summaryrefslogtreecommitdiff
path: root/t/op/magic.t
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2013-02-23 12:45:11 -0600
committerCraig A. Berry <craigberry@mac.com>2013-02-23 12:45:11 -0600
commit95725928451f4350a7d74edda9a27b8c1d3382fb (patch)
tree5d169905a7e6009d40aca79b3ade3f616ec618d9 /t/op/magic.t
parent7c25cd544bc7d33fb15d10973aa9a30fdd5fa624 (diff)
downloadperl-95725928451f4350a7d74edda9a27b8c1d3382fb.tar.gz
Handle undef values in magic.t on VMS.
888a67f6b95603701 added a new test that failed on VMS because it expected the value of an undefined element in %ENV to be an empty string, whereas on VMS it's actually a one-byte string containing a null. This is made possible by the fact that the logical name API uses strings of known lengths, and made necessary by the fact that a zero-length value (equivalence name in VMS parlance) is not allowed. So patch up the test implementation to handle this special case.
Diffstat (limited to 't/op/magic.t')
-rw-r--r--t/op/magic.t7
1 files changed, 6 insertions, 1 deletions
diff --git a/t/op/magic.t b/t/op/magic.t
index d06fcaa34d..26b5b042fe 100644
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -76,7 +76,11 @@ sub env_is {
Win32::SetConsoleOutputCP($cp);
like $set, qr/^(?:\Q$key\E=)?\Q$val\E$/, $desc;
} elsif ($Is_VMS) {
- is `write sys\$output f\$trnlnm("\Q$key\E")`, "$val\n", $desc;
+ my $eqv = `write sys\$output f\$trnlnm("\Q$key\E")`;
+ # A single null byte in the equivalence string means
+ # an undef value for Perl, so mimic that here.
+ $eqv = "\n" if length($eqv) == 2 and $eqv eq "\000\n";
+ is $eqv, "$val\n", $desc;
} else {
is `echo \$\Q$key\E`, "$val\n", $desc;
}
@@ -87,6 +91,7 @@ END {
if ($Is_VMS) {
delete $ENV{'FOO'};
delete $ENV{'__NoNeSuCh'};
+ delete $ENV{'__NoNeSuCh2'};
}
}