From: Eric Brine Date: Sat, 28 Nov 2009 04:52:41 +0000 (-0800) Subject: Test modifiability of range elements X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2e0a827f13b2065625fa468c74693fcff824b17f;p=p5sagit%2Fp5-mst-13.2.git Test modifiability of range elements --- diff --git a/t/op/range.t b/t/op/range.t index 214c168..81f7b0f 100644 --- a/t/op/range.t +++ b/t/op/range.t @@ -9,7 +9,7 @@ require 'test.pl'; use Config; -plan (135); +plan (141); is(join(':',1..5), '1:2:3:4:5'); @@ -403,4 +403,19 @@ is("@foo", "6 5 4"); } is(stores($x), 0); +is( ( join ' ', map { join '', map ++$_, ($x=1)..4 } 1..2 ), '2345 2345', + 'modifiable variable num range' ); +is( ( join ' ', map { join '', map ++$_, 1..4 } 1..2 ), '2345 3456', + 'modifiable const num range' ); # Unresolved bug RT#3105 +$s = ''; for (1..2) { for (1..4) { $s .= ++$_ } $s.=' ' if $_==1; } +is( $s, '2345 2345','modifiable num counting loop counter' ); + + +is( ( join ' ', map { join '', map ++$_, ($x='a')..'d' } 1..2 ), 'bcde bcde', + 'modifiable variable alpha range' ); +is( ( join ' ', map { join '', map ++$_, 'a'..'d' } 1..2 ), 'bcde cdef', + 'modifiable const alpha range' ); # Unresolved bug RT#3105 +$s = ''; for (1..2) { for ('a'..'d') { $s .= ++$_ } $s.=' ' if $_==1; } +is( $s, 'bcde bcde','modifiable alpha counting loop counter' ); + # EOF