[Bps-public-commit] Plack-Middleware-Test-StashWarnings branch, master, updated. 0.06-3-g27c9838

Alex Vandiver alexmv at bestpractical.com
Mon Nov 12 23:18:25 EST 2012


The branch, master has been updated
       via  27c9838fe50a85968fd3ee0506eae935941826c0 (commit)
       via  9ee6473da9e1a91d938d4c4b02b092b20ba437a4 (commit)
       via  9096d5def5a97711c10c4259725adca62197e0e2 (commit)
      from  f3a4ccac09de6ce01d4248fec409a7abed2467ac (commit)

Summary of changes:
 Changes                                    |  3 +++
 lib/Plack/Middleware/Test/StashWarnings.pm |  2 +-
 t/basic.t                                  |  1 +
 t/destroy.t                                | 12 ++++++++++--
 t/stream.t                                 |  1 +
 5 files changed, 16 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 9096d5def5a97711c10c4259725adca62197e0e2
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 12 23:09:25 2012 -0500

    Unable warnings in the test files, for Test::Harness >= 3.24 compat
    
    Test::Harness 3.24 changed 'make test' to no longer pass -w to prove.
    As the tests relied on warnings being abled to generate the expected
    warnings in the PSGI applications, this caused tests to fail.  This
    failure mode also existed on Test::Harness < 3.24, when run with `prove`
    instead of `prove -w`.
    
    Explicitly enable warnings, as should have happened all along.

diff --git a/t/basic.t b/t/basic.t
index e3c7626..1c42175 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -1,4 +1,5 @@
 use strict;
+use warnings;
 use Plack::Test;
 use Test::More;
 use HTTP::Request::Common;
diff --git a/t/destroy.t b/t/destroy.t
index d56c61d..ca450b3 100644
--- a/t/destroy.t
+++ b/t/destroy.t
@@ -1,4 +1,5 @@
 use strict;
+use warnings;
 use Plack::Test;
 use Test::More;
 use HTTP::Request::Common;
diff --git a/t/stream.t b/t/stream.t
index 4d36b39..6341bb4 100644
--- a/t/stream.t
+++ b/t/stream.t
@@ -1,4 +1,5 @@
 use strict;
+use warnings;
 use Plack::Test;
 use Test::More;
 use HTTP::Request::Common;

commit 9ee6473da9e1a91d938d4c4b02b092b20ba437a4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 12 23:11:11 2012 -0500

    Set TEST_VERBOSE explicitly, as it controls the module's behavior
    
    Having TEST_VERBOSE set means that the previous __WARN__ handler is
    called when warnings occur in the child.  This means that t/destroy.t
    failed when run with -v, as the initial inner warning was pushed onto
    @warnings, in addition to the "Unhandled warning" warning.
    
    Explicitly set $ENV{TEST_VERBOSE} in the test, so that the behavior of
    the test file is consistent no matter how it is called.

diff --git a/t/destroy.t b/t/destroy.t
index ca450b3..3e75c13 100644
--- a/t/destroy.t
+++ b/t/destroy.t
@@ -20,6 +20,11 @@ local $SIG{__WARN__} = sub {
 };
 
 my $weak_mw;
+
+# Plack::Middleware::Test::StashWarnings calls the old __WARN__ handler
+# if TEST_VERBOSE is set.  Fake its existance for now, so that tests
+# pass under both `prove -v` and `prove`
+$ENV{TEST_VERBOSE} = 1;
 {
     my $mw = Plack::Middleware::Test::StashWarnings->new;
     my $new_app = $mw->wrap($app);
@@ -34,7 +39,9 @@ my $weak_mw;
         is $res->content_type, 'text/plain';
     };
 
-    is @warnings, 0, "no warnings yet";
+    is @warnings, 1, "Got the uninitialized value warning";
+    like $warnings[0], qr/Use of uninitialized value (?:\$name )?in concatenation/;
+    @warnings = ();
 }
 
 # XXX: on 5.8.x we have to explicitly trigger the destructor because there's a memory leak
@@ -44,7 +51,7 @@ if ($weak_mw) {
     $weak_mw->DESTROY;
 }
 
-is @warnings, 1, "caught one warning";
+is @warnings, 1, "Got 'uncaught warning' warning";
 like $warnings[0], qr/Unhandled warning: Use of uninitialized value (?:\$name )?in concatenation/;
 
 done_testing;

commit 27c9838fe50a85968fd3ee0506eae935941826c0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Nov 12 23:17:58 2012 -0500

    0.07 and its Changes

diff --git a/Changes b/Changes
index dc07542..0efd5a3 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Perl extension Plack::Middleware::Test::StashWarnings
 
+0.07  2012-11-12
+        - Test updates to work with newer Test::Harness
+
 0.06  2012-03-21
         - Added a method to add a warning by hand
 
diff --git a/lib/Plack/Middleware/Test/StashWarnings.pm b/lib/Plack/Middleware/Test/StashWarnings.pm
index ee1962a..021c5ca 100644
--- a/lib/Plack/Middleware/Test/StashWarnings.pm
+++ b/lib/Plack/Middleware/Test/StashWarnings.pm
@@ -2,7 +2,7 @@ package Plack::Middleware::Test::StashWarnings;
 
 use strict;
 use 5.008_001;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 use parent qw(Plack::Middleware);
 use Carp ();

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list