From 73074da4a57deadc4c3abf71dd52bca8b671388c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0abata?= <[email protected]> Date: Fri, 5 Jun 2015 15:33:33 +0200 Subject: Fix the test suite so it works with Test::Expect 0.33+
diff --git a/Carp-REPL-0.17-ugly-fixes-for-failing-tests.patch b/Carp-REPL-0.17-ugly-fixes-for-failing-tests.patch new file mode 100644 index 0000000..ff205e0 --- /dev/null +++ b/Carp-REPL-0.17-ugly-fixes-for-failing-tests.patch @@ -0,0 +1,286 @@ +From 6433c616be895c6572661e4d4b373e24e5b90d9b Mon Sep 17 00:00:00 2001 +From: Gianni Ceccarelli <[email protected]> +Date: Thu, 9 Apr 2015 11:35:42 +0100 +Subject: [PATCH] ugly fixes for failing tests + +this works with Test::Expect 0.30 (like it did before) and 0.31 +0.32 (which failed) + +note that I'm not sure what the tests are doing! they may well be +testing meaningless stuff +--- + t/04-scope.t | 65 +++++++++++++++------------------------------------ + t/07-frame.t | 26 ++++++++------------- + t/09-args.t | 8 +++---- + t/11-warn.t | 8 +++---- + t/lib/TestHelpers.pm | 22 +++++++++++++++++ + t/lib/TestHelpers.pm~ | 21 +++++++++++++++++ + 6 files changed, 80 insertions(+), 70 deletions(-) + create mode 100644 t/lib/TestHelpers.pm + create mode 100644 t/lib/TestHelpers.pm~ + +diff --git a/t/04-scope.t b/t/04-scope.t +index 030f6e1..9cf066d 100644 +--- a/t/04-scope.t ++++ b/t/04-scope.t +@@ -3,6 +3,8 @@ use strict; + use warnings; + use Test::More tests => 37; + use Test::Expect; ++use lib 't/lib'; ++use TestHelpers qw(e_value e_defined); + + expect_run + ( +@@ -14,54 +16,25 @@ expect_run + expect_send('1 + 1'); + expect_like(qr/\b2\b/, 'in the REPL'); + +-expect_send('$pre_lexical'); +-expect_like(qr/\balpha\b/); ++e_value('$pre_lexical','alpha'); ++e_value('$pre_global_safe','sheep'); ++e_value('$inner_lexical','parking'); ++e_value('$inner_global','to'); ++e_value('$pre_global','shadow stabbing'); ++e_value('$post_global','go'); ++e_value('$main::post_global','go'); + +-expect_send('$pre_global_safe'); +-expect_like(qr/\bsheep\b/); ++e_defined('$post_local',0); ++e_defined('$postcall_local',0); ++e_defined('$postcall_global',0); ++e_defined('$other_lexical',0); + +-expect_send('$inner_lexical'); +-expect_like(qr/\bparking\b/); ++e_value('$other_global','long jacket'); ++e_value('$main::other_global','long jacket'); + +-expect_send('$inner_global'); +-expect_like(qr/\bto\b/); ++e_defined('$birds',0); ++e_defined('$window',0); + +-expect_send('$pre_global'); +-expect_like(qr/\bshadow stabbing\b/); +- +-expect_send('$post_global'); +-expect_like(qr/\bgo\b/); +- +-expect_send('$main::post_global'); +-expect_like(qr/\bgo\b/); +- +-expect_send('$post_local'); +-expect_like(qr/^\s*\$post_local\s*$/m); +- +-expect_send('$postcall_local'); +-expect_like(qr/^\s*\$postcall_local\s*$/m); +- +-expect_send('$postcall_global'); +-expect_like(qr/^\s*\$postcall_global\s*$/m); +- +-expect_send('$other_lexical'); +-expect_like(qr/^\s*\$other_lexical\s*$/m); +- +-expect_send('$other_global'); +-expect_like(qr/\blong jacket\b/); +- +-expect_send('$main::other_global'); +-expect_like(qr/\blong jacket\b/); +- +-expect_send('$birds'); +-expect_like(qr/^\s*\$birds\s*$/m); +- +-expect_send('$window'); +-expect_like(qr/^\s*\$window\s*$/m); +- +-expect_send('$Mr::Mastodon::Farm::birds'); +-expect_like(qr/\bfall\b/); +- +-expect_send('$Mr::Mastodon::Farm::window'); +-expect_is('$Mr::Mastodon::Farm::window', 'output was exactly what we gave to the repl, meaning the output was undef'); ++e_value('$Mr::Mastodon::Farm::birds','fall'); + ++e_defined('$Mr::Mastodon::Farm::window',0); +diff --git a/t/07-frame.t b/t/07-frame.t +index 73c607f..937ebdf 100644 +--- a/t/07-frame.t ++++ b/t/07-frame.t +@@ -3,6 +3,8 @@ use strict; + use warnings; + use Test::More tests => 55; + use Test::Expect; ++use lib 't/lib'; ++use TestHelpers qw(e_value e_defined); + + expect_run + ( +@@ -25,38 +27,32 @@ expect_like(qr{^main::fib\(5\) called at t/scripts/07-frame\.pl line 12}m); + expect_send('1 + 1'); + expect_like(qr/\b2\b/, 'in the REPL'); + +-expect_send('$n'); +-expect_like(qr/-1\b/); ++e_value('$n',-1); + + expect_send(':u'); + expect_like(qr{\bNow at t/scripts/07-frame\.pl:9 \(frame 1\)\.}); + +-expect_send('$n'); +-expect_like(qr/\b0\b/); ++e_value('$n',0); + + expect_send(':up'); + expect_like(qr{\bNow at t/scripts/07-frame\.pl:9 \(frame 2\)\.}); + +-expect_send('$n'); +-expect_like(qr/\b1\b/); ++e_value('$n',1); + + expect_send(':d'); + expect_like(qr{\bNow at t/scripts/07-frame\.pl:9 \(frame 1\)\.}); + +-expect_send('$n'); +-expect_like(qr/\b0\b/); ++e_value('$n',0); + + expect_send(':down'); + expect_like(qr{\bNow at t/scripts/07-frame\.pl:8 \(frame 0\)\.}); + +-expect_send('$n'); +-expect_like(qr/-1\b/); ++e_value('$n',-1); + + expect_send(':d'); + expect_like(qr{\bYou're already at the bottom frame\.}); + +-expect_send('$n'); +-expect_like(qr/-1\b/); ++e_value('$n',-1); + + expect_send('my $m = 10'); + expect_like(qr/\b10\b/); +@@ -64,8 +60,7 @@ expect_like(qr/\b10\b/); + expect_send(':u'); + expect_like(qr{\bNow at t/scripts/07-frame\.pl:9 \(frame 1\)\.}); + +-expect_send('$m'); +-expect_like(qr/^\s*\$m\s*$/m); ++e_value('$m',10); + + expect_send(':t'); + # examine the stack trace +@@ -81,8 +76,7 @@ expect_like(qr{main::fib\(5\) called at t/scripts/07-frame\.pl line 12}m); + expect_send(':bottom'); + expect_like(qr{\bNow at t/scripts/07-frame\.pl:8 \(frame 0\)\.}); + +-expect_send('$m'); +-expect_like(qr/^\s*\$m\s*$/m); ++e_value('$m',10); + + expect_send(':top'); + expect_like(qr{\bNow at t/scripts/07-frame\.pl:12 \(frame 7\)\.}); +diff --git a/t/09-args.t b/t/09-args.t +index 463aaba..254c9dc 100644 +--- a/t/09-args.t ++++ b/t/09-args.t +@@ -38,10 +38,10 @@ expect_send('@$_a'); + expect_like(qr/\bI I\b/); + + expect_send(':u'); +-expect_send('@$_a'); +-expect_like(qr/\bI\b/); ++expect_send('"<@$_a>"'); ++expect_like(qr/^<I>$/m); + + expect_send(':u'); +-expect_send('@$_a'); +-expect_like(qr/\A\@\$_a\Z/); ++expect_send('"<@$_a>"'); ++expect_like(qr/^<>$/m); + +diff --git a/t/11-warn.t b/t/11-warn.t +index f840778..34b06e1 100644 +--- a/t/11-warn.t ++++ b/t/11-warn.t +@@ -3,6 +3,8 @@ use strict; + use warnings; + use Test::More tests => 7; + use Test::Expect; ++use lib 't/lib'; ++use TestHelpers qw(e_value e_defined); + + expect_run + ( +@@ -14,9 +16,7 @@ expect_run + expect_send('1 + 1'); + expect_like(qr/2/); + +-expect_send('$a'); +-expect_like(qr/\b4\b/); ++e_value('$a',4); + +-expect_send('$b'); +-expect_like(qr/\A\s*\$b\s*\Z/); ++e_defined('$b',0); + +diff --git a/t/lib/TestHelpers.pm b/t/lib/TestHelpers.pm +new file mode 100644 +index 0000000..995e5c0 +--- /dev/null ++++ b/t/lib/TestHelpers.pm +@@ -0,0 +1,22 @@ ++package TestHelpers; ++use strict; ++use warnings; ++use 5.006000; ++use Test::Expect; ++use Sub::Exporter -setup => { ++ exports => [qw(e_value e_defined)], ++}; ++ ++sub e_value { ++ my ($name,$expected,$note) = @_; ++ expect_send($name); ++ expect_like(qr/^\Q$expected\E$/m,$note); ++} ++sub e_defined { ++ my ($name,$defined,$note) = @_; ++ expect_send("defined($name)?'ok':'not'"); ++ my $r = $defined ? qr/^ok$/m : qr/^not$/m; ++ expect_like($r,$note); ++} ++ ++1; +diff --git a/t/lib/TestHelpers.pm~ b/t/lib/TestHelpers.pm~ +new file mode 100644 +index 0000000..60351e8 +--- /dev/null ++++ b/t/lib/TestHelpers.pm~ +@@ -0,0 +1,21 @@ ++package TestHelpers; ++use strict; ++use warnings; ++use 5.006000; ++use Sub::Exporter -setup => { ++ exports => [qw(e_value e_defined)], ++}; ++ ++sub e_value { ++ my ($name,$expected,$note) = @_; ++ expect_send($name); ++ expect_like(qr/\b\Q$expected\E\b/,$note); ++} ++sub e_defined { ++ my ($name,$defined,$note) = @_; ++ expect_send("defined($name)?:'ok':'not'"); ++ my $r = $defined ? qr/\bok\b/ : qr/\bnot\b/; ++ expect_like($r,$note); ++} ++ ++1; +-- +2.0.5 + diff --git a/perl-Carp-REPL.spec b/perl-Carp-REPL.spec index 011520d..d5b237c 100644 --- a/perl-Carp-REPL.spec +++ b/perl-Carp-REPL.spec @@ -1,11 +1,14 @@ Name: perl-Carp-REPL Version: 0.17 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Read-eval-print-loop on die and/or warn License: GPL+ or Artistic Group: Development/Libraries URL: http://search.cpan.org/dist/Carp-REPL/ Source0: http://www.cpan.org/authors/id/T/TS/TSIBLEY/Carp-REPL-%{version}.tar.gz +# Fixes tests for Test::Expect 0.33+ +# rhbz#1228633, rt#103414 +Patch0: Carp-REPL-0.17-ugly-fixes-for-failing-tests.patch BuildArch: noarch # Build BuildRequires: perl @@ -43,6 +46,7 @@ you get a REPL instead of dying or continuing blindly. %prep %setup -q -n Carp-REPL-%{version} +%patch0 -p1 %build perl Makefile.PL INSTALLDIRS=vendor @@ -62,6 +66,9 @@ make test %{_mandir}/man3/* %changelog +* Fri Jun 05 2015 Petr Šabata <[email protected]> - 0.17-2 +- Fix the test suite so it works with Test::Expect 0.33+ + * Tue Nov 25 2014 Petr Šabata <[email protected]> - 0.17-1 - 0.17 bump, compatibility fixes for Devel::StackTrace 2.00 -- cgit v0.10.2 http://pkgs.fedoraproject.org/cgit/perl-Carp-REPL.git/commit/?h=master&id=73074da4a57deadc4c3abf71dd52bca8b671388c -- Fedora Extras Perl SIG http://www.fedoraproject.org/wiki/Extras/SIGs/Perl perl-devel mailing list [email protected] https://admin.fedoraproject.org/mailman/listinfo/perl-devel
