|
Revision 22093, 1.1 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 | force_todo 4; |
|---|
| 6 | |
|---|
| 7 | =begin pod |
|---|
| 8 | |
|---|
| 9 | Test handling of C<-Mmodule>. |
|---|
| 10 | |
|---|
| 11 | =end pod |
|---|
| 12 | |
|---|
| 13 | my $dir = "t/run"; |
|---|
| 14 | |
|---|
| 15 | my @tests = ( |
|---|
| 16 | "-I$dir -MDummy -e load_test", |
|---|
| 17 | "-e load_test -MDummy -I$dir", |
|---|
| 18 | # temporarily run below |
|---|
| 19 | # "-I$dir -MDummy $dir/10-dash-uppercase-m.pl" |
|---|
| 20 | ); |
|---|
| 21 | |
|---|
| 22 | plan 4; |
|---|
| 23 | if $*OS eq "browser" { |
|---|
| 24 | skip_rest "Programs running in browsers don't have access to regular IO."; |
|---|
| 25 | exit; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | diag "Running under $*OS"; |
|---|
| 29 | |
|---|
| 30 | my $redir = ">"; |
|---|
| 31 | |
|---|
| 32 | sub nonce () { return (".{$*PID}." ~ ((1..1000).pick) ~ ".tmp") } |
|---|
| 33 | sub run_pugs ($c) { |
|---|
| 34 | my $tempfile = "temp-ex-output" ~ nonce; |
|---|
| 35 | my $command = "$*EXECUTABLE_NAME $c $redir $tempfile"; |
|---|
| 36 | diag $command; |
|---|
| 37 | run $command; |
|---|
| 38 | my $res = slurp $tempfile; |
|---|
| 39 | unlink $tempfile; |
|---|
| 40 | return $res; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | push @*INC, $dir; |
|---|
| 44 | require Dummy; pass "(dummy instead of broken use_ok)"; |
|---|
| 45 | |
|---|
| 46 | for @tests -> $test { |
|---|
| 47 | my $output = run_pugs($test); |
|---|
| 48 | is( $output, "Module Dummy.pm was loaded\n", "Module was loaded"); |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | # when this works, delete this line, and uncomment this case in the list above. |
|---|
| 52 | is(run_pugs("-I$dir -MDummy $dir/10-dash-uppercase-m.pl"), "Module Dummy.pm was loaded\n", "Module was loaded", :todo<bug>); |
|---|