ladybird/Libraries/LibJS/Tests/strict-mode-errors.js
Timothy Flynn 019c529c07 Meta: Increase the line length enforced by prettier to 120
This matches our coding style recommendation in CodingStyle.md, and
matches our python formatting.
2025-10-31 19:55:50 -04:00

15 lines
640 B
JavaScript

"use strict";
test("basic functionality", () => {
[true, false, "foo", 123, 123n, null, undefined].forEach(primitive => {
let description = `${typeof primitive} '${primitive}${typeof primitive == "bigint" ? "n" : ""}'`;
if (primitive == null) description = String(primitive);
expect(() => {
primitive.foo = "bar";
}).toThrowWithMessage(TypeError, `Cannot set property 'foo' of ${description}`);
expect(() => {
primitive[Symbol.hasInstance] = 123;
}).toThrowWithMessage(TypeError, `Cannot set property 'Symbol(Symbol.hasInstance)' of ${description}`);
});
});