root/t/junction/s09eg.t

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 
1use v6;
2
3use Test;
4
5=begin kwid
6
7Tests autothreading junction example from Synopsis 09
8
9L<S09/Junctions>
10
11=end kwid
12
13plan 3;
14
15# test auto-threading
16
17my $c = 0;
18
19is(substr("camel", 0, 2),  "ca", "substr()");
20
21$c = 0;
22sub my_substr ($str, $i, $j) {
23    $c++;
24    my @c = split "", $str;
25    join("", @c[$i..($i+$j-1)]);
26}
27
28my $j = my_substr("camel", 0|1, 2&3);
29
30# L<S09/Junctions/Each of the resulting set of calls is then recursively autothreaded>
31is($c, 4, "substr() called 4 times");
32
33# all(any("am","ca"),any("ame","cam"));
34
35ok( ($j == all("am","ame")) &&
36    ($j == all("ca","cam")),
37    "Junctions as arg inputs work as expected" );
Note: See TracBrowser for help on using the browser.