Changeset 21991
- Timestamp:
- 08/21/08 10:39:43 (3 months ago)
- Files:
-
- 1 modified
-
t/spec/S04-statements/given.t (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
t/spec/S04-statements/given.t
r21990 r21991 143 143 my ($foo, $bar) = (1, 0); 144 144 given (1) { 145 when (1) { $foo = 2; last; $foo = 3; }145 when (1) { $foo = 2; break; $foo = 3; } 146 146 when (2) { $foo = 4; } 147 147 default { $bar = 1 } 148 148 $foo = 5; 149 149 }; 150 is($foo, 2, ' lastaborts when');151 ok(!$bar, ' lastprevents default');150 is($foo, 2, 'break aborts when'); 151 ok(!$bar, 'break prevents default'); 152 152 } 153 153 … … 158 158 for 0, 1, 2 { 159 159 when 0 { $foo++; continue } 160 when 1 { $bar++; last}160 when 1 { $bar++; break } 161 161 when 2 { $quux++; } 162 162 default { $baz = $_ } … … 166 166 is($bar, 1, 'second iteration'); 167 167 is($baz, 0, 'continue worked'); 168 is($quux, 1, " lastdidn't abort loop");168 is($quux, 1, "break didn't abort loop"); 169 169 ok(!$bad, "didn't fall through"); 170 170 }
