I'd probably refactor QuizTaker to add a Games::QuizTaker::IO module which implements the extremely simple methods in and out
sub in { return scalar <STDIN>; } sub out { print @_; }
You can then use Test::MockObject to mock G::QT:IO during your testing of the "test" method and pass data in/out as you want.
If you're not so much into mocking objects you could also fork the test and pass the data into your child from the test, or you could put the "test" call into a separate little script and run that via Test::Expect but IMO that's more convoluted. YMMV.
In reply to Re: Writing a module test
by tirwhan
in thread Writing a module test
by TStanley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |