Replace hashes in bytecode listing tests with 'HASH'

This commit is contained in:
Michael Bogdanov
2016-03-24 15:53:52 +01:00
parent 2692a7d35c
commit 6547fa1d4c
4 changed files with 10 additions and 10 deletions
@@ -34,7 +34,7 @@ abstract class AbstractBytecodeListingTest : CodegenTestCase() {
val cr = ClassReader(it.asByteArray())
val visitor = TextCollectingVisitor()
cr.accept(visitor, ClassReader.SKIP_CODE)
visitor.text
KotlinTestUtils.replaceHash(visitor.text, "HASH")
}.joinToString("\n\n")
KotlinTestUtils.assertEqualsToFile(txtFile, generatedFiles)
@@ -950,10 +950,14 @@ public class KotlinTestUtils {
@NotNull
public static String replaceHashWithStar(@NotNull String string) {
return replaceHash(string, "*");
}
public static String replaceHash(@NotNull String string, @NotNull String replacement) {
//TODO: hashes are still used in SamWrapperCodegen
Matcher matcher = STRIP_PACKAGE_PART_HASH_PATTERN.matcher(string);
if (matcher.find()) {
return matcher.replaceAll("\\$*");
return matcher.replaceAll("\\$" + replacement);
}
return string;
}