[Israel.pm] problem with a test

sawyer x xsawyerx at gmail.com
Thu Dec 27 00:47:59 PST 2012

On Thu, Dec 27, 2012 at 12:43 AM, moshe nahmias <moshegrey at ubuntu.com>wrote:

> Hi,
> As you know I write the mail stats program and started to write tests for
> it while I try to make it OO so nothing will break.

Awesome! That's a great reason to write tests!

> But...
> I wrote the input tests and there is a problem there, the last test which
> is supposed to get the data from the user via a file don't work well.
> It waits for a user input (even though only on the test and not while
> running the program, and using the same file for testing and when checking
> through the program).

I think you should separate getting the input from the user, and using that
input to do something.
That way you can test what needs to be done without checking input from the
You could also check the "getting input from user" subroutine separately
and easily.

> I would like to know why it works on the full program but not on the test
> (isn't it supposed to be the same in this case?).

If I recall yesterday, you described the reason above. In the first test
you had you were not entering the input reading (my $input = <>), and on
the second test you were entering it, so it was hanging, waiting for input.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20121227/c11e9235/attachment.htm 

More information about the Perl mailing list