1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 03:15:07 +00:00
serenity/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js

26 lines
617 B
JavaScript

try {
try {
Math.abs(-20) = 40;
} catch (e) {
assert(e.name === "ReferenceError");
assert(e.message === "Invalid left-hand side in assignment");
}
try {
512 = 256;
} catch (e) {
assert(e.name === "ReferenceError");
assert(e.message === "Invalid left-hand side in assignment");
}
try {
"hello world" = "another thing?";
} catch (e) {
assert(e.name === "ReferenceError");
assert(e.message === "Invalid left-hand side in assignment");
}
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}