summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-03-13 11:47:58 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-03-13 11:47:58 +0100
commit62ec5f58625ce7dd38f2ee3ba00b450373b0de40 (patch)
tree49aad23b733eb6db30fd902091b0f9100e295255 /t
parent85af77a5094f7cce94729e17e3c28f0a2e709ebe (diff)
downloadperl-62ec5f58625ce7dd38f2ee3ba00b450373b0de40.tar.gz
Make smart matching ~~ undef dispatch only on the RHS
Diffstat (limited to 't')
-rw-r--r--t/op/smartmatch.t1
-rw-r--r--t/op/switch.t21
2 files changed, 14 insertions, 8 deletions
diff --git a/t/op/smartmatch.t b/t/op/smartmatch.t
index 52e7f911e6..0097bff858 100644
--- a/t/op/smartmatch.t
+++ b/t/op/smartmatch.t
@@ -135,6 +135,7 @@ __DATA__
! "" undef
! !1 undef
undef undef
+ (my $u) undef
# Any ~~ object overloaded
# object overloaded ~~ Any
diff --git a/t/op/switch.t b/t/op/switch.t
index b00ade8cc1..de44082bc7 100644
--- a/t/op/switch.t
+++ b/t/op/switch.t
@@ -133,14 +133,16 @@ sub check_outside1 { is($_, "outside", "\$_ lexically scoped") }
is($ok, 1, "Given(0) when($undef++)");
}
{
- my $ok = 1;
- given (undef) { when(0) {$ok = 0} }
+ no warnings "uninitialized";
+ my $ok = 0;
+ given (undef) { when(0) {$ok = 1} }
is($ok, 1, "Given(undef) when(0)");
}
{
+ no warnings "uninitialized";
my $undef;
- my $ok = 1;
- given ($undef) { when(0) {$ok = 0} }
+ my $ok = 0;
+ given ($undef) { when(0) {$ok = 1} }
is($ok, 1, 'Given($undef) when(0)');
}
########
@@ -156,14 +158,16 @@ sub check_outside1 { is($_, "outside", "\$_ lexically scoped") }
is($ok, 1, 'Given("") when($undef)');
}
{
- my $ok = 1;
- given (undef) { when("") {$ok = 0} }
+ no warnings "uninitialized";
+ my $ok = 0;
+ given (undef) { when("") {$ok = 1} }
is($ok, 1, 'Given(undef) when("")');
}
{
+ no warnings "uninitialized";
my $undef;
- my $ok = 1;
- given ($undef) { when("") {$ok = 0} }
+ my $ok = 0;
+ given ($undef) { when("") {$ok = 1} }
is($ok, 1, 'Given($undef) when("")');
}
########
@@ -617,6 +621,7 @@ my $f = tie my $v, "FetchCounter";
my $ok;
$v = undef;
is($f->count(), 0, "Sanity check: $test_name");
+ no warnings "uninitialized";
given(my $undef) {
when(sub{0}->()) {}
when("21") {}