|
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 | |
|---|
| 1 | use v6; |
|---|
| 2 | |
|---|
| 3 | use Test; |
|---|
| 4 | |
|---|
| 5 | =begin pod |
|---|
| 6 | |
|---|
| 7 | Test that the C<--help> command in its various incantations |
|---|
| 8 | works. |
|---|
| 9 | |
|---|
| 10 | =end pod |
|---|
| 11 | |
|---|
| 12 | my @examples = any <-h --help>; |
|---|
| 13 | @examples = map -> Junction $_ { $_.values }, |
|---|
| 14 | map -> Junction $_ { $_, "-w $_", "$_ -w", "-w $_ -w" }, |
|---|
| 15 | @examples; |
|---|
| 16 | |
|---|
| 17 | plan +@examples; |
|---|
| 18 | if $*OS eq "browser" { |
|---|
| 19 | skip_rest "Programs running in browsers don't have access to regular IO."; |
|---|
| 20 | exit; |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | diag "Running under $*OS"; |
|---|
| 24 | |
|---|
| 25 | my $redir = ">"; |
|---|
| 26 | |
|---|
| 27 | if $*OS eq any <MSWin32 mingw msys cygwin> { |
|---|
| 28 | $redir = '>'; |
|---|
| 29 | }; |
|---|
| 30 | |
|---|
| 31 | sub nonce () { return (".{$*PID}." ~ (1..1000).pick) } |
|---|
| 32 | |
|---|
| 33 | for @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 | } |
|---|