Changeset 22114 for v6

Show
Ignore:
Timestamp:
09/02/08 20:31:13 (3 months ago)
Author:
ruoso
Message:

[smop] update the "for" test to be a "map" test, and also tests the lazyness of the map return

Files:
1 moved

Legend:

Unmodified
Added
Removed
  • v6/smop/test/30_array_map.m0ld

    r22091 r22114  
    22my $out_scalar = ¢SMOP__S1P__RootNamespace."postcircumfix:{ }"("$*OUT"); 
    33my $out = $out_scalar."FETCH"(); 
    4 $void = $out."print"("1..4\n"); 
     4$void = $out."print"("1..6\n"); 
    55 
    66my $Code_scalar = ¢SMOP__S1P__RootNamespace."postcircumfix:{ }"("::Code"); 
     
    1515my $array = ¢SMOP__S1P__Array."new"(); 
    1616my $element = $array."postcircumfix:[ ]"(0); 
    17 $void = $element."STORE"("ok 1\n"); 
     17$void = $element."STORE"("ok 2\n"); 
    1818$element = $array."postcircumfix:[ ]"(1); 
    19 $void = $element."STORE"("ok 2\n"); 
     19$void = $element."STORE"("ok 3\n"); 
    2020$element = $array."postcircumfix:[ ]"(2); 
    21 $void = $element."STORE"("ok 3\n"); 
     21$void = $element."STORE"("ok 4\n"); 
    2222$element = $array."postcircumfix:[ ]"(3); 
    23 $void = $element."STORE"("ok 4\n"); 
     23$void = $element."STORE"("ok 5\n"); 
    2424 
    2525my $code1 = $Code."new"(:"outer"($lexicalscope),:"mold"(mold { 
     
    4141})); 
    4242 
    43 $void = $array."for"($code1); 
     43my $mapret = $array."map"($code1); 
     44 
     45$void = $out."print"("ok 1 - map is lazy\n"); 
     46 
     47$void = $mapret."Void"(); 
     48 
     49$void = $out."print"("ok 6 - map in void context is evaluated eagerly\n");