1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:55:08 +00:00

LibJS: Convert some top-level tests to the new system

First test conversions! These look really good :)
This commit is contained in:
Matthew Olsson 2020-07-03 14:39:25 -07:00 committed by Andreas Kling
parent 4b8a3e6d78
commit eea6041302
22 changed files with 464 additions and 451 deletions

View file

@ -1,14 +1,39 @@
load("test-common.js");
describe("basic switch tests", () => {
test("string case does not match number target", () => {
switch (1 + 2) {
case '3':
expect().fail();
case 3:
return;
case 5:
case 1:
break;
default:
break;
}
switch (1 + 2) {
case '3':
assertNotReached();
case 3:
console.log("PASS");
break;
case 5:
case 1:
break;
default:
break;
}
expect().fail();
});
test("string concatenation in target", () => {
var a = "foo";
switch (a + "bar") {
case 1:
expect().fail();
case "foobar":
case 2:
return;
}
expect().fail();
});
test("default", () => {
switch (100) {
default:
return;
}
expect().fail();
});
});