Subject: | [PATCH] Fix with Test::Builder::Tester 0.32 |
Test::Script requires Test::Builder::Tester, the version which came with
5.8.8, but tests do not pass with that version. The test_err('/.../')
regex syntax was broken for a period ending with Test::More 0.66. Since
I don't think Test::Script needs to work before qr// is available, it
can just use that.
Subject: | Test-Script-old-TB.patch |
From 1c202e6081e37d2b8324e8784e2ea48fb1c6c5a9 Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Wed, 21 Nov 2012 21:02:05 -0500
Subject: [PATCH] Fix the tests for Test::Builder::Tester 1.02.
The test_err('/.../') syntax was eliminated for a period until 0.66.
---
Test-Script/t/03_compiles_bad.t | 5 +++--
Test-Script/t/05_runs_bad.t | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Test-Script/t/03_compiles_bad.t b/Test-Script/t/03_compiles_bad.t
index 7a69a8e..36e7772 100644
--- a/Test-Script/t/03_compiles_bad.t
+++ b/Test-Script/t/03_compiles_bad.t
@@ -18,6 +18,7 @@ use File::Spec::Functions ':ALL';
$ENV{HARNESS_ACTIVE} ||= 0;
my $bad = catfile('t', 'bin', 'bad.pl');
+my $qbad = quotemeta($bad);
ok( -f $bad, 'Found bad script' );
@@ -31,7 +32,7 @@ SCOPE: {
# Run a test for a known-bad program
test_out("not ok 1 - Script t/bin/bad.pl compiles");
test_fail(+3);
- test_err("/# \\d+ - (?:Using.*\\n# )?Bad at " . quotemeta($bad) . " line 4./");
+ test_err(qr{# \d+ - (?:Using.*\n# )?Bad at $qbad line 4\.\n});
test_err("# BEGIN failed--compilation aborted at $bad line 5.");
my $rv = script_compiles('t/bin/bad.pl');
test_test('Bad script returns false');
@@ -42,7 +43,7 @@ SCOPE: {
# Repeat with a custom message
test_out("not ok 1 - It worked");
test_fail(+3);
- test_err("/# \\d+ - (?:Using.*\\n# )?Bad at " . quotemeta($bad) . " line 4./");
+ test_err(qr{# \d+ - (?:Using.*\n# )?Bad at $qbad line 4.\n});
test_err("# BEGIN failed--compilation aborted at $bad line 5.");
my $rv = script_compiles('t/bin/bad.pl', 'It worked');
test_test('Bad script returns false');
diff --git a/Test-Script/t/05_runs_bad.t b/Test-Script/t/05_runs_bad.t
index 1d97a9d..0f342a6 100644
--- a/Test-Script/t/05_runs_bad.t
+++ b/Test-Script/t/05_runs_bad.t
@@ -27,7 +27,7 @@ SCOPE: {
# Run a test for a known-good program
test_out('not ok 1 - Script t/bin/four.pl runs');
test_fail(+2);
- test_err('/^# 4 - (?:Using.*\n# )?Standard Error$/');
+ test_err(qr{^# 4 - (?:Using.*\n# )?Standard Error\n?$});
my $rv = script_runs('t/bin/four.pl');
test_test('Bad script returns false');
is( $rv, '', 'script_compiles_ok returns true as a convenience' );
@@ -37,7 +37,7 @@ SCOPE: {
# Repeat with a custom message
test_out('not ok 1 - It worked');
test_fail(+2);
- test_err('/^# 4 - (?:Using.*\n# )?Standard Error$/');
+ test_err(qr{^# 4 - (?:Using.*\n# )?Standard Error\n?$});
my $rv = script_runs('t/bin/four.pl', 'It worked');
test_test('Bad script returns false');
is( $rv, '', 'script_compiles_ok returns true as a convenience' );
--
1.7.10.1