enhance conditionals (#5575)

This commit is contained in:
Alex Lam S.L
2022-07-25 18:49:45 +01:00
committed by GitHub
parent fc7678c115
commit 996836b67e
2 changed files with 115 additions and 4 deletions

View File

@@ -278,6 +278,96 @@ merge_tail_2: {
]
}
merge_tail_sequence_1: {
options = {
conditionals: true,
}
input: {
function f(a) {
var b = "foo";
if (a) {
while (console.log("bar"));
console.log(b);
} else {
c = "baz";
while (console.log(c));
console.log("bar"),
console.log(b);
var c;
}
}
f();
f(42);
}
expect: {
function f(a) {
var b = "foo";
if (a)
while (console.log("bar"));
else {
c = "baz";
while (console.log(c));
console.log("bar");
var c;
}
console.log(b);
}
f();
f(42);
}
expect_stdout: [
"baz",
"bar",
"foo",
"bar",
"foo",
]
}
merge_tail_sequence_2: {
options = {
conditionals: true,
}
input: {
function f(a) {
var b = "foo";
if (a) {
console.log("bar");
console.log(b);
} else {
c = "baz";
while (console.log(c));
console.log("bar"),
console.log(b);
var c;
}
}
f();
f(42);
}
expect: {
function f(a) {
var b = "foo";
if (!a) {
c = "baz";
while (console.log(c));
var c;
}
console.log("bar");
console.log(b);
}
f();
f(42);
}
expect_stdout: [
"baz",
"bar",
"foo",
"bar",
"foo",
]
}
cond_1: {
options = {
conditionals: true,