Path: blob/master/test/jdk/javax/script/Test5.js
41144 views
1var ScriptContext = javax.script.ScriptContext;2print(count);34switch (count) {5// engine only6case 1:7if (key != 'value in engine') {8throw "unexpected engine scope value";9}10if (context.getAttribute("key", ScriptContext.GLOBAL_SCOPE ) != null) {11throw "unexpected global scope value";12}13break;1415// both scopes16case 2:17if (key != 'value in engine') {18throw "unexpected engine scope value";19}20if (context.getAttribute("key", ScriptContext.GLOBAL_SCOPE ) !=21"value in global") {22throw "unexpected global scope value";23}24break;2526// global only27case 3:28if (key != 'value in global') {29throw "unexpected global scope value";30}31if (context.getAttribute("key", ScriptContext.GLOBAL_SCOPE ) !=32"value in global") {33throw "unexpected global scope value";34}35break;3637default:38throw "unexpected count";39break;40}414243