Hello community,
here is the log from the commit of package perl-Test-WWW-Mechanize for
openSUSE:Factory checked in at 2018-12-12 17:27:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Test-WWW-Mechanize (Old)
and /work/SRC/openSUSE:Factory/.perl-Test-WWW-Mechanize.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-WWW-Mechanize"
Wed Dec 12 17:27:46 2018 rev:10 rq:655833 version:1.52
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Test-WWW-Mechanize/perl-Test-WWW-Mechanize.changes
2018-04-25 10:01:11.611190724 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Test-WWW-Mechanize.new.28833/perl-Test-WWW-Mechanize.changes
2018-12-12 17:27:49.930926522 +0100
@@ -1,0 +2,25 @@
+Thu Dec 6 16:26:44 UTC 2018 - Stephan Kulow <[email protected]>
+
+- updated to 1.52
+ see /usr/share/doc/packages/perl-Test-WWW-Mechanize/Changes
+
+ 1.52 Wed Dec 5 10:00:56 CST 2018
+ ------------------------------------
+ [ENHANCEMENTS]
+ click_ok() method can now take a button with X/Y coordinates.
+ Thanks to GitHub user @marderh. (GH #45)
+
+ Added the ability to modify the HTML that the html_tidy_ok() validates.
+ See the content_for_validation() method. (GH #61)
+
+ Add a set of methods for existence of IDs: id_exists(), id_exists_ok(),
+ ids_exist_ok(), lacks_id_ok() and lacks_ids_ok(). (GH #48)
+
+ Add button_exists(), button_exists_ok() and lacks_button_ok()
+ methods. (GH #50)
+
+ [FIXES]
+ Clarified warnings to make it clear that certain modules are
+ optional. Thanks, Matthew Chae.
+
+-------------------------------------------------------------------
Old:
----
Test-WWW-Mechanize-1.50.tar.gz
New:
----
Test-WWW-Mechanize-1.52.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Test-WWW-Mechanize.spec ++++++
--- /var/tmp/diff_new_pack.NUo8R5/_old 2018-12-12 17:27:50.506925791 +0100
+++ /var/tmp/diff_new_pack.NUo8R5/_new 2018-12-12 17:27:50.506925791 +0100
@@ -12,18 +12,18 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: perl-Test-WWW-Mechanize
-Version: 1.50
+Version: 1.52
Release: 0
%define cpan_name Test-WWW-Mechanize
Summary: Testing-specific WWW::Mechanize subclass
License: Artistic-2.0
Group: Development/Libraries/Perl
-Url: http://search.cpan.org/dist/Test-WWW-Mechanize/
+Url: https://metacpan.org/release/%{cpan_name}
Source0:
https://cpan.metacpan.org/authors/id/P/PE/PETDANCE/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
@@ -63,11 +63,11 @@
%setup -q -n %{cpan_name}-%{version}
%build
-%{__perl} Makefile.PL INSTALLDIRS=vendor
-%{__make} %{?_smp_mflags}
+perl Makefile.PL INSTALLDIRS=vendor
+make %{?_smp_mflags}
%check
-%{__make} test
+make test
%install
%perl_make_install
++++++ Test-WWW-Mechanize-1.50.tar.gz -> Test-WWW-Mechanize-1.52.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/Changes
new/Test-WWW-Mechanize-1.52/Changes
--- old/Test-WWW-Mechanize-1.50/Changes 2018-04-16 22:18:22.000000000 +0200
+++ new/Test-WWW-Mechanize-1.52/Changes 2018-12-05 17:02:19.000000000 +0100
@@ -4,6 +4,25 @@
bug tracking. They are now being tracked via GitHub at
https://github.com/petdance/test-www-mechanize/issues
+1.52 Wed Dec 5 10:00:56 CST 2018
+------------------------------------
+[ENHANCEMENTS]
+click_ok() method can now take a button with X/Y coordinates.
+Thanks to GitHub user @marderh. (GH #45)
+
+Added the ability to modify the HTML that the html_tidy_ok() validates.
+See the content_for_validation() method. (GH #61)
+
+Add a set of methods for existence of IDs: id_exists(), id_exists_ok(),
+ids_exist_ok(), lacks_id_ok() and lacks_ids_ok(). (GH #48)
+
+Add button_exists(), button_exists_ok() and lacks_button_ok()
+methods. (GH #50)
+
+[FIXES]
+Clarified warnings to make it clear that certain modules are
+optional. Thanks, Matthew Chae.
+
1.50 Mon Apr 16 15:16:59 CDT 2018
------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/MANIFEST
new/Test-WWW-Mechanize-1.52/MANIFEST
--- old/Test-WWW-Mechanize-1.50/MANIFEST 2018-04-16 22:19:39.000000000
+0200
+++ new/Test-WWW-Mechanize-1.52/MANIFEST 2018-12-05 17:02:26.000000000
+0100
@@ -9,6 +9,7 @@
t/autotidy.t
t/bad.html
t/badlinks.html
+t/button_exists.t
t/click_ok.t
t/content_contains.t
t/content_lacks.t
@@ -28,6 +29,8 @@
t/html_lint_ok.t
t/html_tidy_ok.t
t/html/scratch.html
+t/id_exists.t
+t/id_exists.html
t/lacks_uncapped_inputs-bad.html
t/lacks_uncapped_inputs-good.html
t/lacks_uncapped_inputs.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/META.json
new/Test-WWW-Mechanize-1.52/META.json
--- old/Test-WWW-Mechanize-1.50/META.json 2018-04-16 22:19:39.000000000
+0200
+++ new/Test-WWW-Mechanize-1.52/META.json 2018-12-05 17:02:26.000000000
+0100
@@ -4,13 +4,13 @@
"Andy Lester <[email protected]>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.16, CPAN::Meta::Converter
version 2.150005",
+ "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter
version 2.150010",
"license" : [
"artistic_2"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Test-WWW-Mechanize",
"no_index" : {
@@ -62,6 +62,6 @@
"url" : "https://github.com/petdance/test-www-mechanize"
}
},
- "version" : "1.50",
- "x_serialization_backend" : "JSON::PP version 2.27400"
+ "version" : "1.52",
+ "x_serialization_backend" : "JSON::PP version 2.97001"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/META.yml
new/Test-WWW-Mechanize-1.52/META.yml
--- old/Test-WWW-Mechanize-1.50/META.yml 2018-04-16 22:19:39.000000000
+0200
+++ new/Test-WWW-Mechanize-1.52/META.yml 2018-12-05 17:02:25.000000000
+0100
@@ -7,7 +7,7 @@
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.16, CPAN::Meta::Converter version
2.150005'
+generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version
2.150010'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -37,5 +37,5 @@
homepage: https://github.com/petdance/test-www-mechanize
license: http://www.opensource.org/licenses/artistic-license-2.0
repository: https://github.com/petdance/test-www-mechanize
-version: '1.50'
-x_serialization_backend: 'CPAN::Meta::YAML version 0.012'
+version: '1.52'
+x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/Mechanize.pm
new/Test-WWW-Mechanize-1.52/Mechanize.pm
--- old/Test-WWW-Mechanize-1.50/Mechanize.pm 2018-04-16 22:18:22.000000000
+0200
+++ new/Test-WWW-Mechanize-1.52/Mechanize.pm 2018-12-05 17:02:19.000000000
+0100
@@ -9,11 +9,11 @@
=head1 VERSION
-Version 1.50
+Version 1.52
=cut
-our $VERSION = '1.50';
+our $VERSION = '1.52';
=head1 SYNOPSIS
@@ -144,6 +144,20 @@
return $self;
}
+
+# Override WWW::Mechanize->_reset_page() to handle
Test::WWW::Mechanize-specific data.
+sub _reset_page {
+ my $self = shift;
+
+ # Parent object stuff
+ $self->SUPER::_reset_page( @_ );
+
+ $self->{ids} = undef;
+
+ return;
+}
+
+
=head1 METHODS: HTTP VERBS
=head2 $mech->get_ok($url, [ \%LWP_options ,] $desc)
@@ -442,8 +456,17 @@
=head2 $mech->click_ok( $button[, $desc] )
-Clicks the button named by C<$button>. An optional C<$desc> can
-be given for the test.
+=head2 $mech->click_ok( \@button-and-coordinates [, $desc ] )
+
+Clicks the button named by C<$button>. An optional C<$desc> can be
+given for the test.
+
+ $mech->click_ok( 'continue', 'Clicking the "Continue" button' );
+
+Alternatively the first argument can be an arrayref with three elements:
+The name of the button and the X and Y coordinates of the button.
+
+ $mech->click_ok( [ 'continue', 12, 47 ], 'Clicking the "Continue" button'
);
=cut
@@ -452,12 +475,18 @@
my $button = shift;
my $desc = shift;
- my $response = $self->click( $button );
+ my $response;
+ if ( ref($button) eq 'ARRAY' ) {
+ $response = $self->click( $button->[0], $button->[1], $button->[2] );
+ }
+ else {
+ $response = $self->click( $button );
+ }
+
if ( !$response ) {
return $TB->ok( 0, $desc );
}
-
my $ok = $response->is_success;
$ok = $self->_post_load_validation( $ok, $desc );
@@ -708,7 +737,7 @@
$tidy = HTML::Tidy5->new();
}
- $tidy->parse( '', $self->content );
+ $tidy->parse( '', $self->content_for_tidy );
my @messages = $tidy->messages;
my $nmessages = @messages;
@@ -728,6 +757,24 @@
}
+=head2 $mech->content_for_tidy()
+
+This method is called by C<html_tidy_ok()> to get the content that should
+be validated by HTML::Tidy5. By default, this is just C<content()>,
+but subclasses can override it to modify the content before validation.
+
+This method should not change any state in the Mech object. Specifically,
+it should not actually modify any of the actual content.
+
+=cut
+
+sub content_for_tidy {
+ my $self = shift;
+
+ return $self->content;
+}
+
+
=head2 $mech->title_is( $str [, $desc ] )
Tells if the title of the page is the given string.
@@ -1581,6 +1628,203 @@
}
+=head2 id_exists( $id )
+
+Returns TRUE/FALSE if the given ID exists in the given HTML, or if none
+is provided, then the current page.
+
+The Mech object caches the IDs so that it doesn't bother reparsing every
+time it's asked about an ID.
+
+=cut
+
+sub id_exists {
+ my $self = shift;
+ my $id = shift;
+
+ assert_is( $self->ct, 'text/html', 'Can only call id_exists on HTML pages'
);
+
+ if ( !$self->{ids} ) {
+ my $ids = $self->{ids} = {};
+ my $p = HTML::Parser->new(
+ handlers => {
+ start => [
+ sub {
+ my $attr = shift;
+
+ if ( my $id = $attr->{id} ) {
+ $ids->{$id} = 1;
+ }
+ },
+ 'attr'
+ ],
+ },
+ );
+ $p->parse( $self->content );
+ $p->eof;
+ }
+
+ return $self->{ids}->{$id};
+}
+
+
+=head2 $agent->id_exists_ok( $id [, $msg] )
+
+Verifies there is an HTML element with ID C<$id> in the page.
+
+=cut
+
+sub id_exists_ok {
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ my $self = shift;
+ my $id = shift;
+ my $msg = shift || ('ID "' . ($id || '') . '" should exist');
+
+ my $exists = $self->id_exists( $id );
+
+ return $TB->ok( $exists, $msg );
+}
+
+
+=head2 $agent->ids_exist_ok( \@ids [, $msg] )
+
+Verifies an HTML element exists with each ID in C<\@ids>.
+
+=cut
+
+sub ids_exist_ok {
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ my $self = shift;
+ my $ids = shift;
+ my $msg = shift;
+
+ assert_arrayref( $ids );
+
+ my $subtest_name = 'ids_exist_ok( [' . join( ', ', @{$ids} ) . ']';
+ $subtest_name .= ", $msg" if defined $msg;
+ $subtest_name .= ' )';
+
+ return $TB->subtest(
+ $subtest_name,
+ sub {
+ $TB->plan( tests => scalar @{$ids} );
+
+ foreach my $id ( @$ids ) {
+ $self->id_exists_ok( $id );
+ }
+ }
+ );
+}
+
+=head2 $agent->lacks_id_ok( $id [, $msg] )
+
+Verifies there is NOT an HTML element with ID C<$id> in the page.
+
+=cut
+
+sub lacks_id_ok {
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ my $self = shift;
+ my $id = shift;
+ my $msg = shift || ('ID "' . ($id || '') . '" should not exist');
+
+ assert_nonblank( $id );
+
+ my $exists = $self->id_exists( $id );
+
+ return $TB->ok( !$exists, $msg );
+}
+
+
+=head2 $agent->lacks_ids_ok( \@ids [, $msg] )
+
+Verifies there are no HTML elements with any of the ids given in C<\@ids>.
+
+=cut
+
+sub lacks_ids_ok {
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ my $self = shift;
+ my $ids = shift;
+ my $msg = shift;
+
+ assert_arrayref( $ids );
+
+ my $subtest_name = 'lacks_id_ok( [' . join( ', ', @{$ids} ) . ']';
+ $subtest_name .= ", $msg" if defined $msg;
+ $subtest_name .= ' )';
+
+ return $TB->subtest(
+ $subtest_name,
+ sub {
+ $TB->plan( tests => scalar @{$ids} );
+
+ foreach my $id ( @$ids ) {
+ $self->lacks_id_ok( $id, "ID '" . ($id // '') . "' should not
exist" );
+ }
+ }
+ );
+}
+
+
+=head2 $mech->button_exists( $button )
+
+Returns a boolean saying whether the submit C<$button> exists. Does not
+do a test. For that you want C<button_exists_ok> or C<lacks_button_ok>.
+
+=cut
+
+sub button_exists {
+ my $self = shift;
+ my $button = shift;
+
+ my $input = $self->grep_inputs( {
+ type => qr/^submit$/,
+ name => qr/^$button$/
+ } );
+
+ return !!$input;
+}
+
+
+=head2 $mech->button_exists_ok( $button [, $msg] )
+
+Asserts that the button exists on the page.
+
+=cut
+
+sub button_exists_ok {
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ my $self = shift;
+ my $button = shift;
+ my $msg = shift;
+
+ return $TB->ok( $self->button_exists( $button ), $msg );
+}
+
+
+=head2 $mech->lacks_button_ok( $button [, $msg] )
+
+Asserts that the button exists on the page.
+
+=cut
+
+sub lacks_button_ok {
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ my $self = shift;
+ my $button = shift;
+ my $msg = shift;
+
+ return $TB->ok( !$self->button_exists( $button ), $msg );
+}
+
+
=head1 METHODS: MISCELLANEOUS
=head2 $mech->autolint( [$status] )
@@ -1980,10 +2224,11 @@
=head1 ACKNOWLEDGEMENTS
Thanks to
+@marderh,
Eric A. Zarko,
-moznion,
+@moznion,
Robert Stone,
-tynovsky,
+@tynovsky,
Jerry Gay,
Jonathan "Duke" Leto,
Philip G. Potter,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/t/00-load.t
new/Test-WWW-Mechanize-1.52/t/00-load.t
--- old/Test-WWW-Mechanize-1.50/t/00-load.t 2018-04-16 22:18:22.000000000
+0200
+++ new/Test-WWW-Mechanize-1.52/t/00-load.t 2018-12-04 19:32:26.000000000
+0100
@@ -18,10 +18,10 @@
if ( $rc ) {
no strict 'refs';
my $version = ${"${module}::VERSION"};
- diag( "Found $module $version" );
+ diag( "Found optional $module $version" );
}
else {
- diag( "No $module found." );
+ diag( "Optional $module not found. Install it to use additional
features." );
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/t/autotidy.t
new/Test-WWW-Mechanize-1.52/t/autotidy.t
--- old/Test-WWW-Mechanize-1.50/t/autotidy.t 2018-03-26 18:22:58.000000000
+0200
+++ new/Test-WWW-Mechanize-1.52/t/autotidy.t 2018-12-04 19:32:26.000000000
+0100
@@ -13,7 +13,7 @@
# Load HTML::Lint here for the imports
if ( not eval "use $module; 1;" ) {
- plan skip_all => "$module is not installed, cannot test autotidy.";
+ plan skip_all => "Optional $module is not installed, cannot test
autotidy.";
}
plan tests => 5;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/t/button_exists.t
new/Test-WWW-Mechanize-1.52/t/button_exists.t
--- old/Test-WWW-Mechanize-1.50/t/button_exists.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Test-WWW-Mechanize-1.52/t/button_exists.t 2018-12-04
19:32:26.000000000 +0100
@@ -0,0 +1,25 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+
+use Test::WWW::Mechanize ();
+use URI::file ();
+
+my $mech = Test::WWW::Mechanize->new();
+isa_ok( $mech,'Test::WWW::Mechanize' );
+
+my $uri = URI::file->new_abs( 't/html/form.html' )->as_string;
+$mech->get_ok( $uri );
+
+ok( $mech->button_exists( 'big_button' ), 'Found a button that is there' );
+ok( !$mech->button_exists( 'little_button' ), 'Not found button that is not
there' );
+
+$mech->button_exists_ok( 'big_button', 'Found a button that is there' );
+$mech->lacks_button_ok( 'little_button', 'Not found button that is not there'
);
+
+done_testing();
+
+exit 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/t/click_ok.t
new/Test-WWW-Mechanize-1.52/t/click_ok.t
--- old/Test-WWW-Mechanize-1.50/t/click_ok.t 2018-03-14 17:46:19.000000000
+0100
+++ new/Test-WWW-Mechanize-1.52/t/click_ok.t 2018-12-04 19:32:26.000000000
+0100
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 6;
use Test::Builder::Tester;
use Test::WWW::Mechanize ();
@@ -20,6 +20,16 @@
$mech->get_ok( "$server_root/form.html" );
$mech->click_ok( 'big_button', 'Submit First Form' );
+ # XXX We need to check that the request is correct.
+}
+
+SUBMIT_GOOD_FORM_WITH_COORDINATES: {
+ my $mech = Test::WWW::Mechanize->new();
+ isa_ok( $mech,'Test::WWW::Mechanize' );
+
+ $mech->get_ok( "$server_root/form.html" );
+ $mech->click_ok( ['big_button',360,80], 'Submit First Form with
coordinates' );
+ # XXX We need to check that the request is correct.
}
$server->stop;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/t/html_tidy_ok.t
new/Test-WWW-Mechanize-1.52/t/html_tidy_ok.t
--- old/Test-WWW-Mechanize-1.50/t/html_tidy_ok.t 2018-04-16
22:18:22.000000000 +0200
+++ new/Test-WWW-Mechanize-1.52/t/html_tidy_ok.t 2018-12-04
19:32:26.000000000 +0100
@@ -11,9 +11,9 @@
BEGIN {
my $module = 'HTML::Tidy5 1.00';
if ( not eval "use $module; 1;" ) {
- plan skip_all => "$module is not installed, cannot test html_tidy_ok"
if $@;
+ plan skip_all => "Optional $module is not installed, cannot test
html_tidy_ok" if $@;
}
- plan tests => 3;
+ plan tests => 7;
}
GOOD_GET: {
@@ -34,5 +34,42 @@
test_test( 'Proper html_tidy_ok results' );
}
+CONTENT_FOR_VALIDATION: {
+ my $mech = My::Subclass->new;
+ isa_ok( $mech, 'My::Subclass' );
+ isa_ok( $mech, 'Test::WWW::Mechanize' );
+
+ my $uri = URI::file->new_abs( 't/bad.html' )->as_string;
+ $mech->get_ok( $uri, 'Fetching the file from disk' );
+
+ test_out( "not ok 1 - checking HTML ($uri)" );
+ test_fail( +4 );
+ test_err( "# HTML::Tidy5 messages for $uri" );
+ test_err( '# (9:9) Warning: missing </a>' );
+ test_err( '# 1 message on the page' );
+ $mech->html_tidy_ok( 'checking HTML' );
+ test_test( 'Proper html_tidy_ok results after modifying the contents
before tidying' );
+}
+
done_testing();
exit 0;
+
+package My::Subclass;
+
+use parent 'Test::WWW::Mechanize';
+
+sub content_for_tidy {
+ my $self = shift;
+
+ my $content = $self->content;
+
+ # Fix the missing DOCTYPE.
+ $content = "<!DOCTYPE html>\n$content";
+
+ # Change the </b> to something innocuous.
+ $content =~ s{</b>}{<br/>};
+
+ # We're still leaving the unclosed </a>.
+
+ return $content;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/t/id_exists.html
new/Test-WWW-Mechanize-1.52/t/id_exists.html
--- old/Test-WWW-Mechanize-1.50/t/id_exists.html 1970-01-01
01:00:00.000000000 +0100
+++ new/Test-WWW-Mechanize-1.52/t/id_exists.html 2018-12-04
19:32:26.000000000 +0100
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title> </title>
+ </head>
+ <body>
+ <div id="user-block">
+
+ <p id="name">
+ </p>
+
+ <p id="address">
+ </p>
+
+ </div>
+ </body>
+</html>
+<!--
+vi: expandtab sw=4 ts=4 ft=html:
+-->
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-WWW-Mechanize-1.50/t/id_exists.t
new/Test-WWW-Mechanize-1.52/t/id_exists.t
--- old/Test-WWW-Mechanize-1.50/t/id_exists.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Test-WWW-Mechanize-1.52/t/id_exists.t 2018-12-05 17:02:19.000000000
+0100
@@ -0,0 +1,56 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 23;
+use Test::Builder::Tester;
+
+use Test::WWW::Mechanize ();
+
+use URI::file ();
+
+my @valid_ids = ( 'user-block', 'name', 'address' );
+my @invalid_ids = ( 'bingo', 'bongo' );
+
+my $mech = Test::WWW::Mechanize->new();
+isa_ok( $mech,'Test::WWW::Mechanize' );
+
+my $uri = URI::file->new_abs( 't/id_exists.html' )->as_string;
+$mech->get_ok( $uri );
+
+for my $id ( @valid_ids ) {
+ ok( $mech->id_exists( $id ), "$id found" );
+ $mech->id_exists_ok( $id );
+ $mech->ids_exist_ok( [$id] );
+}
+for my $id ( @invalid_ids ) {
+ ok( !$mech->id_exists( $id ), "$id not found" );
+ $mech->lacks_id_ok( $id );
+ $mech->lacks_ids_ok( [$id] );
+}
+
+$mech->ids_exist_ok( [@valid_ids], 'Valid IDs found' );
+$mech->lacks_ids_ok( [@invalid_ids], 'Valid IDs found' );
+
+
+# Now test output specifics.
+# id_exists_ok
+test_out( 'not ok 1 - ID "bongo" should exist' );
+test_fail( +1 );
+$mech->id_exists_ok( 'bongo' );
+test_test( 'Proper id_exists_ok results for nonexistent ID' );
+
+# lacks_id_ok
+test_out( 'not ok 1 - ID "name" should not exist' );
+test_fail( +1 );
+$mech->lacks_id_ok( 'name' );
+test_test( 'Proper lacks_id_ok results for ID that is there' );
+
+
+# Now go get a new page and do tests again.
+$mech->update_html( '<html><body><p id="boring">Very boring
page</p></body></html' );
+$mech->id_exists_ok( 'boring' );
+$mech->lacks_ids_ok( [@valid_ids, @invalid_ids] );
+
+exit 0