test/jdk/javax/script/Test5.js
author coleenp
Mon, 30 Sep 2019 13:10:11 -0400
changeset 58409 a595e67d6683
parent 47216 71c04702a3d5
permissions -rw-r--r--
8184732: Deadlock detection improvements for 'special' locks Summary: Assert that special ranked locks cannot safepoint and allow_vm_block and remove locks from the exceptional lock list in no_safepoint_verifier. Reviewed-by: dholmes, eosterlund
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
print(count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
switch (count) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
        // engine only
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
	case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
            if (key != 'value in engine') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
                throw "unexpected engine scope value";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
                throw "unexpected global scope value";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
        // both scopes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
        case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
            if (key != 'value in engine') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
                throw "unexpected engine scope value";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
                "value in global") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
                throw "unexpected global scope value";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
        // global only
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
        case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
            if (key != 'value in global') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
                throw "unexpected global scope value";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
                "value in global") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
                throw "unexpected global scope value";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
            throw "unexpected count";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
}