jdk/test/tools/jjs/es6.js
author sundar
Mon, 21 Dec 2015 09:40:00 +0530
changeset 34721 59801fbd042e
permissions -rw-r--r--
8145750: jjs fails to run simple scripts with security manager turned on Reviewed-by: hannesw, alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34721
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
     1
/*
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
     2
 * This is the test JavaScript program used in jjs-es6Test.sh
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
     3
 */
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
     4
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
     5
const X = 4;
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
     6
try {
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
     7
    X = 55;
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
     8
    throw new Error("should have thrown TypeError");
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
     9
} catch (e) {
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
    10
    if (! (e instanceof TypeError)) {
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
    11
        throw new Error("TypeError expected, got " + e);
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
    12
    }
59801fbd042e 8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff changeset
    13
}