/
help.t
59 lines (50 loc) · 1.18 KB
/
help.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use v5.14;
use strict;
use warnings;
use autodie;
use Test::More 0.92;
use lib 't/lib';
use TestHelper;
my @untargeted= qw(
init
);
my @targeted = qw(
apply
delete
edit
rename
show
strip
sync
);
my @type_target_only = qw(
list
);
for my $c ( @untargeted ) {
subtest "$c help style" => sub {
my $result = _try_command("help", $c);
unlike( $result->output, qr/TARGET/, "Should not have TARGET section" );
};
}
for my $c ( @targeted ) {
subtest "$c help style" => sub {
my $result = _try_command("help", $c);
like( $result->output, qr/Valid TARGET types include:/s, "Should have TARGET section" );
};
}
for my $c ( @type_target_only ) {
subtest "$c help style" => sub {
my $result = _try_command("help", $c);
like( $result->output, qr/Valid types include:/s, "Should have types selection section" );
};
}
for my $c ( @untargeted, @targeted ) {
subtest "$c: help vs --help" => sub {
my $result1 = _try_command("help", $c);
my $result2 = _try_command($c, "--help");
is( $result1->output, $result2->output, "help text matches" );
is( $result1->exit_code, $result2->exit_code, "exit codes match" );
};
}
done_testing;
# COPYRIGHT