root/t/run/06-dash-help.t

Revision 22093, 0.8 kB (checked in by lwall, 4 months ago)

[t] more system, require, does, defer, label cleanup

  • Property svn:mime-type set to text/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1use v6;
2
3use Test;
4
5=begin pod
6
7Test that the C<--help> command in its various incantations
8works.
9
10=end pod
11
12my @examples = any <-h --help>;
13@examples = map -> Junction $_ { $_.values },
14            map -> Junction $_ { $_, "-w $_", "$_ -w", "-w $_ -w" },
15            @examples;
16
17plan +@examples;
18if $*OS eq "browser" {
19  skip_rest "Programs running in browsers don't have access to regular IO.";
20  exit;
21}
22
23diag "Running under $*OS";
24
25my $redir = ">";
26
27if $*OS eq any <MSWin32 mingw msys cygwin> {
28  $redir = '>';
29};
30
31sub nonce () { return (".{$*PID}." ~ (1..1000).pick) }
32
33for @examples -> $ex {
34  my $out_fn = "temp-ex-output" ~ nonce;
35  my $command = "$*EXECUTABLE_NAME $ex $redir $out_fn";
36  diag $command;
37  run $command;
38
39  my $got      = slurp $out_fn;
40  unlink $out_fn;
41
42  like( $got, rx:Perl5/^Usage/, "'$ex' displays help");
43}
Note: See TracBrowser for help on using the browser.