You use one of the Test methods, and return a value from your sub/method instead of printing to STDOUT or STDERR:
I don't recommend having a method print directly -- let the client do the printing.use Test::More qw(no_plan); my $status = Status->new(); is ($status->status('good'), 'good'); is ($status->status('bad'), 'good'); package Status; sub new { my $package = shift; my $self = {}; bless $self, $package; } sub status { my $self = shift; my $status = shift; if ($status eq 'good') { return "good"; } else { return "bad"; } }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: How do you Test that the right output got printed?
by jeffa
in thread How do you Test that the right output got printed?
by tphyahoo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |