Debian Codegraph @

t/integration/help.t

raw
1 use Test2::V0;
2
3 use File::Temp qw/tempdir/;
4 use File::Spec;
5
6 use App::Yath::Tester qw/yath/;
7 use App::Yath::Util qw/find_yath/;
8
9 yath(
10 command => 'help',
11 args => [],
12 exit => 0,
13 test => sub {
14 my $out = shift;
15
16 like($out->{output}, qr{^Usage: .*yath COMMAND \[options\]$}m, "Found usage statement");
17 like($out->{output}, qr{^Available Commands:$}m, "available commands");
18
19 # Sample some essential commands
20 like($out->{output}, qr{^\s+help: Show the list of commands$}m, "'help' command is listed");
21 like($out->{output}, qr{^\s+test: Run tests$}m, "'test' command is listed");
22 like($out->{output}, qr{^\s+start: Start the persistent test runner$}m, "'start' command is listed");
23 },
24 );
25
26 yath(
27 command => 'help',
28 args => ['help'],
29 exit => 0,
30 test => sub {
31 my $out = shift;
32 my $script = find_yath();
33
34 $out->{output} =~ s/^Detected App::Yath::Script::V# modules in local.*\n//m;
35
36 is($out->{output}, <<" EOT", "Got output for the help command");
37 help - Show the list of commands
38
39 This command provides a list of commands when called with no arguments.
40 When given a command name as an argument it will print the help for that
41 command.
42
43 Usage: $script help
44 EOT
45 },
46 );
47
48 yath(
49 command => 'help',
50 args => ['test'],
51 exit => 0,
52 test => sub {
53 my $out = shift;
54
55 like($out->{output}, qr{^test - Run tests$}m, "Found summary");
56 like($out->{output}, qr{^\[YATH OPTIONS\]$}m, "Found yath options");
57 like($out->{output}, qr{^ Developer$}m, "Found Developer category");
58 like($out->{output}, qr{^ Help and Debugging$}m, "Found help category");
59 like($out->{output}, qr{^ Plugins$}m, "Found plugin category");
60 like($out->{output}, qr{^\[COMMAND OPTIONS\]$}m, "Found command options");
61 like($out->{output}, qr{^ Display Options$}m, "Found display category");
62 like($out->{output}, qr{^ Formatter Options$}m, "Found formatter category");
63 like($out->{output}, qr{^ Logging Options$}m, "Found logging category");
64 like($out->{output}, qr{^ Run Options$}m, "Found run category");
65 like($out->{output}, qr{^ Runner Options$}m, "Found runner category");
66 like($out->{output}, qr{^ Workspace Options$}m, "Found workspace category");
67 },
68 );
69
70 done_testing;