Test-Deep - Re: Comparing undef and empty string

Posted on Thu Jun 12 00:06:22 2008 by ghendricks in response to 8051 (See the whole thread of 6)
Re: Comparing undef and empty string
Yes, my reason for using Test::Deep in the first place is that I have arrays of blessed objects. Test::Deep seemed perfect for this.

I tried the code snippet above, but did not have success. This might be due to the fact that I wasn't sure where to put it. I tried placing at the top of my test script and when I ran, it said that it was overwriting Test::Deep::decend, but then made no difference. Even when I inserted a bunch of print statements to find out what was happening, it did nothing.

My next trick was to edit the Test::Deep module itself in my /usr/lib/perl5 directory. This did output the print statements, but still had no luck with the undef comparison (behaved exactly as before). I am guessing this is because the one side is a blessed object or an array of blessed objects that I am calling with noclass(). Looking at the docs this appears to do a special comparison. In traversing the remaining modules in Test::Deep, I wasn't able to identify which was being used. I am rather new to Perl testing and only an intermediate Perl user, so I am sure I am missing something here.

If I can figure out what I am doing, I will try to implement it as I mentioned before, that is with some sort of option to allow these comparisons to act the same. I'd appreciate any additional pointers. Thanks for your help.

Greg
Direct Responses: 8059 | Write a response