Skip to content
Newer
Older
100644 54 lines (45 sloc) 1.61 KB
d112366 @masak [t/subcommands] added
authored
1 use v6;
2 use Test;
3
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
4 use App::Pls;
d112366 @masak [t/subcommands] added
authored
5
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
6 my %projects =
7 will-succeed => {},
8 will-fail => {},
9 # RAKUDO: Need quotes around keys starting with 'has-' [perl #75694]
10 'has-deps' => { :deps<A B> },
11 A => {},
12 B => { :deps<C D> },
13 C => {},
14 D => {},
15 circ-deps => { :deps<E> },
16 E => { :deps<circ-deps> },
17 dirdep-fails => { :deps<will-fail> },
18 indir-fails => { :deps<dirdep-fails> },
19 ;
d112366 @masak [t/subcommands] added
authored
20
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
21 class Mock::Fetcher does App::Pls::Fetcher {
44c586b @masak [App::Pls] implemented 'fetch'
authored
22 method fetch($project --> Result) {
d26710d @masak [App::Pls] introduced Ecosystem
authored
23 $project<name> eq 'will-fail' ?? failure !! success;
44c586b @masak [App::Pls] implemented 'fetch'
authored
24 }
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
25 }
d112366 @masak [t/subcommands] added
authored
26
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
27 my $core = App::Pls::Core.new(
406f599 @masak [t/subcommands] chased API
authored
28 :projects(App::Pls::ProjectsState::Hash.new(:%projects)),
29 :ecosystem(App::Pls::Ecosystem::Hash.new(:%projects)),
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
30 :fetcher(Mock::Fetcher.new()),
31 );
d112366 @masak [t/subcommands] added
authored
32
7522692 @masak [App::Pls] make .fetch non-recursive
authored
33 plan 14;
d112366 @masak [t/subcommands] added
authored
34
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
35 given $core {
36 # [T] Fetch a project: Succeed.
b9d3e4e @masak [App::Pls] s/gone/absent/
authored
37 is .state-of('will-succeed'), 'absent', "State is now 'absent'";
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
38 is .fetch(<will-succeed>), success, "Fetch a project: Succeed";
22f24b5 @masak [t/subcommands/*.t] decided to go with strings
authored
39 is .state-of('will-succeed'), 'fetched', "State after: 'fetched'";
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
40
41 # [T] Fetch a project; an unexpected error occurs: Fail.
42 is .fetch(<will-fail>), failure, "Fetch a project: Fail";
b9d3e4e @masak [App::Pls] s/gone/absent/
authored
43 is .state-of('will-fail'), 'absent', "State after: 'absent'";
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
44
7522692 @masak [App::Pls] make .fetch non-recursive
authored
45 # [T] Fetch a project with dependencies: don't fetch dependencies too.
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
46 for <A B C D> -> $dep {
b9d3e4e @masak [App::Pls] s/gone/absent/
authored
47 is .state-of($dep), 'absent', "State before of $dep: 'absent'";
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
48 }
49 is .fetch(<has-deps>), success, "Fetch project's dependencies, too";
50 for <A B C D> -> $dep {
7522692 @masak [App::Pls] make .fetch non-recursive
authored
51 is .state-of($dep), 'absent', "State after of $dep: 'fetched'";
61dc539 @masak [t/subcommands/fetch.t] fleshed out
authored
52 }
53 }
Something went wrong with that request. Please try again.