File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
tests/konsist/src/test/kotlin/io/element/android/tests/konsist Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ test_arch_core = "androidx.arch.core:core-testing:2.2.0"
139139test_junit = " junit:junit:4.13.2"
140140test_runner = " androidx.test:runner:1.6.2"
141141test_mockk = " io.mockk:mockk:1.13.12"
142- test_konsist = " com.lemonappdev:konsist:0.15 .1"
142+ test_konsist = " com.lemonappdev:konsist:0.16 .1"
143143test_turbine = " app.cash.turbine:turbine:1.1.0"
144144test_truth = " com.google.truth:truth:1.4.4"
145145test_parameter_injector = " com.google.testparameterinjector:test-parameter-injector:1.17"
Original file line number Diff line number Diff line change @@ -82,7 +82,15 @@ class KonsistArchitectureTest {
8282 return @all if (type.startsWith(" @" ) || type.startsWith(" (" ) || type.startsWith(" suspend" )) {
8383 true
8484 } else {
85- val fullyQualifiedName = param.type.declaration.packagee?.fullyQualifiedName + " ." + type
85+ var typePackage = param.type.declaration.packagee?.name
86+ if (typePackage == type) {
87+ // Workaround, now that packagee.fullyQualifiedName is not available anymore
88+ // It seems that when the type in in the same package as the function,
89+ // the package is equal to the type (which is wrong).
90+ // So in this case, use the package of the function
91+ typePackage = it.packagee?.name
92+ }
93+ val fullyQualifiedName = " $typePackage .$type "
8694 fullyQualifiedName !in forbiddenInterfacesForComposableParameter
8795 }
8896 }
Original file line number Diff line number Diff line change @@ -74,7 +74,14 @@ class KonsistClassNameTest {
7474 .replace(" FakeRust" , " " )
7575 .replace(" Fake" , " " )
7676 (it.name.startsWith(" Fake" ) || it.name.startsWith(" FakeRust" )) &&
77- it.parents().any { parent -> parent.name.replace(" ." , " " ) == interfaceName }
77+ it.parents().any { parent ->
78+ // Workaround to get the parent name. For instance:
79+ // parent.name used to return `UserListPresenter.Factory` but is now returning `Factory`.
80+ // So we need to retrieve the name of the parent class differently.
81+ val packageName = parent.packagee!! .name
82+ val parentName = parent.fullyQualifiedName!! .substringAfter(" $packageName ." ).replace(" ." , " " )
83+ parentName == interfaceName
84+ }
7885 }
7986 }
8087
You can’t perform that action at this time.
0 commit comments