mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-31 21:30:58 +00:00
39 lines
640 B
JavaScript
39 lines
640 B
JavaScript
|
|
load("test-common.js");
|
||
|
|
|
||
|
|
try {
|
||
|
|
const message = "oops, Value::to_number() failed";
|
||
|
|
const o = { toString() { throw new Error(message); } };
|
||
|
|
|
||
|
|
assertThrowsError(() => {
|
||
|
|
+o;
|
||
|
|
}, {
|
||
|
|
error: Error,
|
||
|
|
message
|
||
|
|
});
|
||
|
|
|
||
|
|
assertThrowsError(() => {
|
||
|
|
o - 1;
|
||
|
|
}, {
|
||
|
|
error: Error,
|
||
|
|
message
|
||
|
|
});
|
||
|
|
|
||
|
|
assertThrowsError(() => {
|
||
|
|
"foo".charAt(o);
|
||
|
|
}, {
|
||
|
|
error: Error,
|
||
|
|
message
|
||
|
|
});
|
||
|
|
|
||
|
|
assertThrowsError(() => {
|
||
|
|
"bar".repeat(o);
|
||
|
|
}, {
|
||
|
|
error: Error,
|
||
|
|
message
|
||
|
|
});
|
||
|
|
|
||
|
|
console.log("PASS");
|
||
|
|
} catch (e) {
|
||
|
|
console.log("FAIL: " + e);
|
||
|
|
}
|