-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path06-dash-help.t
43 lines (30 loc) · 845 Bytes
/
06-dash-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
use v6;
use Test;
=begin pod
Test that the C<--help> command in its various incantations
works.
=end pod
my @examples = any <-h --help>;
@examples = map -> Junction $_ { $_.eigenstates },
map -> Junction $_ { $_, "-w $_", "$_ -w", "-w $_ -w" },
@examples;
plan +@examples;
if $*OS eq "browser" {
skip_rest "Programs running in browsers don't have access to regular IO.";
exit;
}
diag "Running under $*OS";
my $redir = ">";
if $*OS eq any <MSWin32 mingw msys cygwin> {
$redir = '>';
};
sub nonce () { return (".{$*PID}." ~ (1..1000).pick) }
for @examples -> $ex {
my $out_fn = "temp-ex-output" ~ nonce;
my $command = "$*EXECUTABLE_NAME $ex $redir $out_fn";
diag $command;
run $command;
my $got = slurp $out_fn;
unlink $out_fn;
like( $got, rx:Perl5/^Usage/, "'$ex' displays help");
}