[Test] Align lines in TestFile with lines in real testdata file
This commit is contained in:
+11
-1
@@ -60,16 +60,26 @@ class GlobalMetadataInfoHandler(
|
||||
if (file.isAdditional) continue
|
||||
processors.forEach { it.processMetaInfos(module, file) }
|
||||
val codeMetaInfos = infosPerFile.getValue(file)
|
||||
val fileBuilder = StringBuilder()
|
||||
CodeMetaInfoRenderer.renderTagsToText(
|
||||
builder,
|
||||
fileBuilder,
|
||||
codeMetaInfos,
|
||||
testServices.sourceFileProvider.getContentOfSourceFile(file)
|
||||
)
|
||||
builder.append(fileBuilder.stripAdditionalEmptyLines(file))
|
||||
}
|
||||
}
|
||||
val actualText = builder.toString()
|
||||
testServices.assertions.assertEqualsToFile(moduleStructure.originalTestDataFiles.single(), actualText)
|
||||
}
|
||||
|
||||
private fun StringBuilder.stripAdditionalEmptyLines(file: TestFile): CharSequence {
|
||||
return if (file.startLineNumberInOriginalFile != 0) {
|
||||
this.removePrefix((1..file.startLineNumberInOriginalFile).joinToString(separator = "") { "\n" })
|
||||
} else {
|
||||
this.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val TestServices.globalMetadataInfoHandler: GlobalMetadataInfoHandler by TestServices.testServiceAccessor()
|
||||
|
||||
Reference in New Issue
Block a user