mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
69
Libraries/LibJS/Tests/syntax/switch-as-statement.js
Normal file
69
Libraries/LibJS/Tests/syntax/switch-as-statement.js
Normal file
|
@ -0,0 +1,69 @@
|
|||
describe("switch statement is a valid statement and gets executed", () => {
|
||||
test("switch statement in a block", () => {
|
||||
let hit = false;
|
||||
{
|
||||
switch (true) {
|
||||
case true:
|
||||
hit = true;
|
||||
}
|
||||
expect(hit).toBeTrue();
|
||||
}
|
||||
});
|
||||
|
||||
test("switch statement in an if statement when true", () => {
|
||||
let hit = false;
|
||||
var a = true;
|
||||
if (a)
|
||||
switch (true) {
|
||||
case true:
|
||||
hit = true;
|
||||
}
|
||||
else
|
||||
switch (true) {
|
||||
case true:
|
||||
expect().fail();
|
||||
}
|
||||
|
||||
expect(hit).toBeTrue();
|
||||
});
|
||||
|
||||
test("switch statement in an if statement when false", () => {
|
||||
let hit = false;
|
||||
var a = false;
|
||||
if (a)
|
||||
switch (a) {
|
||||
default:
|
||||
expect().fail();
|
||||
}
|
||||
else
|
||||
switch (a) {
|
||||
default:
|
||||
hit = true;
|
||||
}
|
||||
|
||||
expect(hit).toBeTrue();
|
||||
});
|
||||
|
||||
test("switch statement in an while statement", () => {
|
||||
var a = 0;
|
||||
var loops = 0;
|
||||
while (a < 1 && loops++ < 5)
|
||||
switch (a) {
|
||||
case 0:
|
||||
a = 1;
|
||||
}
|
||||
|
||||
expect(a).toBe(1);
|
||||
});
|
||||
|
||||
test("switch statement in an for statement", () => {
|
||||
var loops = 0;
|
||||
for (let a = 0; a < 1 && loops++ < 5; )
|
||||
switch (a) {
|
||||
case 0:
|
||||
a = 1;
|
||||
}
|
||||
|
||||
expect(loops).toBe(1);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue