mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
LibJS: Convert remaining top-level tests to new system
This commit is contained in:
parent
6d58c48c2f
commit
918f4affd5
19 changed files with 518 additions and 497 deletions
|
@ -1,54 +1,25 @@
|
|||
load("test-common.js");
|
||||
const message = "oops, Value::to_number() failed";
|
||||
|
||||
try {
|
||||
const message = "oops, Value::to_number() failed";
|
||||
const o = {
|
||||
toString() {
|
||||
throw new Error(message);
|
||||
},
|
||||
};
|
||||
const o = {
|
||||
toString() {
|
||||
throw new Error(message);
|
||||
},
|
||||
};
|
||||
|
||||
assertThrowsError(
|
||||
() => {
|
||||
+o;
|
||||
},
|
||||
{
|
||||
error: Error,
|
||||
message,
|
||||
}
|
||||
);
|
||||
test("basic functionality", () => {
|
||||
expect(() => {
|
||||
+o;
|
||||
}).toThrowWithMessage(Error, message);
|
||||
|
||||
assertThrowsError(
|
||||
() => {
|
||||
o - 1;
|
||||
},
|
||||
{
|
||||
error: Error,
|
||||
message,
|
||||
}
|
||||
);
|
||||
expect(() => {
|
||||
o - 1;
|
||||
}).toThrowWithMessage(Error, message);
|
||||
|
||||
assertThrowsError(
|
||||
() => {
|
||||
"foo".charAt(o);
|
||||
},
|
||||
{
|
||||
error: Error,
|
||||
message,
|
||||
}
|
||||
);
|
||||
expect(() => {
|
||||
"foo".charAt(o);
|
||||
}).toThrowWithMessage(Error, message);
|
||||
|
||||
assertThrowsError(
|
||||
() => {
|
||||
"bar".repeat(o);
|
||||
},
|
||||
{
|
||||
error: Error,
|
||||
message,
|
||||
}
|
||||
);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
||||
expect(() => {
|
||||
"bar".repeat(o);
|
||||
}).toThrowWithMessage(Error, message);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue