Skip to content

Commit

Permalink
Add unit test for collapse properties issue
Browse files Browse the repository at this point in the history
TS 5.2 starts outputing code in a shape that causes a bad property collapse.

PiperOrigin-RevId: 563648863
  • Loading branch information
brad4d authored and copybara-github committed Sep 8, 2023
1 parent dc5ed73 commit aa0b0f4
Showing 1 changed file with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,49 @@ public void setUp() throws Exception {
disableCompareJsDoc();
}

@Test
public void testTs52OutputChange() {
test(
srcs(
lines(
"", //
"var alias;",
"var module$exports$C = class {",
" method1() {",
" return alias.staticPropOnC;",
" }",
" method2() {",
" return alias.staticPropOnAlias;",
" }",
"}",
"alias = module$exports$C;",
"(() => {",
" alias.staticPropOnAlias = 1",
"})();",
"module$exports$C.staticPropOnC = 2;",
"")),
expected(
lines(
"", //
"var alias;",
"var module$exports$C = class {",
" method1() {",
" return alias.staticPropOnC;",
" }",
" method2() {",
" return alias.staticPropOnAlias;",
" }",
"}",
"alias = module$exports$C;",
"(() => {",
" alias.staticPropOnAlias = 1",
"})();",
// TODO : b/299055739 - bad collapse
"var module$exports$C$staticPropOnC = 2;",
"",
"")));
}

@Test
public void testDoNotCollapseDeletedProperty() {
testSame(
Expand Down

0 comments on commit aa0b0f4

Please sign in to comment.