Skip to content

Commit

Permalink
Improve test case
Browse files Browse the repository at this point in the history
As AST implementations like Roslyn directly tie a trailing line comment to the preceding node, we need to make sure that the comments on different lines are also all correctly handled.
  • Loading branch information
knutwannheden committed Sep 25, 2024
1 parent 235e63c commit a04b919
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ describe('expression statement mapping', () => {
javaScript(
//language=ts
`
1 ; // foo
2 ;`
1; // foo
// bar
/*baz*/
2;`
)
);
});
Expand Down
8 changes: 7 additions & 1 deletion openrewrite/test/javascript/parser/sourceFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ describe('source file mapping', () => {
test('whitespace after last statement', () => {
rewriteRunWithOptions(
{normalizeIndent: false},
javaScript('1 ; // comment')
javaScript(
//language=typescript
`
1; /* comment 1 */
// comment 2
`
)
);
});
});

0 comments on commit a04b919

Please sign in to comment.