blob: 1177cb95811307bb667d390c69acde722f71e44b [file] [log] [blame]
var setGlobalConstRedeclarationShouldNotThrow = $vm.setGlobalConstRedeclarationShouldNotThrow;
function assert(b) {
if (!b)
throw new Error("Bad assertion.");
}
setGlobalConstRedeclarationShouldNotThrow(); // Allow duplicate const declarations at the global level.
load("./global-const-redeclaration-setting/first.js");
assert(foo === 20);
let threw = false;
try {
load("./global-const-redeclaration-setting/strict.js"); // We ignore the setting and always throw an error when in strict mode!
} catch(e) {
threw = true;
}
assert(threw);
assert(foo === 20);