Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 31cf36d856d343d5b2cf0355b60000ee > files > 1

perl-TryCatch-1.3.0-5.mga3.src.rpm

--- TryCatch-1.003000/t/invalid.t	2010-10-13 01:59:56.000000000 +0000
+++ invalid.t	2013-01-23 23:01:37.695578257 +0000
@@ -5,7 +5,11 @@
 use Test::Exception;
 use TryCatch;
 
-my $line;
+require B::Hooks::EndOfScope;
+# after 0.11 'Hooks' changed some of our messages
+my $hooks_post_011 = ($B::Hooks::EndOfScope::VERSION > 0.11);
+
+my ($line, $expected_line, $regexp);
 
 test_for_error(
   qr/^block required after try at .*? line (\d+)\b/, 
@@ -22,8 +26,16 @@
 # Its really *really* wierd that this 'fixes' things. I blame string evals
 eval "use TryCatch; try {} catch" if $] >= 5.011000;
 
+if ($hooks_post_011) {
+  $regexp = qr/block required after catch .+at \(eval \d+\) line (\d+)\b/ms;
+  $expected_line = 9;
+}
+else {
+  $regexp = qr/^block required after catch at \(eval \d+\) line (\d+)\b/;
+  $expected_line = 5;
+}
 test_for_error(
-  qr/^block required after catch at \(eval \d+\) line (\d+)\b/,
+  $regexp,
   "no block after catch",
   <<'EOC');
 use TryCatch;
@@ -33,10 +45,18 @@
 my $foo = 2;
 EOC
 
-is($line, 5, "Error from line 5");
+is($line, $expected_line, "Error from line $expected_line");
 
+if ($hooks_post_011) {
+   $regexp = qr/Parameter expected near '\^' in '\^Err \$e'.+\nsyntax error at \(eval \d+\) line (\d+)\b/ms;
+   $expected_line = 5;
+}
+else {
+   $regexp = qr/^Parameter expected near '\^' in '\^Err \$e' at \(eval \d+\) line (\d+)\b/;
+   $expected_line = 4;
+}
 test_for_error(
-   qr/^Parameter expected near '\^' in '\^Err \$e' at \(eval \d+\) line (\d+)\b/,
+   $regexp,
    "invalid catch signature",
   <<'EOC');
 # line 1
@@ -47,10 +67,18 @@
 next;
 EOC
 
-is($line, 4, "Error from line 4");
+is($line, $expected_line, "Error from line $expected_line");
 
+if ($hooks_post_011) {
+  $regexp = qr/Run-away catch signature at.+\nMissing right curly or square bracket at \(eval \d+\) line (\d+)/;
+  $expected_line = 5;
+}
+else {
+  $regexp = qr/^Run-away catch signature at \(eval \d+\) line (\d+)/;
+  $expected_line = 4;
+}
 test_for_error(
-  qr/^Run-away catch signature at \(eval \d+\) line (\d+)/,
+  $regexp,
   "invalid catch signature (missing parenthesis)",
   <<'EOC');
 use TryCatch;
@@ -65,7 +93,7 @@
 1;
 EOC
 
-is($line, 4, "Error from line 4");
+is($line, $expected_line, "Error from line $expected_line");
 
 
 test_for_error(