I am seeing some unexpected behavior in my Test::Base::Filters. Here is an expample for duplication:
In MyTest.pm:
package t::MyTest;
use Test::Base -Base;
#some stuff here
package t::MyTest::Filter;
use base 'Test::Base::Filter';
sub choose {
print @_;
return {foo => 'bar'} if($_[0] eq '1');
return undef;
}
sub is_defined{
print @_;
defined $_[0];
}
And in test.t:
use t::MyTest;
filters {input => [qw(choose is_defined)] };
__END__
=== First
--- input
1
--- expected: 1
=== Second
--- input
0
--- expected: 0
What I expect is for the two filters to chain, the output of parse becoming the input to is_defined.
Place both of the files in in a "t" folder and run "prove -v", and this is the output:
t\01-test.t .. Use of uninitialized value $_[1] in print at t/MyTest.p
+m line 14,
<DATA> line 1.
1
t::MyTest::Filter=HASH(0x2af1670)ok 1 - First
1..1
Failed 1/1 subtests
Test Summary Report
-------------------
t\01-test.t (Wstat: 0 Tests: 0 Failed: 0)
Parse errors: Bad plan. You planned 1 tests but ran 0.
Files=1, Tests=0, 1 wallclock secs ( 0.06 usr + 0.23 sys = 0.30 CPU
+)
Result: FAIL
Nevermind the warning, which I don't understand the root of. Why is the input to the first filter the actual input, and the input to the second filter some filter object? I'm also uncertain why only one test was run, instead of the two I expected.