1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 06:04:59 +00:00
serenity/Libraries/LibJS/Tests/strict-mode-errors.js
2020-07-06 23:40:35 +02:00

21 lines
364 B
JavaScript

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