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.
This commit is contained in:
Mads Ager
2022-07-28 13:27:17 +02:00
committed by Space
parent 59c2bde10a
commit e46540729c
@@ -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<ExtTestModule, ExtTestFile> {