blob: 708b482d00c78841acfa9d2cac4b1ac28850225b [file] [log] [blame]
duke6e45e102007-12-01 00:00:00 +00001
sundaraffd2db2013-02-27 17:22:44 +05302var ScriptContext = javax.script.ScriptContext;
duke6e45e102007-12-01 00:00:00 +00003print(count);
4
5switch (count) {
6 // engine only
7 case 1:
8 if (key != 'value in engine') {
9 throw "unexpected engine scope value";
10 }
sundaraffd2db2013-02-27 17:22:44 +053011 if (context.getAttribute("key", ScriptContext.GLOBAL_SCOPE ) != null) {
duke6e45e102007-12-01 00:00:00 +000012 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 }
sundaraffd2db2013-02-27 17:22:44 +053021 if (context.getAttribute("key", ScriptContext.GLOBAL_SCOPE ) !=
duke6e45e102007-12-01 00:00:00 +000022 "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 }
sundaraffd2db2013-02-27 17:22:44 +053032 if (context.getAttribute("key", ScriptContext.GLOBAL_SCOPE ) !=
duke6e45e102007-12-01 00:00:00 +000033 "value in global") {
34 throw "unexpected global scope value";
35 }
36 break;
37
38 default:
39 throw "unexpected count";
40 break;
41}