Skip to content

Commit 2927bbe

Browse files
tcheukueppooalders
authored andcommitted
What happens when n=>all is passed to $mech->follow_link()?
1 parent e7d1ceb commit 2927bbe

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Revision history for WWW::Mechanize
99
depend on, etc. (GH#352) (James Raspass)
1010
[DOCUMENTATION]
1111
- Various POD fixes (Julien Fiegehenn)
12+
[TESTS]
13+
- Test that follow_link(n=> 'all') warns (Kueppo Tcheukam)
1214

1315
2.15 2022-08-21 07:47:35Z
1416
[FIXED]

t/local/follow.t

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use warnings;
22
use strict;
33
use Test::More;
44
use Test::Exception;
5+
use Test::Warnings qw(warning);
56
use lib 't/local';
67
use LocalServer ();
78

@@ -56,11 +57,15 @@ ok($agent->follow_link( url => '/foo' ), 'can follow url');
5657
isnt( $agent->uri, $server->url, 'Need to be on a separate page' );
5758
ok($agent->back(), 'Can still go back');
5859

60+
$agent->quiet(0);
61+
like warning { $agent->follow_link( n => 'all' ) }, qr/^follow_link\(.*?\) is not valid/, "Can we follow all links?";
62+
ok( $agent->back(), 'Can still go back' );
63+
5964
ok(!$agent->follow_link( url => '/notfoo' ), "can't follow wrong url");
6065
is( $agent->uri, $server->url, 'Needs to be on the same page' );
6166
eval {$agent->follow_link( '/foo' )};
6267
like($@, qr/Needs to get key-value pairs of parameters.*follow\.t/, "Invalid parameter passing gets better error message");
6368

6469
dies_ok { WWW::Mechanize->new->follow_link( url => '/404' ) } "dies when link does not exist with autocheck";
6570

66-
done_testing;
71+
done_testing;

0 commit comments

Comments
 (0)