On Sun, Dec 30, 2012 at 11:24 PM, moshe nahmias <[email protected]>wrote:
> As far as I know the tests are supposed to work as any other > script/programs so if the program works the test is supposed to work too. > Yes, and no. A test provides a compartmentalized environment for running the application code. That's the "yes" part. However, this environment might be a bit different. Environment variables, harness, etc. That's the "no" part. It drifts more into the "yes" part though, so that's the good news. :) > > it doesn't work with the code like shown above if I write in the terminal > ./input.t BUT if I write ./input.t something (any character at all) it pass > the test. > > > Why? What makes the difference? As far as I understand it there is no > difference in the code on the program and on the test (if you want me to > copy all the code till that point I can do it) > The problem is that you're using the diamond operator (<>), which is... "magical" and DWIMmish. http://www.stat.berkeley.edu/~spector/extension/perl/notes/node46.html > > One more thing, I want to check for the possibility that the user will > enter just one or two parameters in the input, but the object doesn't > forget the parameters I got in, does that mean I have to make more objects > ( or rewrite the data) or there is a better way? > You should separate the fetching of information from STDIN/ARGV and parsing them. That would make it much easier to test.
_______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl
