support ExtendScript parser quirks (#5648)

closes #1144
This commit is contained in:
Alex Lam S.L
2022-09-06 19:28:34 +01:00
committed by GitHub
parent 318206d41d
commit 32bd65a87f
3 changed files with 68 additions and 1 deletions

View File

@@ -1176,6 +1176,52 @@ trivial_boolean_ternary_expressions : {
}
}
extendscript_1: {
beautify = {
extendscript: true,
}
input: {
var alert = console.log;
function f(a, b) {
return a ? b ? "foo" : "bar" : "baz";
}
alert(f());
alert(f(42));
alert(f(null, true));
alert(f([], {}));
}
expect_exact: 'var alert=console.log;function f(a,b){return a?(b?"foo":"bar"):"baz"}alert(f());alert(f(42));alert(f(null,true));alert(f([],{}));'
expect_stdout: [
"baz",
"bar",
"baz",
"foo",
]
}
extendscript_2: {
beautify = {
extendscript: true,
}
input: {
var alert = console.log;
function f(a, b) {
return a ? "foo" : b ? "bar" : "baz";
}
alert(f());
alert(f(42));
alert(f(null, true));
alert(f([], {}));
}
expect_exact: 'var alert=console.log;function f(a,b){return a?"foo":(b?"bar":"baz")}alert(f());alert(f(42));alert(f(null,true));alert(f([],{}));'
expect_stdout: [
"baz",
"foo",
"bar",
"foo",
]
}
issue_1154: {
options = {
booleans: true,