Changeset 21990
- Timestamp:
- 08/21/08 10:34:53 (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
r21953 r21990 143 143 my ($foo, $bar) = (1, 0); 144 144 given (1) { 145 when (1) { $foo = 2; break; $foo = 3; }145 when (1) { $foo = 2; last; $foo = 3; } 146 146 when (2) { $foo = 4; } 147 147 default { $bar = 1 } 148 148 $foo = 5; 149 149 }; 150 is($foo, 2, ' breakaborts when');151 ok(!$bar, ' breakprevents default');150 is($foo, 2, 'last aborts when'); 151 ok(!$bar, 'last prevents default'); 152 152 } 153 153 … … 158 158 for 0, 1, 2 { 159 159 when 0 { $foo++; continue } 160 when 1 { $bar++; break}160 when 1 { $bar++; last } 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, " breakdidn't abort loop");168 is($quux, 1, "last didn't abort loop"); 169 169 ok(!$bad, "didn't fall through"); 170 170 }
