r74721 - in /branches/upstream/libtest-www-mechanize-perl/current: Changes META.yml Makefile.PL Mechanize.pm t/TestServer.pm t/back_ok.t t/content_lacks.t t/get_ok.t t/head_ok.t t/link_content.t t/page_links_content.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Wed May 18 21:23:09 UTC 2011


Author: gregoa
Date: Wed May 18 21:22:51 2011
New Revision: 74721

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=74721
Log:
[svn-upgrade] new version libtest-www-mechanize-perl (1.32)

Modified:
    branches/upstream/libtest-www-mechanize-perl/current/Changes
    branches/upstream/libtest-www-mechanize-perl/current/META.yml
    branches/upstream/libtest-www-mechanize-perl/current/Makefile.PL
    branches/upstream/libtest-www-mechanize-perl/current/Mechanize.pm
    branches/upstream/libtest-www-mechanize-perl/current/t/TestServer.pm
    branches/upstream/libtest-www-mechanize-perl/current/t/back_ok.t
    branches/upstream/libtest-www-mechanize-perl/current/t/content_lacks.t
    branches/upstream/libtest-www-mechanize-perl/current/t/get_ok.t
    branches/upstream/libtest-www-mechanize-perl/current/t/head_ok.t
    branches/upstream/libtest-www-mechanize-perl/current/t/link_content.t
    branches/upstream/libtest-www-mechanize-perl/current/t/page_links_content.t

Modified: branches/upstream/libtest-www-mechanize-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/Changes?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/Changes (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/Changes Wed May 18 21:22:51 2011
@@ -4,6 +4,28 @@
 bug tracking.  They are now being tracked via Google Code at
 http://code.google.com/p/www-mechanize/issues/list
 
+1.32    Wed May 11 10:12:25 CDT 2011
+------------------------------------
+No changes from 1.31_01.
+
+
+1.31_01 Wed May  4 16:07:31 CDT 2011
+------------------------------------
+[ENHANCEMENTS]
+The methods that look at the text of the page, ->text_like() and
+->text_unlike(), now use the WWW::Mechanize method ->text() which caches
+the text.  This will be a big speedup if you call these methods more
+than once.
+
+[FIXED]
+Normalized the use of single vs. double quotes in the default descriptions.
+
+Fixed tests that fail under newer versions of LWP.
+
+Fixed tests that fail if http_proxy or HTTP_PROXY are set.
+
+Fixed tests that fail on Perl 5.14.
+
 
 1.30    Wed Jun  9 12:23:48 CDT 2010
 ------------------------------------
@@ -14,6 +36,10 @@
 Added $mech->text_contains(), $mech->text_like() and $mech->text_unlike()
 methods.  These check the text of an HTML page separate from the
 HTML markup.  Thanks to Ashley Pond V.
+
+[FIXED]
+t/head_ok.t should no longer fail if your ISP "helpfully" returns
+an IP address for non-existent DNS records.  Thanks, Schwern.
 
 
 1.28    Tue Apr 13 00:44:27 CDT 2010

Modified: branches/upstream/libtest-www-mechanize-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/META.yml?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/META.yml (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/META.yml Wed May 18 21:22:51 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Test-WWW-Mechanize
-version:            1.30
+version:            1.32
 abstract:           Testing-specific WWW::Mechanize subclass
 author:
     - Andy Lester <andy at petdance.com>
@@ -15,18 +15,19 @@
     HTML::TreeBuilder:    0
     HTTP::Server::Simple:  0.42
     HTTP::Server::Simple::CGI:  0
+    LWP:                  6.02
     perl:                 5.008
     Test::Builder::Tester:  1.09
-    Test::LongString:     0.12
+    Test::LongString:     0.15
     Test::More:           0
     URI::file:            0
-    WWW::Mechanize:       1.24
+    WWW::Mechanize:       1.68
 resources:
     bugtracker:   http://code.google.com/p/www-mechanize/issues/list
-    homepage:     http://code.google.com/p/www-mechanize/
-    license:      http://dev.perl.org/licenses/
+    homepage:     https://github.com/petdance/test-www-mechanize
+    license:      http://www.opensource.org/licenses/artistic-license-2.0
     MailingList:  http://groups.google.com/group/www-mechanize-users
-    Repository:   http://code.google.com/p/www-mechanize/source
+    Repository:   https://github.com/petdance/test-www-mechanize
 no_index:
     directory:
         - t

Modified: branches/upstream/libtest-www-mechanize-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/Makefile.PL?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/Makefile.PL (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/Makefile.PL Wed May 18 21:22:51 2011
@@ -13,11 +13,12 @@
         'HTML::TreeBuilder'         => 0,
         'HTTP::Server::Simple'      => '0.42',
         'HTTP::Server::Simple::CGI' => 0,
+        'LWP'                       => 6.02,
         'Test::Builder::Tester'     => '1.09',
-        'Test::LongString'          => '0.12',
+        'Test::LongString'          => '0.15',
         'Test::More'                => 0,
         'URI::file'                 => 0,
-        'WWW::Mechanize'            => '1.24',
+        'WWW::Mechanize'            => '1.68',
     },
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'Test-WWW-Mechanize-*' },
@@ -26,10 +27,10 @@
 if ( $ExtUtils::MakeMaker::VERSION ge '6.46' ) {
     $parms->{META_MERGE} = {
         resources => {
-            license     => 'http://dev.perl.org/licenses/',
-            homepage    => 'http://code.google.com/p/www-mechanize/',
+            license     => 'http://www.opensource.org/licenses/artistic-license-2.0',
+            homepage    => 'https://github.com/petdance/test-www-mechanize',
             bugtracker  => 'http://code.google.com/p/www-mechanize/issues/list',
-            Repository  => 'http://code.google.com/p/www-mechanize/source',
+            Repository  => 'https://github.com/petdance/test-www-mechanize',
             MailingList => 'http://groups.google.com/group/www-mechanize-users',
         }
     };

Modified: branches/upstream/libtest-www-mechanize-perl/current/Mechanize.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/Mechanize.pm?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/Mechanize.pm (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/Mechanize.pm Wed May 18 21:22:51 2011
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.30
-
-=cut
-
-our $VERSION = '1.30';
+Version 1.32
+
+=cut
+
+our $VERSION = '1.32';
 
 =head1 SYNOPSIS
 
@@ -28,7 +28,7 @@
     $mech->base_is( 'http://petdance.com/', 'Proper <BASE HREF>' );
     $mech->title_is( 'Invoice Status', "Make sure we're on the invoice page" );
     $mech->text_contains( 'Andy Lester', 'My name somewhere' );
-    $mech->content_like( qr/(cpan|perl)\.org/, "Link to perl.org or CPAN" );
+    $mech->content_like( qr/(cpan|perl)\.org/, 'Link to perl.org or CPAN' );
 
 This is equivalent to:
 
@@ -39,9 +39,9 @@
     $mech->get( $page );
     ok( $mech->success );
     is( $mech->base, 'http://petdance.com', 'Proper <BASE HREF>' );
-    is( $mech->title, "Invoice Status", "Make sure we're on the invoice page" );
+    is( $mech->title, 'Invoice Status', "Make sure we're on the invoice page" );
     ok( index( $mech->content( format => 'text' ), 'Andy Lester' ) >= 0, 'My name somewhere' );
-    like( $mech->content, qr/(cpan|perl)\.org/, "Link to perl.org or CPAN" );
+    like( $mech->content, qr/(cpan|perl)\.org/, 'Link to perl.org or CPAN' );
 
 but has nicer diagnostics if they fail.
 
@@ -50,8 +50,8 @@
     my $mech = Test::WWW::Mechanize->new;
     $mech->get_ok( 'http://petdance.com/' );
     $mech->base_is( 'http://petdance.com/' );
-    $mech->title_is( "Invoice Status" );
-    $mech->content_contains( "Andy Lester" );
+    $mech->title_is( 'Invoice Status' );
+    $mech->content_contains( 'Andy Lester' );
     $mech->content_like( qr/(cpan|perl)\.org/ );
 
 results in
@@ -100,7 +100,7 @@
 
 =back
 
-This means you no longerhave to do the following:
+This means you no longer have to do the following:
 
     my $mech = Test::WWW::Mechanize->new();
     $mech->get_ok( $url, 'Fetch the intro page' );
@@ -273,7 +273,13 @@
 Note that the parms to C<submit_form()> are a hash whereas the parms to
 this function are a hashref.  You have to call this function like:
 
-    $agent->submit_form_ok( {n=>3}, "looking for 3rd link" );
+    $mech->submit_form_ok( {
+            form_number => 3,
+            fields      => {
+                answer => 42
+            },
+        }, 'now we just need the question'
+    );
 
 As with other test functions, C<$desc> is optional.  If it is supplied
 then it will display when running the test harness in verbose mode.
@@ -326,7 +332,7 @@
 Note that the parms to C<follow_link()> are a hash whereas the parms to
 this function are a hashref.  You have to call this function like:
 
-    $mech->follow_link_ok( {n=>3}, "looking for 3rd link" );
+    $mech->follow_link_ok( {n=>3}, 'looking for 3rd link' );
 
 As with other test functions, C<$desc> is optional.  If it is supplied
 then it will display when running the test harness in verbose mode.
@@ -504,7 +510,7 @@
 
 Tells if the title of the page is the given string.
 
-    $mech->title_is( "Invoice Summary" );
+    $mech->title_is( 'Invoice Summary' );
 
 =cut
 
@@ -558,7 +564,7 @@
 
 Tells if the base of the page is the given string.
 
-    $mech->base_is( "http://example.com/" );
+    $mech->base_is( 'http://example.com/' );
 
 =cut
 
@@ -738,7 +744,7 @@
     my $desc  = shift || qq{Text is like "$regex"};
 
     local $Test::Builder::Level = $Test::Builder::Level + 1;
-    return like_string( $self->_text, $regex, $desc );
+    return like_string( $self->text, $regex, $desc );
 }
 
 =head2 $mech->text_unlike( $regex [, $desc ] )
@@ -753,13 +759,7 @@
     my $desc  = shift || qq{Text is unlike "$regex"};
 
     local $Test::Builder::Level = $Test::Builder::Level + 1;
-    return unlike_string( $self->_text, $regex, $desc );
-}
-
-sub _text {
-    my $self = shift;
-
-    return $self->content( format => 'text' );
+    return unlike_string( $self->text, $regex, $desc );
 }
 
 =head2 $mech->has_tag( $tag, $text [, $desc ] )
@@ -1043,7 +1043,7 @@
     }
 
     my @urls = _format_links( $links );
