1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:55:08 +00:00

LibJS: Throw in strict mode when assigning property to primitive value

This commit is contained in:
Linus Groh 2020-05-28 17:48:25 +01:00 committed by Andreas Kling
parent 5f2632f121
commit 8ff4587f65
3 changed files with 25 additions and 5 deletions

View file

@ -0,0 +1,18 @@
"use strict";
load("test-common.js")
try {
[true, false, "foo", 123].forEach(primitive => {
assertThrowsError(() => {
primitive.foo = "bar";
}, {
error: TypeError,
message: "Can't assign property foo to primitive value"
});
});
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}