|
Revision 21719, 0.6 kB
(checked in by lwall, 5 months ago)
|
|
[STD] detect obsolete use of =cut
[t/*.t] delete obsolete uses of =cut
|
-
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 kwid |
|---|
| 6 | |
|---|
| 7 | Tests autothreading junction example from Synopsis 09 |
|---|
| 8 | |
|---|
| 9 | L<S09/Junctions> |
|---|
| 10 | |
|---|
| 11 | =end kwid |
|---|
| 12 | |
|---|
| 13 | plan 3; |
|---|
| 14 | |
|---|
| 15 | # test auto-threading |
|---|
| 16 | |
|---|
| 17 | my $c = 0; |
|---|
| 18 | |
|---|
| 19 | is(substr("camel", 0, 2), "ca", "substr()"); |
|---|
| 20 | |
|---|
| 21 | $c = 0; |
|---|
| 22 | sub my_substr ($str, $i, $j) { |
|---|
| 23 | $c++; |
|---|
| 24 | my @c = split "", $str; |
|---|
| 25 | join("", @c[$i..($i+$j-1)]); |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | my $j = my_substr("camel", 0|1, 2&3); |
|---|
| 29 | |
|---|
| 30 | # L<S09/Junctions/Each of the resulting set of calls is then recursively autothreaded> |
|---|
| 31 | is($c, 4, "substr() called 4 times"); |
|---|
| 32 | |
|---|
| 33 | # all(any("am","ca"),any("ame","cam")); |
|---|
| 34 | |
|---|
| 35 | ok( ($j == all("am","ame")) && |
|---|
| 36 | ($j == all("ca","cam")), |
|---|
| 37 | "Junctions as arg inputs work as expected" ); |
|---|