Hi, OK, I solved it and you gave me the idea :) The problem was that when I gave the file the program thought it as a parameter and didn't know what to do with it, while waiting for user input because of <>. So I thought may be if I will add an open file it will know what to do and it solved the problem.
The only thing I don't get is why then did it work if I use the full program? Why the test doesn't work as the program or vice versa? On Thu, Dec 27, 2012 at 10:47 AM, sawyer x <[email protected]> wrote: > On Thu, Dec 27, 2012 at 12:43 AM, moshe nahmias <[email protected]>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 user. > 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. > > _______________________________________________ > Perl mailing list > [email protected] > http://mail.perl.org.il/mailman/listinfo/perl >
_______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl
