2
|
1 |
var key;
|
|
2 |
var count;
|
|
3 |
|
|
4 |
print(count);
|
|
5 |
|
|
6 |
switch (count) {
|
|
7 |
// engine only
|
|
8 |
case 1:
|
|
9 |
if (key != 'value in engine') {
|
|
10 |
throw "unexpected engine scope value";
|
|
11 |
}
|
|
12 |
if (context.getAttribute("key", context.GLOBAL_SCOPE ) != null) {
|
|
13 |
throw "unexpected global scope value";
|
|
14 |
}
|
|
15 |
break;
|
|
16 |
|
|
17 |
// both scopes
|
|
18 |
case 2:
|
|
19 |
if (key != 'value in engine') {
|
|
20 |
throw "unexpected engine scope value";
|
|
21 |
}
|
|
22 |
if (context.getAttribute("key", context.GLOBAL_SCOPE ) !=
|
|
23 |
"value in global") {
|
|
24 |
throw "unexpected global scope value";
|
|
25 |
}
|
|
26 |
break;
|
|
27 |
|
|
28 |
// global only
|
|
29 |
case 3:
|
|
30 |
if (key != 'value in global') {
|
|
31 |
throw "unexpected global scope value";
|
|
32 |
}
|
|
33 |
if (context.getAttribute("key", context.GLOBAL_SCOPE ) !=
|
|
34 |
"value in global") {
|
|
35 |
throw "unexpected global scope value";
|
|
36 |
}
|
|
37 |
break;
|
|
38 |
|
|
39 |
default:
|
|
40 |
throw "unexpected count";
|
|
41 |
break;
|
|
42 |
}
|