Ensure comments before // @Filename are not part of the following virtual test file (#57579)

This commit is contained in:
Andrew Branch
2024-02-28 13:40:10 -08:00
committed by GitHub
parent 63dd17baef
commit cfbb15f0c1
239 changed files with 875 additions and 1419 deletions

View File

@@ -1232,6 +1232,10 @@ export namespace TestCaseParser {
else {
// First metadata marker in the file
currentFileName = testMetaData[2].trim();
if (currentFileContent && ts.skipTrivia(currentFileContent, 0, /*stopAfterLineBreak*/ false, /*stopAtComments*/ false) !== currentFileContent.length) {
throw new Error("Non-comment test content appears before the first '// @Filename' directive");
}
currentFileContent = "";
}
}
else {