Skip to content
Browse files

Tweaks to avoid reams of "Use of uninitialized value in string contex…

…t" errors.
  • Loading branch information...
1 parent 9c25355 commit 330bd62533d5b6502ac47e821202b15d8d3786ca @colomon colomon committed Jan 29, 2012
Showing with 8 additions and 6 deletions.
  1. +8 −6 S02-magicals/env.t
View
14 S02-magicals/env.t
@@ -37,10 +37,10 @@ ok %*ENV<PATH> ne "42",
# Similarily, I don't think creating a new entry in %vars should affect the
# environment:
-diag '%*ENV<PUGS_ROCKS>=' ~ %*ENV<PUGS_ROCKS>;
+diag '%*ENV<PUGS_ROCKS>=' ~ (%*ENV<PUGS_ROCKS> // "");
ok !defined(%*ENV<PUGS_ROCKS>), "there's no env variable 'PUGS_ROCKS'";
%vars<PUGS_ROCKS> = "42";
-diag '%*ENV<PUGS_ROCKS>=' ~ %*ENV<PUGS_ROCKS>;
+diag '%*ENV<PUGS_ROCKS>=' ~ (%*ENV<PUGS_ROCKS> // "");
ok !defined(%*ENV<PUGS_ROCKS>), "there's still no env variable 'PUGS_ROCKS'";
my ($redir,$squo) = (">", "'");
@@ -66,15 +66,16 @@ my $err = 0;
for %*ENV.kv -> $k,$v {
# Ignore env vars which bash and maybe other shells set automatically.
next if $k eq any <SHLVL _ OLDPWD PS1>;
- if (%child_env{$k} !~~ $v) {
+ my $child_v = %child_env{$k} // "";
+ if $child_v !~~ $v {
if (! $err) {
#?rakudo todo 'nom regression'
#?niecza todo 'Environment gets propagated to child.'
flunk("Environment gets propagated to child.");
$err++;
};
diag "Expected: $k=$v";
- diag "Got: $k=%child_env{$k}";
+ diag "Got: $k=$child_v";
} else {
# diag "$k=$v";
};
@@ -100,14 +101,15 @@ $err = 0;
for %*ENV.kv -> $k,$v {
# Ignore env vars which bash and maybe other shells set automatically.
next if $k eq any <SHLVL _ OLDPWD PS1>;
- if (%child_env{$k} !~~ $v) {
+ my $child_v = %child_env{$k} // "";
+ if $child_v !~~ $v {
if (! $err) {
#?niecza todo 'Environment gets propagated to child.'
flunk("Environment gets propagated to child.");
$err++;
};
diag "Expected: $k=$v";
- diag "Got: $k=%child_env{$k}";
+ diag "Got: $k=$child_v";
} else {
# diag "$k=$v";
};

0 comments on commit 330bd62

Please sign in to comment.
Something went wrong with that request. Please try again.