You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cf23f8f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: test/unitCases/syntax-printer.unittest.js
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -266,6 +266,11 @@ const IMPROVED_CASES = [
266
266
`(() => { let a = console.log.name; console.log(a, a); })(); (() => { ${TRY} console.log(2); })();`,
267
267
{compress: {passes: 2},mangle: true}
268
268
],
269
+
[
270
+
"a conditional whose other branch is its test, or ends as its other branch",
271
+
"function f(a, b, c) { var r = []; return [a ? b : a, a ? (r.push(1), c) : c, a ? (r.push(2), r.push(3), c) : c, r.join()]; } console.log(f(0, 1, 2), f(3, 4, 5));",
// of its function's own, or the call passes, keeps or constructs something.
573
578
/** @type {[string, string][]} */
574
579
constKEPT_CASES=[
580
+
["a conditional whose other branch reads a getter twice or a different binding","var n = 0, o = { get x() { return ++n; } }; function f(b) { var a = 1; { let a = 0; var r = a ? b : o.x ? b : o.x; } return [r, a, n]; } console.log(f(2));"],
575
581
["a bigint and a number concatenated, which throws","try { console.log(1n + 2); } catch (e) { console.log(e.name); }"],
576
582
["an array literal joining to a string longer than it",'console.log([!0, !0, !0] + "");'],
577
583
["`+` and `~` of what a literal does not give","function f(a) { return [+[a], ~a !== 0 ? 1 : 2]; } console.log(f(1), f(1n));"],
0 commit comments