[Templates] A bug and a suggestion
Paul LeoNerd Evans
leonerd-tt at leonerd.org.uk
Fri Jan 18 22:42:51 GMT 2008
On Fri, 18 Jan 2008 11:54:18 -0800
"Sean McAfee" <eefacm at gmail.com> wrote:
> ok( $text =~ /"back is " . '#ffffff'/, 'col.back folded' );
>
> The problem here is that the matching is performed in list context, so if it
> fails, ok receives only a single argument, the string 'col.back folded',
> which is true. So, this test can never fail. The solution is either to add
> a $$ prototype to Template::Test::ok or ensure that tests that involve
> pattern matches are always performed in scalar context. I think prototypes
> aren't generally a good idea, so I'd go for the latter approach.
Isn't this what like() is for?
like( $text, qr/"back is " . '#ffffff'/, 'col.back folded' );
--
Paul "LeoNerd" Evans
leonerd at leonerd.org.uk
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
--
Paul "LeoNerd" Evans
leonerd at leonerd.org.uk
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.template-toolkit.org/pipermail/templates/attachments/20080118/62405bf2/attachment.pgp
More information about the templates
mailing list