Skip to content

Commit e7d1ceb

Browse files
haargoalders
authored andcommitted
drop Test::Warn prereq and only use Test::Warnings
1 parent fb4fea9 commit e7d1ceb

File tree

8 files changed

+35
-36
lines changed

8 files changed

+35
-36
lines changed

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Revision history for WWW::Mechanize
22

3+
[TESTS]
4+
- Drop Test::Warn prerequisite and only use Test::Warnings
5+
36
{{$NEXT}}
47
[FIXED]
58
- Raise minimum Perl to 5.8 to match what we test, what dependencies

META.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
"Test::NoWarnings" : "1.04",
108108
"Test::Output" : "0",
109109
"Test::Taint" : "1.08",
110-
"Test::Warn" : "0",
111110
"Test::Warnings" : "0",
112111
"URI" : "0",
113112
"URI::Escape" : "0",

Makefile.PL

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ my %WriteMakefileArgs = (
5757
"Test::NoWarnings" => "1.04",
5858
"Test::Output" => 0,
5959
"Test::Taint" => "1.08",
60-
"Test::Warn" => 0,
6160
"Test::Warnings" => 0,
6261
"URI" => 0,
6362
"URI::Escape" => 0,
@@ -101,7 +100,6 @@ my %FallbackPrereqs = (
101100
"Test::NoWarnings" => "1.04",
102101
"Test::Output" => 0,
103102
"Test::Taint" => "1.08",
104-
"Test::Warn" => 0,
105103
"Test::Warnings" => 0,
106104
"Tie::RefHash" => 0,
107105
"URI" => 0,

cpanfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ on 'test' => sub {
4040
requires "Test::NoWarnings" => "1.04";
4141
requires "Test::Output" => "0";
4242
requires "Test::Taint" => "1.08";
43-
requires "Test::Warn" => "0";
4443
requires "Test::Warnings" => "0";
4544
requires "URI" => "0";
4645
requires "URI::Escape" => "0";

t/find_link-warnings.t

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use warnings;
22
use strict;
33

44
use Test::More;
5-
use Test::Warn qw( warning_like );
5+
use Test::Warnings qw( :all );
66
use URI::file ();
77
use WWW::Mechanize ();
88

@@ -16,38 +16,38 @@ ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
1616

1717
REGEX_USAGE: {
1818
for my $tname (qw( TEXT NAME URL TAG )) {
19-
warning_like(
20-
sub { $mech->find_link( $tname => 'expect error' ) },
21-
qr/Unknown link-finding parameter/, "detected usage error: $tname => 'string'"
22-
);
19+
like warning {
20+
$mech->find_link( $tname => 'expect error' );
21+
}, qr/Unknown link-finding parameter/,
22+
"detected usage error: $tname => 'string'";
2323
}
2424
}
2525

2626
REGEX_STRING: {
2727
for my $tn (qw( text name url tag )) {
2828
my $tname = $tn.'_regex';
29-
warning_like(
30-
sub { $mech->find_link( $tname => 'expect error' ) },
31-
qr/passed as $tname is not a regex/, "detected usage error: $tname => 'string'"
32-
);
29+
like warning {
30+
$mech->find_link( $tname => 'expect error' );
31+
}, qr/passed as $tname is not a regex/,
32+
"detected usage error: $tname => 'string'";
3333
}
3434
}
3535

3636
NON_REGEX_STRING: {
3737
for my $tname (qw( text name url tag )) {
38-
warning_like(
39-
sub { $mech->find_link( $tname => qr/foo/ ) },
40-
qr/passed as '$tname' is a regex/, "detected usage error: $tname => Regex"
41-
);
38+
like warning {
39+
$mech->find_link( $tname => qr/foo/ );
40+
}, qr/passed as '$tname' is a regex/,
41+
"detected usage error: $tname => Regex";
4242
}
4343
}
4444

4545
SPACE_PADDED: {
4646
for my $tname (qw( text name url tag )) {
47-
warning_like(
48-
sub { $mech->find_link( $tname => ' a padded astring ' ) },
49-
qr/is space-padded and cannot succeed/, "detected usage error: $tname => padded-string"
50-
);
47+
like warning {
48+
$mech->find_link( $tname => ' a padded astring ' );
49+
}, qr/is space-padded and cannot succeed/,
50+
"detected usage error: $tname => padded-string";
5151
}
5252
}
5353

t/regex-error.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ use warnings;
44
use strict;
55

66
use Test::More;
7-
use Test::Warn qw( warning_like );
7+
use Test::Warnings qw(:all);
88
use WWW::Mechanize ();
99

1010
my $m = WWW::Mechanize->new;
1111
isa_ok( $m, 'WWW::Mechanize' );
1212

13-
warning_like {
13+
like warning {
1414
$m->find_link( link_regex => 'foo' );
15-
} qr[Unknown link-finding parameter "link_regex".+line \d+], 'Passes message, and includes the line number';
15+
}, qr[Unknown link-finding parameter "link_regex".+line \d+], 'Passes message, and includes the line number';
1616

17-
warning_like {
17+
like warning {
1818
$m->find_link( url_regex => 'foo' );
19-
} qr[foo passed as url_regex is not a regex.+line \d+], 'Passes message, and includes the line number';
19+
}, qr[foo passed as url_regex is not a regex.+line \d+], 'Passes message, and includes the line number';
2020

2121
done_testing();

t/warn.t

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
use warnings;
44
use strict;
55

6-
use Test::Warn qw( warning_like );
6+
use Test::Warnings qw( :all );
77
use Test::More;
88
use WWW::Mechanize ();
99

1010
my $m = WWW::Mechanize->new;
1111
isa_ok( $m, 'WWW::Mechanize' );
1212

13-
warning_like {
13+
like warning {
1414
$m->warn( 'Something bad' );
15-
} qr[Something bad.+line \d+], 'Passes the message, and includes the line number';
15+
}, qr[Something bad.+line \d+], 'Passes the message, and includes the line number';
1616

17-
warning_like {
17+
is join('', warnings {
1818
$m->quiet(1);
1919
$m->warn( 'Something bad' );
20-
} undef, 'Quiets correctly';
20+
}), '', 'Quiets correctly';
2121

2222
my $hushed = WWW::Mechanize->new( quiet => 1 );
2323
isa_ok( $hushed, 'WWW::Mechanize' );
24-
warning_like {
24+
is join('', warnings {
2525
$hushed->warn( 'Something bad' );
26-
} undef, 'Quiets correctly';
26+
}), '', 'Quiets correctly';
2727

2828
done_testing();

t/warnings.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ use warnings;
44
use strict;
55

66
use Test::More;
7-
use Test::Warn qw( warning_is );
7+
use Test::Warnings qw( :all );
88
use WWW::Mechanize ();
99

1010
UNKNOWN_ALIAS: {
1111
my $m = WWW::Mechanize->new;
1212
isa_ok( $m, 'WWW::Mechanize' );
1313

14-
warning_is {
14+
like warning {
1515
$m->agent_alias( 'Blongo' );
16-
} 'Unknown agent alias "Blongo"', 'Unknown aliases squawk appropriately';
16+
}, qr/\AUnknown agent alias "Blongo"/, 'Unknown aliases squawk appropriately';
1717
}
1818

1919
done_testing();

0 commit comments

Comments
 (0)