[Rt-devel] Possible RT testing bug

Robert rspier at pobox.com
Thu Mar 10 09:32:35 EST 2005


>>>>>ok( $t->Create(Queue => 'General', Subject => $string), "Ticket Created");

> I don't get it. Are you saying that there is no bug in the code above?
> There is a bug, because the test will always pass, even if Queue is
> mis-spelled.

$ perl -MTest::More=no_plan -e'sub foo { (0,0,"Text") ; } ok( foo(), 
"Bar" )'
ok 1 - Bar
1..1

I'm pretty sure Todd has a point here.

$ perl -le '$x= (10,20,30); print $x'
30

(A list value in scalar context evaluates to the last element.)

Here's the snippet from perldata:

       If you evaluate an array in scalar context, it returns the length 
of the array.  (Note that this is not true of lists, which return the 
lastvalue, like the C comma operator, nor of built-in functions, which 
      return whatever they feel like returning.)


There are several examples of ok( $x->Create( ... ) ) in Ticket_Overlay.pm


-R



More information about the Rt-devel mailing list