-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to include or exclude specific sites
- Loading branch information
Showing
3 changed files
with
62 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ MYMETA.yml | |
README.md | ||
t/00-load.t | ||
t/01-basic.t | ||
t/02-include-exclude.t | ||
t/pod.t | ||
t/pod_coverage.t |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use strict; | ||
use warnings; | ||
|
||
use Test::More; | ||
use Test::Exception; | ||
Check failure on line 5 in t/02-include-exclude.t GitHub Actions / test / Perl 5.34 on ubuntu-latest
Check failure on line 5 in t/02-include-exclude.t GitHub Actions / test / Perl 5.34 on ubuntu-latest
Check failure on line 5 in t/02-include-exclude.t GitHub Actions / test / Perl 5.36 on ubuntu-latest
Check failure on line 5 in t/02-include-exclude.t GitHub Actions / test / Perl 5.36 on ubuntu-latest
Check failure on line 5 in t/02-include-exclude.t GitHub Actions / test / Perl 5.38 on ubuntu-latest
|
||
|
||
use Amazon::Sites; | ||
|
||
throws_ok { Amazon::Sites->new( include => [ 'UK' ], exclude => [ 'US' ]) } | ||
qr[You can't specify both include and exclude], | ||
'Can\'t specify both include and exclude'; | ||
|
||
my $sites = Amazon::Sites->new(exclude => [ 'US' ]); | ||
my $az_us = $sites->site('US'); | ||
ok(! $az_us, 'US is excluded'); | ||
my $az_uk = $sites->site('UK'); | ||
ok($az_uk, 'UK is included'); | ||
is_deeply([ $sites->codes ], | ||
[ qw(AE AU BE BR CA CN DE EG ES FR IN IT JP MX NL PL SA SE SG TR UK) ], | ||
'Correct codes are included'); | ||
|
||
$sites = Amazon::Sites->new(include => [ 'UK' ]); | ||
$az_us = $sites->site('US'); | ||
ok(! $az_us, 'US is excluded'); | ||
$az_uk = $sites->site('UK'); | ||
ok($az_uk, 'UK is included'); | ||
is_deeply([ $sites->codes ], | ||
[ qw(UK) ], | ||
'Correct code is included'); | ||
|
||
done_testing; |