author | mchung |
Mon, 27 Oct 2014 13:45:39 -0700 | |
changeset 27260 | 8d82d0e9556b |
parent 16038 | de84354579d3 |
permissions | -rw-r--r-- |
16038
de84354579d3
8009115: jtreg tests under jdk/test/javax/script should use nashorn as script engine
sundar
parents:
2
diff
changeset
|
1 |
var ScriptContext = javax.script.ScriptContext; |
de84354579d3
8009115: jtreg tests under jdk/test/javax/script should use nashorn as script engine
sundar
parents:
2
diff
changeset
|
2 |
|
2 | 3 |
if (key == undefined || key != 'engine value') { |
4 |
throw "unexpected engine scope value"; |
|
5 |
} |
|
6 |
||
7 |
// pre-defined context variable refers to current ScriptContext |
|
16038
de84354579d3
8009115: jtreg tests under jdk/test/javax/script should use nashorn as script engine
sundar
parents:
2
diff
changeset
|
8 |
if (context.getAttribute('key', ScriptContext.GLOBAL_SCOPE) != 'global value') { |
2 | 9 |
throw "unexpected global scope value"; |
10 |
} |
|
11 |
||
12 |
// change the engine scope value |
|
13 |
key = 'new engine value'; |
|
14 |
||
16038
de84354579d3
8009115: jtreg tests under jdk/test/javax/script should use nashorn as script engine
sundar
parents:
2
diff
changeset
|
15 |
if (context.getAttribute('key', ScriptContext.GLOBAL_SCOPE) != 'global value') { |
2 | 16 |
throw "global scope should not change here"; |
17 |
} |
|
18 |
||
19 |
// delete engine scope value |
|
20 |
delete key; |
|
21 |
||
16038
de84354579d3
8009115: jtreg tests under jdk/test/javax/script should use nashorn as script engine
sundar
parents:
2
diff
changeset
|
22 |
if (key == undefined && key != 'global value') { |
2 | 23 |
throw 'global scope should be visible after engine scope removal'; |
24 |
} |