author | mchung |
Mon, 27 Oct 2014 13:45:39 -0700 | |
changeset 27260 | 8d82d0e9556b |
parent 16038 | de84354579d3 |
permissions | -rw-r--r-- |
2 | 1 |
|
16038
de84354579d3
8009115: jtreg tests under jdk/test/javax/script should use nashorn as script engine
sundar
parents:
2
diff
changeset
|
2 |
var ScriptContext = javax.script.ScriptContext; |
2 | 3 |
print(count); |
4 |
||
5 |
switch (count) { |
|
6 |
// engine only |
|
7 |
case 1: |
|
8 |
if (key != 'value in engine') { |
|
9 |
throw "unexpected engine scope value"; |
|
10 |
} |
|
16038
de84354579d3
8009115: jtreg tests under jdk/test/javax/script should use nashorn as script engine
sundar
parents:
2
diff
changeset
|
11 |
if (context.getAttribute("key", ScriptContext.GLOBAL_SCOPE ) != null) { |
2 | 12 |
throw "unexpected global scope value"; |
13 |
} |
|
14 |
break; |
|
15 |
||
16 |
// both scopes |
|
17 |
case 2: |
|
18 |
if (key != 'value in engine') { |
|
19 |
throw "unexpected engine scope value"; |
|
20 |
} |
|
16038
de84354579d3
8009115: jtreg tests under jdk/test/javax/script should use nashorn as script engine
sundar
parents:
2
diff
changeset
|
21 |
if (context.getAttribute("key", ScriptContext.GLOBAL_SCOPE ) != |
2 | 22 |
"value in global") { |
23 |
throw "unexpected global scope value"; |
|
24 |
} |
|
25 |
break; |
|
26 |
||
27 |
// global only |
|
28 |
case 3: |
|
29 |
if (key != 'value in global') { |
|
30 |
throw "unexpected global scope value"; |
|
31 |
} |
|
16038
de84354579d3
8009115: jtreg tests under jdk/test/javax/script should use nashorn as script engine
sundar
parents:
2
diff
changeset
|
32 |
if (context.getAttribute("key", ScriptContext.GLOBAL_SCOPE ) != |
2 | 33 |
"value in global") { |
34 |
throw "unexpected global scope value"; |
|
35 |
} |
|
36 |
break; |
|
37 |
||
38 |
default: |
|
39 |
throw "unexpected count"; |
|
40 |
break; |
|
41 |
} |