Changeset 22870 for t

Show
Ignore:
Timestamp:
11/04/08 17:59:25 (2 months ago)
Author:
moritz
Message:

[t/spec] tests for @() context forcers, patch courtesy by rindolf++
(plus precedence corrections)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/spec/S03-operators/context-forcers.t

    r22450 r22870  
    33use Test; 
    44 
    5 plan 81; 
     5plan 87; 
    66 
    77{ # L<S03/"Changes to Perl 5 operators"/imposes boolean context/> 
     
    179179    is(int($c), 1, 'float numbers forced into integer context are 0'); 
    180180} 
     181 
     182{ 
     183    my $x = [0, 100, 280, 33, 400, 5665]; 
     184 
     185    is (@($x)[1], 100, '@$x works'); 
     186 
     187    is (@($x)[3]+50, 83, '@$x works inside a larger expression'); 
     188 
     189    my $y = [601, 700, 888]; 
     190 
     191    my @total = (@$x, @$y); 
     192 
     193    is (@total[0], 0, "total[0] is 0"); 
     194    is (@total[1], 100, "total[1] is 100"); 
     195    is (@total[6], 601, "total[1] is 100"); 
     196    is (@total[8], 888, "total[1] is 100"); 
     197} 
     198