|
1 // Copyright 2009 the Sputnik authors. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * Embedded syntax constructions of switch statement |
|
6 * |
|
7 * @path ch12/12.11/S12.11_A4_T1.js |
|
8 * @description Nesting one "switch" statement into StatementList of the other's |
|
9 */ |
|
10 |
|
11 function SwitchTest(value){ |
|
12 var result = 0; |
|
13 |
|
14 switch(value) { |
|
15 case 0: |
|
16 switch(value) { |
|
17 case 0: |
|
18 result += 3; |
|
19 break; |
|
20 default: |
|
21 result += 32; |
|
22 break; |
|
23 } |
|
24 result *= 2; |
|
25 break; |
|
26 result=3; |
|
27 default: |
|
28 result += 32; |
|
29 break; |
|
30 } |
|
31 return result; |
|
32 } |
|
33 |
|
34 var x = SwitchTest(0); |
|
35 if(x!==6) $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) ); |
|
36 |