mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
25 lines
494 B
JavaScript
25 lines
494 B
JavaScript
const message = "oops, Value::to_number() failed";
|
|
|
|
const o = {
|
|
toString() {
|
|
throw new Error(message);
|
|
},
|
|
};
|
|
|
|
test("basic functionality", () => {
|
|
expect(() => {
|
|
+o;
|
|
}).toThrowWithMessage(Error, message);
|
|
|
|
expect(() => {
|
|
o - 1;
|
|
}).toThrowWithMessage(Error, message);
|
|
|
|
expect(() => {
|
|
"foo".charAt(o);
|
|
}).toThrowWithMessage(Error, message);
|
|
|
|
expect(() => {
|
|
"bar".repeat(o);
|
|
}).toThrowWithMessage(Error, message);
|
|
});
|