-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from pine613/develop
Update version to v1.1.5
- Loading branch information
Showing
7 changed files
with
111 additions
and
14 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use strict; | ||
use warnings; | ||
use utf8; | ||
|
||
use Test::MockObject; | ||
|
||
use t::Util; | ||
use CrystalBuild::Resolver::Shards; | ||
|
||
subtest basic => sub { | ||
my $url = Test::MockObject->new; | ||
my $fetcher = Test::MockObject->new; | ||
$fetcher->mock(fetch => sub { | ||
is $_[1], $url; | ||
return do { local $/; <DATA> }; | ||
}); | ||
|
||
my $resolver = CrystalBuild::Resolver::Shards->new( | ||
fetcher => $fetcher, | ||
shards_releases_url => $url, | ||
); | ||
|
||
cmp_deeply $resolver->_fetch, { result => "ok" }; | ||
ok $fetcher->called('fetch'); | ||
}; | ||
|
||
done_testing; | ||
__DATA__ | ||
{ "result": "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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use strict; | ||
use warnings; | ||
use utf8; | ||
|
||
use t::Util; | ||
use CrystalBuild::Resolver::Shards; | ||
|
||
subtest basic => sub { | ||
my $resolver = CrystalBuild::Resolver::Shards->new( | ||
fetcher => '__FETCHER__', | ||
shards_releases_url => '__SHARDS_RELEASES_URL__', | ||
); | ||
|
||
isa_ok $resolver, 'CrystalBuild::Resolver::Shards'; | ||
|
||
is $resolver->fetcher, '__FETCHER__'; | ||
is $resolver->shards_releases_url, '__SHARDS_RELEASES_URL__'; | ||
}; | ||
|
||
done_testing; |
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,48 @@ | ||
use strict; | ||
use warnings; | ||
use utf8; | ||
|
||
use Test::Mock::Guard qw/mock_guard/; | ||
|
||
use t::Util; | ||
use CrystalBuild::Resolver::Shards; | ||
|
||
subtest basic => sub { | ||
my $releases; | ||
my $guard = mock_guard('CrystalBuild::Resolver::Shards', { | ||
_fetch => sub { $releases }, | ||
}); | ||
my $resolver = CrystalBuild::Resolver::Shards->new; | ||
|
||
subtest '#ok' => sub { | ||
$releases = { '0.11.0' => '__URL__' }; | ||
is $resolver->resolve('0.11.0'), '__URL__'; | ||
}; | ||
|
||
subtest '#ok ... default' => sub { | ||
$releases = { 'default' => '__URL__' }; | ||
is $resolver->resolve('0.10.0'), '__URL__'; | ||
}; | ||
|
||
subtest '#ng ... not found' => sub { | ||
$releases = { '0.11.0' => '__URL__' }; | ||
is $resolver->resolve('0.10.0'), undef; | ||
}; | ||
|
||
subtest '#ng ... null' => sub { | ||
$releases = undef; | ||
is $resolver->resolve('0.11.0'), undef; | ||
}; | ||
|
||
subtest '#ng ... string' => sub { | ||
$releases = 'STRING'; | ||
is $resolver->resolve('0.11.0'), undef; | ||
}; | ||
|
||
subtest '#ng ... array' => sub { | ||
$releases = []; | ||
is $resolver->resolve('0.11.0'), undef; | ||
}; | ||
}; | ||
|
||
done_testing; |