Skip to content

Commit

Permalink
Make use of Test::Needs
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Mar 19, 2024
1 parent 2231276 commit 34e5cd2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 32 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Revision history for Geo-Coder-List
0.33
Fix test count in t/googleplaces.t
Don't test t/ua.t when network testing disabled
Use Test::Needs

0.32 Sat Oct 7 10:07:45 EDT 2023
Set "geocoder" to "cached" when the values have been retrieved from the L2 cache
Expand Down
3 changes: 2 additions & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ if($ENV{AUTHOR_TESTING}) {
my $test_requires = {
'Test::Deep' => 0,
'Test::Most' => 0,
'Test::Number::Delta' => 0, # Always needed since used in free.t
'Test::Needs' => 0,
'Test::NoWarnings' => 0,
'Test::Number::Delta' => 0, # Always needed since used in free.t
};

if($online_tests) {
Expand Down
16 changes: 5 additions & 11 deletions t/eof.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@

use strict;
use warnings;
use Test::Needs 'Test::EOF';
use Test::Most;

BEGIN {
if($ENV{AUTHOR_TESTING}) {
eval {
require Test::EOF;
};
if($@) {
plan(skip_all => 'Test::EOF not installed');
} else {
import Test::EOF;
all_perl_files_ok({ minimum_newlines => 1, maximum_newlines => 4 });
done_testing();
}
if($ENV{'AUTHOR_TESTING'}) {
Test::EOF->import();
all_perl_files_ok({ minimum_newlines => 1, maximum_newlines => 4 });
done_testing();
} else {
plan(skip_all => 'Author tests not required for installation');
}
Expand Down
17 changes: 6 additions & 11 deletions t/eol.t
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#!/usr/bin/env perl

use strict;
use warnings;

use Test::Needs 'Test::EOL';
use Test::Most;

BEGIN {
if($ENV{AUTHOR_TESTING}) {
eval {
require Test::EOL;
};
if($@) {
plan(skip_all => 'Test::EOL not installed');
} else {
import Test::EOL;
all_perl_files_ok({ trailing_whitespace => 1 });
}
if($ENV{'AUTHOR_TESTING'}) {
Test::EOL->import();
all_perl_files_ok({ trailing_whitespace => 1 });
} else {
plan(skip_all => 'Author tests not required for installation');
}
Expand Down
4 changes: 2 additions & 2 deletions t/free.t
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ FREE: {

my $location = $geo_coder_list->geocode('Woolwich, London, England');
cmp_deeply($location,
methods('lat' => num(51.47, 1e-2), 'long' => num(0.20, 1e-2)));
methods('lat' => num(51.4, 1e-1), 'long' => num(0.20, 1)));

if($ENV{'OPENADDR_HOME'}) {
$location = $geo_coder_list->geocode(location => 'Margate, Kent, England');
Expand All @@ -86,7 +86,7 @@ FREE: {
# Check cache
$location = $geo_coder_list->geocode('Woolwich, London, England');
cmp_deeply($location,
methods('lat' => num(51.4, 1e-1), 'long' => num(0.20, 1e-2)));
methods('lat' => num(51.4, 1e-1), 'long' => num(0.20, 1)));

my @locations = $geo_coder_list->geocode(location => 'Herne Bay, Kent, England');
cmp_deeply($locations[0],
Expand Down
10 changes: 3 additions & 7 deletions t/pod-synopsis.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
use strict;
use warnings;
use Test::Most;
use Test::Needs 'Test::Synopsis';

if($ENV{AUTHOR_TESTING}) {
eval 'use Test::Synopsis';

if($@) {
plan(skip_all => 'Test::Synopsis required for testing POD Synopsis');
} else {
all_synopsis_ok();
}
Test::Synopsis->import();
all_synopsis_ok();
} else {
plan(skip_all => 'Author tests not required for installation');
}

0 comments on commit 34e5cd2

Please sign in to comment.