From: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Tue, 6 Feb 2007 22:29:45 +0000 (+0000)
Subject: Avoid obscure failures when a regexp hasn't matched
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=40ff300dec6feccc3604f666dbf63e5fa5916402;p=p5sagit%2Fp5-mst-13.2.git

Avoid obscure failures when a regexp hasn't matched

p4raw-id: //depot/perl@30149
---

diff --git a/t/op/bless.t b/t/op/bless.t
index 6aea7ba..d5ae885 100644
--- a/t/op/bless.t
+++ b/t/op/bless.t
@@ -14,10 +14,14 @@ sub expected {
     is(ref($object), $package);
     my $r = qr/^\Q$package\E=(\w+)\(0x([0-9a-f]+)\)$/;
     like("$object", $r);
-    "$object" =~ $r;
-    is($1, $type);
-    # in 64-bit platforms hex warns for 32+ -bit values
-    cmp_ok(do {no warnings 'portable'; hex($2)}, '==', $object);
+    if ("$object" =~ $r) {
+	is($1, $type);
+	# in 64-bit platforms hex warns for 32+ -bit values
+	cmp_ok(do {no warnings 'portable'; hex($2)}, '==', $object);
+    }
+    else {
+	fail(); fail();
+    }
 }
 
 # test blessing simple types