Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f29ca95
commit 4933f0f
Showing
8 changed files
with
112 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
#!perl -w | |||
|
|||
use strict; | |||
use warnings; | |||
use Test::Most; | |||
|
|||
if(not $ENV{AUTHOR_TESTING}) { | |||
plan(skip_all => 'Author tests not required for installation'); | |||
} | |||
|
|||
eval "use Test::Pod::LinkCheck"; | |||
if($@) { | |||
plan(skip_all => 'Test::Pod::LinkCheck required for testing POD'); | |||
} else { | |||
Test::Pod::LinkCheck->new->all_pod_ok(); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
#!perl -wT | |||
|
|||
use strict; | |||
use warnings; | |||
use Test::Most; | |||
|
|||
if(not $ENV{AUTHOR_TESTING}) { | |||
plan(skip_all => 'Author tests not required for installation'); | |||
} | |||
|
|||
eval "use Test::Pod::No404s"; | |||
if($@) { | |||
plan(skip_all => 'Test::Pod::No404s required for testing POD'); | |||
} else { | |||
all_pod_files_ok(); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,62 @@ | |||
#!perl -wT | |||
|
|||
use strict; | |||
use warnings; | |||
use Test::Most tests => 16; | |||
use Test::NoWarnings; | |||
|
|||
eval 'use autodie qw(:all)'; # Test for open/close failures | |||
|
|||
BEGIN { | |||
use_ok('Geo::Coder::List'); | |||
} | |||
|
|||
BING: { | |||
SKIP: { | |||
skip 'Test requires Internet access', 14 unless(-e 't/online.enabled'); | |||
|
|||
eval { | |||
require Geo::Coder::OpenCage; | |||
|
|||
Geo::Coder::OpenCage->import(); | |||
|
|||
require Test::Number::Delta; | |||
|
|||
Test::Number::Delta->import(); | |||
}; | |||
|
|||
if($@) { | |||
diag('Geo::Coder::OpenCage not installed - skipping tests'); | |||
skip 'Geo::Coder::OpenCage not installed', 14; | |||
} else { | |||
diag("Using Geo::Coder::OpenCage $Geo::Coder::OpenCage::VERSION"); | |||
} | |||
|
|||
if(my $key = $ENV{'GEO_CODER_OPENCAGE_API_KEY'}) { | |||
my $geocoderlist = new_ok('Geo::Coder::List'); | |||
my $geocoder = new_ok('Geo::Coder::OpenCage' => [ api_key => $key ]); | |||
$geocoderlist->push($geocoder); | |||
|
|||
my $location = $geocoderlist->geocode('Silver Spring, MD, USA'); | |||
ok(defined($location)); | |||
ok(ref($location) eq 'HASH'); | |||
delta_within($location->{geometry}{location}{lat}, 38.991, 1e-1); | |||
delta_within($location->{geometry}{location}{lng}, -77.026, 1e-1); | |||
|
|||
$location = $geocoderlist->geocode('Wisdom Hospice, Rochester, England'); | |||
ok(defined($location)); | |||
ok(ref($location) eq 'HASH'); | |||
delta_within($location->{geometry}{location}{lat}, 51.396, 1e-1); | |||
delta_within($location->{geometry}{location}{lng}, 0.488, 1e-1); | |||
|
|||
$location = $geocoderlist->geocode('St Mary The Virgin, Minster, Thanet, Kent, England'); | |||
ok(defined($location)); | |||
ok(ref($location) eq 'HASH'); | |||
delta_within($location->{geometry}{location}{lat}, 51.330, 1e-1); | |||
delta_within($location->{geometry}{location}{lng}, 1.31596, 1e-1); | |||
} else { | |||
diag('Set BMAP_KEY to enable more tests'); | |||
skip 'BMAP_KEY not set', 14; | |||
} | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters