[Israel.pm] problem with a test
moshegrey at ubuntu.com
Mon Dec 31 11:12:49 PST 2012
I don't understand how it helps to the testing, after all you need to give
data to the input or the parser to process it, isn't it?
Meaning, now to seperate them what I do is just taking the user input, put
it on an array, and sending it to the parser, how is it different from
using the input directly?
On Mon, Dec 31, 2012 at 12:36 PM, sawyer x <xsawyerx at gmail.com> wrote:
> On Sun, Dec 30, 2012 at 11:24 PM, moshe nahmias <moshegrey at ubuntu.com>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.
>> 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
> Perl at perl.org.il
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Perl