ladybird/Userland/Libraries/LibJS/Tests/loops/do-while-basic.js
2021-01-12 12:17:46 +01:00

24 lines
488 B
JavaScript

test("basic functionality", () => {
let number = 0;
do {
number++;
} while (number < 9);
expect(number).toBe(9);
});
test("no braces", () => {
let number = 0;
do number++;
while (number < 3);
expect(number).toBe(3);
});
test("exception in test expression", () => {
expect(() => {
do {} while (foo);
}).toThrow(ReferenceError);
});
test("automatic semicolon insertion", () => {
expect("do {} while (false) foo").toEval();
});