ladybird/Libraries/LibJS/Tests/strict-mode-errors.js
Matthew Olsson 78155a6668 LibJS: Consolidate error messages into ErrorTypes.h
Now, exceptions can be thrown with
interpreter.throw_exception<T>(ErrorType:TYPE, "format", "args",
"here").
2020-06-11 07:46:20 +02:00

18 lines
372 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);
}