fix corner cases in strings & templates (#5147)

fixes #5145
This commit is contained in:
Alex Lam S.L
2021-10-16 11:02:23 +01:00
committed by GitHub
parent faf0190546
commit 03aec89f60
3 changed files with 84 additions and 10 deletions

View File

@@ -699,3 +699,47 @@ issue_5136: {
expect_stdout: "42"
node_version: ">=4"
}
issue_5145_1: {
options = {
strings: true,
templates: true,
}
input: {
var a = [];
console.log(`${a}${a[0] = 42}
`);
}
expect: {
var a = [];
console.log(`${a}${a[0] = 42}
`);
}
expect_stdout: [
"42",
"",
]
node_version: ">=4"
}
issue_5145_2: {
options = {
strings: true,
templates: true,
}
input: {
var a = [];
console.log(`${a}${a}${a[0] = 42}
`);
}
expect: {
var a = [];
console.log("" + a + a + (a[0] = 42) + `
`);
}
expect_stdout: [
"42",
"",
]
node_version: ">=4"
}