From a4d71a641114d0af47ef030eaa0a5d0bd87e52d2 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <slaven@rezic.de>
Date: Fri, 21 Nov 2014 19:40:38 +0100
Subject: [PATCH] adapt tests for Carp 1.25 (RT #75383) and newer perls (RT
 #100500)

Carp 1.25 added an extra dot to the end of error messages.

Additionally, starting with perl 5.21.x a "use strict" violation has
additional diagnostics in the error message.

This change is adapting the tests so that the test suite should run
successfully with newer and older Carp, and with older and newer
perl versions.
---
 t/10_slaymakefile.init/SlayMakefile.main     |  2 ++
 t/20_slaymakefile_msg.init/SlayMakefile.main | 10 +++++++---
 t/30_slaymake.init/SlayMakefile.main         |  2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/t/10_slaymakefile.init/SlayMakefile.main b/t/10_slaymakefile.init/SlayMakefile.main
index 195f8c2..3f756a7 100644
--- a/t/10_slaymakefile.init/SlayMakefile.main
+++ b/t/10_slaymakefile.init/SlayMakefile.main
@@ -31,6 +31,8 @@ test:	{ @OKS }
 		$sm->parse($deps->[0]);
 	    }
 	    $sm->make;
+	    s{(at SlayMakefile\.main line \d+)\.}{$1}g for @OUTPUT;
+	    s{ \(did you forget to declare "my \$.*?"\?\)}{}g for @OUTPUT;
 	    open T, ">$target";
 	    print T @OUTPUT;
 	    close T;
diff --git a/t/20_slaymakefile_msg.init/SlayMakefile.main b/t/20_slaymakefile_msg.init/SlayMakefile.main
index 260f304..2e032ba 100644
--- a/t/20_slaymakefile_msg.init/SlayMakefile.main
+++ b/t/20_slaymakefile_msg.init/SlayMakefile.main
@@ -23,10 +23,14 @@ test:	{ @OKS }
 	    my $errs = eval { $sm->parse($deps->[0]) };
 	    open T, ">$target";
 	    if ($errs) {
-		s/(SlayMakefile\.main line )\d+/${1}314159/ foreach @$errs;
+		s/(SlayMakefile\.main line )\d+\.?/${1}314159/ foreach @$errs;
 		print T @$errs;
 	    }
-	    print T $@ if $@;
+	    if ($@) {
+		my $err = $@;
+		$err =~ s/(SlayMakefile\.main line \d+)\.?/$1/;
+		print T $err;
+	    }
 	    close T;
 	}
 
@@ -42,7 +46,7 @@ no_targets.log:  no_targets.smak
 	    push @errs, $@ if $@;
 	    open T, ">$target";
 	    if (@errs) {
-		s/(SlayMakefile\.main line )\d+/${1}314159/ foreach @errs;
+		s/(SlayMakefile\.main line )\d+\.?/${1}314159/ foreach @errs;
 		print T @errs;
 	    }
 	    close T;
diff --git a/t/30_slaymake.init/SlayMakefile.main b/t/30_slaymake.init/SlayMakefile.main
index 219568c..b636644 100644
--- a/t/30_slaymake.init/SlayMakefile.main
+++ b/t/30_slaymake.init/SlayMakefile.main
@@ -14,7 +14,7 @@
 	if $ENV{COVER};
     my $flags = join ' ', @flags;
     $SLAYMAKE = "$^X $flags -I ../../blib/lib ../../blib/script/slaymake";
-    $SANITIZE = "$^X -pe 's/(slaymake line) \\d+/\\1 314159/; s/(slaymake) \\d+(\\.\\d+)+/\\1 3.141.59/'";
+    $SANITIZE = "$^X -pe 's/(slaymake line) \\d+\.?/\\1 314159/; s/(slaymake) \\d+(\\.\\d+)+/\\1 3.141.59/'";
 }
 
 test:	{ @OKS }
-- 
2.1.2