rhino1.7.7.testsrc.jstests.608235.jstest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rhino Show documentation
Show all versions of rhino Show documentation
Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically
embedded into Java applications to provide scripting to end users.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// https://bugzilla.mozilla.org/show_bug.cgi?id=608235
function Try(f, expected) {
try {
f();
throw "Expected error: " + expected;
} catch (e) {
if (e != expected) {
throw "Expected error: " + expected;
}
}
}
Try(
function(){ undefined[undefined] },
'TypeError: Cannot read property "undefined" from undefined'
);
Try(
function(){ undefined[undefined] = 1 },
'TypeError: Cannot set property "undefined" of undefined to "1"'
);
Try(
function(){ undefined[undefined] = {} },
'TypeError: Cannot set property "undefined" of undefined to "[object Object]"'
);
Try(
function(){ undefined[undefined] = [1,2,3] },
'TypeError: Cannot set property "undefined" of undefined to "1,2,3"'
);
Try(
function(){ delete undefined[undefined] },
'TypeError: Cannot delete property "undefined" of undefined'
);
Try(
function(){ undefined[undefined]() },
'TypeError: Cannot call method "undefined" of undefined'
);
"success";
© 2015 - 2024 Weber Informatics LLC | Privacy Policy