From 5a1a931405d302b3f2e7d39dbbe600ef62b8978b Mon Sep 17 00:00:00 2001 From: Chad Granum Date: Fri, 26 Sep 2014 20:25:20 -0700 Subject: [PATCH] Fix things to work with Test::Stream This is a minimal fix. Ideally Test::Class would be switched around to actually use Test::Stream directly, but that is a huge task. --- t/fail2.t | 7 ++++--- t/runtests_die.t | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/t/fail2.t b/t/fail2.t index 99ee551..543f29e 100644 --- a/t/fail2.t +++ b/t/fail2.t @@ -28,9 +28,10 @@ my $identifier = ($Test::More::VERSION < 0.88) ? 'object' : 'thing'; test_out(qr/not ok 1 - (?:The $identifier|undef) isa '?Object'?\n/); test_out("not ok 2 - cannot create Objects"); test_fail(-12); -test_err( "# (in Object::Test->_test_new)" ); -test_err(qr/#\s+(?:The $identifier|undef) isn't defined\n/); -test_fail(-15); +test_err( $_ ) for $INC{'Test/Stream.pm'} + ? (qr/#\s+(?:The $identifier|undef) isn't defined\n/, "# (in Object::Test->_test_new)") + : ("# (in Object::Test->_test_new)", qr/#\s+(?:The $identifier|undef) isn't defined\n/); +test_fail(-16); test_err( "# (in Object::Test->_test_new)" ); Object::Test->runtests; diff --git a/t/runtests_die.t b/t/runtests_die.t index 2191a23..a66e8f4 100755 --- a/t/runtests_die.t +++ b/t/runtests_die.t @@ -25,10 +25,12 @@ my $identifier = ($Test::More::VERSION < 0.88) ? 'object' : 'thing'; test_out( qr/not ok 1 - (?:The $identifier|undef) isa '?Object'?\n/); test_err( "# Failed test ($filename at line 15)"); -test_err( "# (in Foo->test_object)" ); -test_err( qr/# (?:The $identifier|undef) isn't defined\n/); +test_err( $_ ) for $INC{'Test/Stream.pm'} + ? ( qr/# (?:The $identifier|undef) isn't defined\n/, "# (in Foo->test_object)") + : ( "# (in Foo->test_object)", qr/# (?:The $identifier|undef) isn't defined\n/); test_out( "not ok 2 - test_object died (could not create object)"); -test_err( "# Failed test ($filename at line 33)"); -test_err( "# (in Foo->test_object)" ); +test_err( $_ ) for $INC{'Test/Stream.pm'} + ? ("# Failed test ($filename at line 35)", "# (in Foo->test_object)") + : ("# (in Foo->test_object)", "# Failed test ($filename at line 35)"); Foo->runtests; test_test("early die handled");