From e46540729c037b304a69ce4f9d4de1641e1a2ad6 Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Thu, 28 Jul 2022 13:27:17 +0200 Subject: [PATCH] Fix equality for generated test files. They were compared based on the name of the file only disregarding the module. Therefore, the test framework would only patch package declarations for one file with a given name even if there were multiple files with that name in different packages. --- .../support/group/ExtTestCaseGroupProvider.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt index 442a2a91e20..c82c04e747e 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt @@ -756,8 +756,12 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te module.files += this } - override fun equals(other: Any?) = (other as? ExtTestFile)?.name == name - override fun hashCode() = name.hashCode() + override fun equals(other: Any?): Boolean { + if (other !is ExtTestFile) return false + return other.name == name && other.module == module + } + + override fun hashCode() = name.hashCode() * 31 + module.hashCode() } private class ExtTestFileFactory : TestFiles.TestFileFactory {