Skip to content

Commit bef0345

Browse files
concavelenzcopybara-github
authored andcommitted
Add ExpressionDecomposerTest cases
In particular test a double-hook expression, which is what optional chains will be rewritten to be. PiperOrigin-RevId: 321681988
1 parent d60b05f commit bef0345

File tree

1 file changed

+2
-36
lines changed

1 file changed

+2
-36
lines changed

test/com/google/javascript/jscomp/ExpressionDecomposerTest.java

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242
/**
4343
* Unit tests for {@link ExpressionDecomposer}
44+
*
45+
* @author [email protected] (John Lenz)
4446
*/
4547
// Note: functions "foo" and "goo" are external functions in the helper.
4648
@RunWith(JUnit4.class)
@@ -628,42 +630,6 @@ public void testExposeExpression6() {
628630
"if (goo()) foo();");
629631
}
630632

631-
@Test
632-
public void testExposeDoubleAndExpression() {
633-
helperExposeExpression(
634-
"a = boo() && goo() && foo()",
635-
"foo",
636-
lines(
637-
"var temp$jscomp$0;",
638-
"if (temp$jscomp$0 = boo() && goo()) {",
639-
" temp$jscomp$0 = foo();",
640-
"}",
641-
"a = temp$jscomp$0;",
642-
""));
643-
}
644-
645-
@Test
646-
public void testExposeDoubleHookExpression() {
647-
helperExposeExpression(
648-
"a = boo() ? void 0 : goo() ? void 0 : foo()",
649-
"foo",
650-
lines(
651-
"var temp$jscomp$0;",
652-
"if (boo()) {",
653-
" temp$jscomp$0 = void 0;",
654-
"} else {",
655-
" var temp$jscomp$1;",
656-
" if (goo()) {",
657-
" temp$jscomp$1 = void 0;",
658-
" } else {",
659-
" temp$jscomp$1 = foo();",
660-
" }",
661-
" temp$jscomp$0 = temp$jscomp$1;",
662-
"}",
663-
"a = temp$jscomp$0;",
664-
""));
665-
}
666-
667633
@Test
668634
public void exposeExpressionNullishCoalesceNoResult() {
669635
helperExposeExpression(

0 commit comments

Comments
 (0)