Subject: | Test try_examples.t failed with perl 5.16 |
I ran the tests of Test-Unit-0.25 on system with perl 5.16 and
try_examples.t failed. The output is below.
The failure was caused by new warning "defined(@array) is deprecated" in
the perl 5.16.
The module Test::Unit::TestCase could be fixed by the patch in the
attachment.
+ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
defined(@array) is deprecated at
/builddir/build/BUILD/Test-Unit-0.25/blib/lib/Test/Unit/TestCase.pm line
106.
(Maybe you should just omit the defined()?)
t/all_tests.t ..... ok
defined(@array) is deprecated at
/builddir/build/BUILD/Test-Unit-0.25/blib/lib/Test/Unit/TestCase.pm line
106.
(Maybe you should just omit the defined()?)
t/assert.t ........ ok
# Test 1 got: "defined(@array) is deprecated at
/builddir/build/BUILD/Test-Unit-0.25/blib/lib/Test/Unit/TestCase.pm line
106.\n# \t(Maybe you should just omit the defined()?)\n# Suite setup\n#
TEST-RUN-SUMMARY\n# \n# TIME-SUMMARY\n# \n# !!!FAILURES!!!\n# Test
Results:\n# Run: 2, Failures: 1, Errors: 0\n# \n# There was 1
failure:\n# 1) examples/fail_example.pm:19 - test_fail(fail_example)\n#
Born to lose ...\n# \n# Test was not successful.\n# " (t/try_examples.t
at line 106)
# Expected: "Suite setup\n# TEST-RUN-SUMMARY\n# \n# TIME-SUMMARY\n#
\n# !!!FAILURES!!!\n# Test Results:\n# Run: 2, Failures: 1, Errors: 0\n#
\n# There was 1 failure:\n# 1) examples/fail_example.pm:19 -
test_fail(fail_example)\n# Born to lose ...\n# \n# Test was not
successful.\n# "
# (Install the Algorithm::Diff module to have differences in multiline
# output explained. You might also set the PERL_TEST_DIFF environment
# variable to run a diff program on the output.)
# t/try_examples.t line 106 is: ok($out, $guru_checked{$e});
# Test 2 got: "defined(@array) is deprecated at
/builddir/build/BUILD/Test-Unit-0.25/blib/lib/Test/Unit/TestCase.pm line
106.\n# \t(Maybe you should just omit the defined()?)\n# ...\n#
TIME-SUMMARY\n# \n# OK (3 tests)\n# " (t/try_examples.t at line 106 fail #2)
# Expected: "...\n# TIME-SUMMARY\n# \n# OK (3 tests)\n# "
# Test 3 got: "defined(@array) is deprecated at
/builddir/build/BUILD/Test-Unit-0.25/blib/lib/Test/Unit/TestCase.pm line
106.\n# \t(Maybe you should just omit the defined()?)\n# ...\n#
TIME-SUMMARY\n# \n# OK (3 tests)\n# " (t/try_examples.t at line 106 fail #3)
# Expected: "...\n# TIME-SUMMARY\n# \n# OK (3 tests)\n# "
# Test 4 got: "defined(@array) is deprecated at
/builddir/build/BUILD/Test-Unit-0.25/blib/lib/Test/Unit/TestCase.pm line
106.\n# \t(Maybe you should just omit the defined()?)\n# ...\n#
TIME-SUMMARY\n# \n# OK (3 tests)\n# " (t/try_examples.t at line 106 fail #4)
# Expected: "...\n# TIME-SUMMARY\n# \n# OK (3 tests)\n# "
t/try_examples.t ..
Failed 4/4 subtests
Test Summary Report
-------------------
t/try_examples.t (Wstat: 0 Tests: 4 Failed: 4)
Failed tests: 1-4
Files=3, Tests=89, 1 wallclock secs ( 0.05 usr 0.01 sys + 1.28 cusr
0.07 csys = 1.41 CPU)
Subject: | perl5.16.patch |
diff -up Test-Unit-0.25/lib/Test/Unit/TestCase.pm.orig Test-Unit-0.25/lib/Test/Unit/TestCase.pm
--- Test-Unit-0.25/lib/Test/Unit/TestCase.pm.orig 2012-06-12 15:38:32.058355073 +0200
+++ Test-Unit-0.25/lib/Test/Unit/TestCase.pm 2012-06-12 15:38:58.340484917 +0200
@@ -103,7 +103,7 @@ sub list_tests {
my $class = ref($_[0]) || $_[0];
my @tests = ();
no strict 'refs';
- if (defined(@{"$class\::TESTS"})) {
+ if (@{"$class\::TESTS"}) {
push @tests, @{"$class\::TESTS"};
}
else {