summaryrefslogtreecommitdiff
path: root/t/op/switch.t
diff options
context:
space:
mode:
authorjosh <twists@gmail.com>2007-10-14 14:37:08 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-10-17 08:17:29 +0000
commit1e1d4b91957a9f66bbb14b2c7f1bbf88c1f89cdf (patch)
treeab06c1b94ecf038d0bb7b80ad7e53a8ece4b28a3 /t/op/switch.t
parenta5a709ec819bfe84b1af6f781d5d87ef68e00c3a (diff)
downloadperl-1e1d4b91957a9f66bbb14b2c7f1bbf88c1f89cdf.tar.gz
Fix a few segfaults and a when() bug
From: "josh" <twists@gmail.com> Message-ID: <20071015043708.GA10981@grenekatz.org> p4raw-id: //depot/perl@32120
Diffstat (limited to 't/op/switch.t')
-rw-r--r--t/op/switch.t20
1 files changed, 15 insertions, 5 deletions
diff --git a/t/op/switch.t b/t/op/switch.t
index 98e10f6b44..d897157946 100644
--- a/t/op/switch.t
+++ b/t/op/switch.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use warnings;
-use Test::More tests => 107;
+use Test::More tests => 108;
# The behaviour of the feature pragma should be tested by lib/switch.t
# using the tests in t/lib/switch/*. This file tests the behaviour of
@@ -457,6 +457,16 @@ sub bar {"bar"}
# Other things that should not be smart matched
{
my $ok = 0;
+ given(12) {
+ when( /(\d+)/ and ( 1 <= $1 and $1 <= 12 ) ) {
+ $ok = 1;
+ }
+ }
+ ok($ok, "bool not smartmatches");
+}
+
+{
+ my $ok = 0;
given(0) {
when(eof(DATA)) {
$ok = 1;
@@ -500,13 +510,13 @@ sub bar {"bar"}
}
{
- my $ok = 1;
- given(0) {
+ my $ok = 0;
+ given("foo") {
when((1 == $ok) || "foo") {
- $ok = 0;
+ $ok = 1;
}
}
- ok($ok, '((1 == $ok) || "foo") not smartmatched');
+ ok($ok, '((1 == $ok) || "foo") smartmatched');
}