Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 16003
Status: resolved
Priority: 0/
Queue: Test-WWW-Mechanize

People
Owner: Nobody in particular
Requestors: chris+rt [...] chrisdolan.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.06
Fixed in: (no value)



Subject: has_tag_like is broken
Download (untitled) / with headers
text/plain 801b
The has_tag_like method doesn't work as advertised. The embedded anonymous subroutine has its regex reversed. The code is: sub has_tag_like { my $self = shift; my $tag = shift; my $text = shift; my $desc = shift; my $found = $self->_tag_walk( $tag, sub { $text =~ $_[0] } ); return $Test->ok( $found, $desc ); } but should be: sub has_tag_like { my $self = shift; my $tag = shift; my $regex = shift; my $desc = shift; my $found = $self->_tag_walk( $tag, sub { $_[0] =~ $regex } ); return $Test->ok( $found, $desc ); } (note that I renamed the argument for clarity). The has_tag.t tests pass by pure luck: qr/Test 3/ eq 'Test 3' when stringified. A better test that would have caught this bug would be qr/Test \s+ 3/x -- Chris
From: cdolan [...] cpan.org
Download (untitled) / with headers
text/plain 365b
Oops, my analysis of why has_tag.t passed was wrong. The false pass happened because $mech->has_tag_like( a => qr/Test 3/) matches against <a>Test</a> when the regex operands are reversed. The test becomes: 'Test 3' =~ 'Test' which is a success. So the presence of the <a>Test</a> link in goodlinks.html is what caused the test to mistakenly pass. -- Chris
Fixed in 1.08.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.