Skip to content

Commit 516de78

Browse files
Add a testcase
1 parent d086cc0 commit 516de78

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/testRunner/unittests/comments.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe("comment parsing", () => {
1111
const withTrailing = `;/* comment */
1212
// another one
1313
`;
14+
const endingInHyphen = "/**comment-*/";
1415
it("skips shebang", () => {
1516
const result = ts.getLeadingCommentRanges(withShebang, 0);
1617
assert.isDefined(result);
@@ -29,4 +30,16 @@ describe("comment parsing", () => {
2930
assert.strictEqual(result.length, 1);
3031
assert.strictEqual(result[0].kind, ts.SyntaxKind.SingleLineCommentTrivia);
3132
});
33+
34+
it("parses /** block comments ending in hyphen", () => {
35+
const sourceFile = ts.createSourceFile(
36+
"file.ts",
37+
`${endingInHyphen}\nconst x = 1;`,
38+
ts.ScriptTarget.ESNext,
39+
true,
40+
);
41+
42+
assert.strictEqual(sourceFile.parseDiagnostics.length, 0);
43+
assert.strictEqual(sourceFile.statements.length, 1);
44+
});
3245
});

0 commit comments

Comments
 (0)