Subject: | include_tests() dies if TAP::Harness options (hashref) are passed |
It seems include_tests() does not remove the hashref from the actual
list of tests passed to TAP::Harness->new() and it chokes on it:
mendel@vger:~/tmp/13$ perl -MTest::Steering -E 'include_tests( { jobs =>
9 }, "xt/author/*/t" );'
Not a SCALAR reference at
/usr/local/share/perl/5.10.0/TAP/Parser/IteratorFactory.pm line 262.
mendel@vger:~/tmp/13$
See the attached patch that fixes it (test included, of course).
Test::Steering: 0.02
TAP::Harness: 3.22
Test::More: 0.96
Perl: 5.10.0 (Debian)
Subject: | Test-Steering-harness_options-fix.diff |
diff -Naur a/Test-Steering-0.02/lib/Test/Steering/Wheel.pm b/Test-Steering-0.02/lib/Test/Steering/Wheel.pm
--- a/Test-Steering-0.02/lib/Test/Steering/Wheel.pm 2008-01-08 14:34:20.000000000 +0100
+++ b/Test-Steering-0.02/lib/Test/Steering/Wheel.pm 2010-11-03 22:51:07.000000000 +0100
@@ -234,8 +234,8 @@
map { 'ARRAY' eq ref $_ ? $_ : [ $_, $_ ] }
map { ref $_ ? $_ : glob $_ } @tests
) {
- if ( 'HASH' eq ref $t ) {
- %options = ( %options, %$t );
+ if ( 'HASH' eq ref $t->[0] ) {
+ %options = ( %options, %{ $t->[0] } );
}
else {
push @real_tests,
diff -Naur a/Test-Steering-0.02/t/conformance.t b/Test-Steering-0.02/t/conformance.t
--- a/Test-Steering-0.02/t/conformance.t 2008-01-08 14:34:20.000000000 +0100
+++ b/Test-Steering-0.02/t/conformance.t 2010-11-03 23:06:25.000000000 +0100
@@ -228,6 +228,20 @@
],
stderr => []
},
+ {
+ args => [
+ { test_args => [ 'foo', 'bar' ] },
+ 't/sample-tests/diag_argv'
+ ],
+ stdout => [
+ "TAP version 13",
+ "ok 1",
+ "# foo bar",
+ "ok 2 t/sample-tests/diag_argv done",
+ "1..2"
+ ],
+ stderr => []
+ },
);
plan tests => @schedule * 3;
diff -Naur a/Test-Steering-0.02/t/sample-tests/diag_argv b/Test-Steering-0.02/t/sample-tests/diag_argv
--- a/Test-Steering-0.02/t/sample-tests/diag_argv 1970-01-01 01:00:00.000000000 +0100
+++ b/Test-Steering-0.02/t/sample-tests/diag_argv 2010-11-03 23:00:23.000000000 +0100
@@ -0,0 +1,5 @@
+print <<DUMMY_TEST;
+1..1
+ok 1
+# @ARGV
+DUMMY_TEST