-
Notifications
You must be signed in to change notification settings - Fork 220
/
Copy pathcommand-help.t
47 lines (38 loc) · 1.51 KB
/
command-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
#!/usr/bin/env perl
use Test2::V0;
use FindBin;
use lib $FindBin::Bin;
use App::perlbrew;
require "test2_helpers.pl";
my $bin_perlbrew = file(__FILE__)->dirname->dirname->child("script")->child("perlbrew");
my $perl = $^X;
#
# Doing `App::perlbrew->new("help")->run` will make this test program exit(),
# that's why we use backtick to test.
#
subtest "`perlbrew` should print some nice message and instruct user to read help for individual commands" => sub {
my $out = `$perl -Ilib $bin_perlbrew help`;
like $out, qr/perlbrew help <command>/si;
};
subtest "`perlbrew -h` should print short version of help message and instruct user to read longer version" => sub {
my $out1 = `$perl -Ilib $bin_perlbrew --help`;
my $out2 = `$perl -Ilib $bin_perlbrew -h`;
is $out2, $out1;
like $out1, qr/^ See `perlbrew help` for the full documentation/m;
unlike $out1, qr/^CONFIGURATION$/m;
};
subtest "`perlbrew help` should should the lengthy version " => sub {
my $out = `$perl -Ilib $bin_perlbrew help`;
like $out, qr/^CONFIGURATION$/m;
};
subtest "`perlbrew help` should instruct user to read help for individual commands." => sub {
my $out = `$perl -Ilib $bin_perlbrew help`;
like $out, qr/perlbrew help <command>/si;
};
subtest "`perlbrew help install` should show the options for install command" => sub {
my $out = `$perl -Ilib $bin_perlbrew help install`;
like $out, qr/^Options for "install" command:/msi;
like $out, qr/--force/si;
like $out, qr/--notest/si;
};
done_testing;