-    $desc = _default_links_desc(\@urls, "are like '$regex'") if !defined($desc);
+    $desc = _default_links_desc( \@urls, qq{are like "$regex"} ) if !defined($desc);
     my @failures = $self->_check_links_content( \@urls, $regex );
     my $ok = (@failures == 0);
 
@@ -1080,7 +1080,7 @@
     }
 
     my @urls = _format_links( $links );
-    $desc = _default_links_desc(\@urls, qq{are not like "$regex"}) if !defined($desc);
+    $desc = _default_links_desc( \@urls, qq{are not like "$regex"} ) if !defined($desc);
     my @failures = $self->_check_links_content( \@urls, $regex, 'unlike' );
     my $ok = (@failures == 0);
 
@@ -1383,7 +1383,7 @@
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2004-2010 Andy Lester.
+Copyright 2004-2011 Andy Lester.
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of either:

Modified: branches/upstream/libtest-www-mechanize-perl/current/t/TestServer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/t/TestServer.pm?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/t/TestServer.pm (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/t/TestServer.pm Wed May 18 21:22:51 2011
@@ -4,7 +4,10 @@
 use strict;
 
 BEGIN {
-    delete $ENV{http_proxy}; # All our tests are running on localhost
+    # All our tests are running on localhost
+    foreach my $proxy (grep { /http_proxy/i } keys %ENV ) {
+        delete $ENV{$proxy};
+    }
 }
 
 use base 'HTTP::Server::Simple::CGI';

Modified: branches/upstream/libtest-www-mechanize-perl/current/t/back_ok.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/t/back_ok.t?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/t/back_ok.t (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/t/back_ok.t Wed May 18 21:22:51 2011
@@ -54,7 +54,7 @@
     test_out( 'not ok 1 - Try to get bad URL' );
     test_fail( +3 );
     test_diag( '500' );
-    test_diag( q{Can't connect to wango.nonexistent.xx-only-testing:80 (Bad hostname 'wango.nonexistent.xx-only-testing')} );
+    test_diag( q{Can't connect to wango.nonexistent.xx-only-testing:80 (Bad hostname)} );
     my $ok = $mech->get_ok( $badurl, 'Try to get bad URL' );
     test_test( 'Fails to get nonexistent URI and reports failure' );
 

Modified: branches/upstream/libtest-www-mechanize-perl/current/t/content_lacks.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/t/content_lacks.t?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/t/content_lacks.t (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/t/content_lacks.t Wed May 18 21:22:51 2011
@@ -35,7 +35,7 @@
 test_fail(+4);
 test_diag(q(    searched: "<html>\x{0a}    <head>\x{0a}        <title>Test Page</title>"...) );
 test_diag(q(   and found: "Test Page") );
-test_diag(q( at position: 33) );
+test_diag(q( at position: 33 (line 3 column 16)) );
 $mech->content_lacks( 'Test Page', q{Shouldn't say it's a test page} );
 test_test( 'Handles not finding it' );
 

Modified: branches/upstream/libtest-www-mechanize-perl/current/t/get_ok.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/t/get_ok.t?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/t/get_ok.t (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/t/get_ok.t Wed May 18 21:22:51 2011
@@ -55,7 +55,7 @@
     test_out( 'not ok 1 - Try to get bad URL' );
     test_fail( +3 );
     test_diag( '500' );
-    test_diag( q{Can't connect to wango.nonexistent.xx-only-testing:80 (Bad hostname 'wango.nonexistent.xx-only-testing')} );
+    test_diag( q{Can't connect to wango.nonexistent.xx-only-testing:80 (Bad hostname)} );
     my $ok = $mech->get_ok( $badurl, 'Try to get bad URL' );
     test_test( 'Fails to get nonexistent URI and reports failure' );
 

Modified: branches/upstream/libtest-www-mechanize-perl/current/t/head_ok.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/t/head_ok.t?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/t/head_ok.t (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/t/head_ok.t Wed May 18 21:22:51 2011
@@ -2,21 +2,12 @@
 
 use strict;
 use warnings;
-use Test::More;
+use Test::More tests => 11;
 use Test::Builder::Tester;
 
-use constant NONEXISTENT => 'http://blahblablah.xx-nonexistent.';
-BEGIN {
-    if ( gethostbyname( NONEXISTENT ) ) {
-        plan skip_all => 'Found an A record for the non-existent domain';
-    }
-}
+my $NONEXISTENT = 'blahblablah.xx-nonexistent.foo';
 
-BEGIN {
-    plan tests => 11;
-    use_ok( 'Test::WWW::Mechanize' );
-}
-
+require_ok( 'Test::WWW::Mechanize' );
 
 use lib 't';
 use TestServer;
@@ -25,7 +16,7 @@
 my $pid         = $server->background;
 my $server_root = $server->root;
 
-my $mech=Test::WWW::Mechanize->new( autocheck => 0 );
+my $mech = Test::WWW::Mechanize->new( autocheck => 0 );
 isa_ok($mech,'Test::WWW::Mechanize');
 
 GOOD_HEAD: { # Stop giggling, you!
@@ -46,15 +37,22 @@
     test_test('HEAD existing URI and reports success - default desc');
 }
 
-BAD_HEAD: {
-    my $badurl = 'http://wango.nonexistent.xx-only-testing/';
+# Bad HEAD test. Relies on getting an error finding a non-existent domain.
+# Some ISPs "helpfully" provide resolution for non-existent domains,
+# and thus this test fails by succeeding.  We check for this annoying
+# behavior and skip this subtest if we get it.
+SKIP: {
+    skip "Found an A record for the non-existent domain $NONEXISTENT", 4
+        if gethostbyname $NONEXISTENT;
+
+    my $badurl = "http://$NONEXISTENT/";
     $mech->head($badurl);
-    ok(!$mech->success, q{sanity check: we can't load NONEXISTENT.html} );
+    ok(!$mech->success, q{sanity check: we can't load $badurl} );
 
     test_out( 'not ok 1 - Try to HEAD bad URL' );
     test_fail( +3 );
     test_diag( '500' );
-    test_diag( q{Can't connect to wango.nonexistent.xx-only-testing:80 (Bad hostname 'wango.nonexistent.xx-only-testing')} );
+    test_diag( qq{Can't connect to $NONEXISTENT:80 (Bad hostname)} );
     my $ok = $mech->head_ok( $badurl, 'Try to HEAD bad URL' );
     test_test( 'Fails to HEAD nonexistent URI and reports failure' );
 

Modified: branches/upstream/libtest-www-mechanize-perl/current/t/link_content.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/t/link_content.t?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/t/link_content.t (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/t/link_content.t Wed May 18 21:22:51 2011
@@ -36,7 +36,8 @@
 test_test('Handles All page links contents successful');
 
 # like - default desc
-test_out('ok 1 - ' . scalar(@urls) . ' links are like \'(?-xism:Test)\'');
+my $re_string = ($] < 5.014) ? '(?-xism:Test)' : '(?^:Test)';
+test_out('ok 1 - ' . scalar(@urls) . qq{ links are like "$re_string"} );
 $mech->link_content_like(\@urls,qr/Test/);
 test_test('Handles All page links contents successful - default desc');
 
@@ -61,7 +62,8 @@
 test_test('Handles All page links unlike contents successful');
 
 # unlike - default desc
-test_out('ok 1 - ' . scalar(@urls) . ' links are not like "(?-xism:BadTest)"');
+$re_string = ($] < 5.014) ? '(?-xism:BadTest)' : '(?^:BadTest)';
+test_out('ok 1 - ' . scalar(@urls) . qq{ links are not like "$re_string"});
 $mech->link_content_unlike(\@urls,qr/BadTest/);
 test_test('Handles All page links unlike contents successful - default desc');
 

Modified: branches/upstream/libtest-www-mechanize-perl/current/t/page_links_content.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-www-mechanize-perl/current/t/page_links_content.t?rev=74721&op=diff
==============================================================================
--- branches/upstream/libtest-www-mechanize-perl/current/t/page_links_content.t (original)
+++ branches/upstream/libtest-www-mechanize-perl/current/t/page_links_content.t Wed May 18 21:22:51 2011
@@ -34,7 +34,8 @@
 test_test('Handles All page links contents successful');
 
 # like - default desc
-test_out(q{ok 1 - All links are like "(?-xism:Test)"});
+my $re_string = ($] < 5.014) ? '(?-xism:Test)' : '(?^:Test)';
+test_out(qq{ok 1 - All links are like "$re_string"});
 $mech->page_links_content_like(qr/Test/);
 test_test('Handles All page links contents successful');
 




More information about the Pkg-perl-cvs-commits mailing list