|
Test::Base is great. I like the separation of data from code. But I'm having trouble with generating filters to transform the data back into tests.
It seems like I've a lot to learn:
sub game { my $game = shift; return 'undef' if $game =~m/^undef$/; $g[$game] };
sub game { my $game = shift; return 'undef' if $game =~m/^undef$/; $g[$game] };
sub play { my $players = shift;
$play->{$p[$players->[0]]->id}->{$p[$players->[1]]->id} };
};
};
and the built-ins:
and the built-ins:
play => [qw/lines chomp array play/],
game => [qw/chomp game/],
game => [qw/chomp game/],
are my filters, and testing against
=== play01
--- play
0
1
--- game
undef
I get an array, rather than the string 'undef'.
I guess the filter is returning in list context. ingy stresses that in the docs.
And I really want to use YAML. I guess this is going to be a long-term thing.
Some more examples in Test::Base::Filter would be nice.
Are there any collections of filters around? |