-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Mock generation for generic interfaces (#124)
This patch allow you to mock classes like `MyInterface<MyType>` the generated mock will have the following naming `MyInterface_MyTypeMock`
- Loading branch information
1 parent
69dd134
commit c985f01
Showing
5 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
samples/kspsample/src/commonMain/kotlin/com/careem/mockingbird/kspsample/Generics2Args.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.careem.mockingbird.kspsample | ||
|
||
import kotlin.reflect.KClass | ||
|
||
public interface Value | ||
|
||
public interface UiDelegate2Args<S : UiState, T: Value> { | ||
var s: S | ||
val t: T | ||
|
||
public fun present(uiState: S) | ||
public fun present(uiState: T) | ||
public fun remove(uiStateType: KClass<out UiState>) | ||
public fun ret(): S | ||
} |
14 changes: 14 additions & 0 deletions
14
samples/kspsample/src/commonMain/kotlin/com/careem/mockingbird/kspsample/UiDelegate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.careem.mockingbird.kspsample | ||
|
||
import kotlin.reflect.KClass | ||
|
||
public interface UiState | ||
|
||
public interface UiDelegate<S : UiState> { | ||
var s: S | ||
val t: S | ||
|
||
public fun present(uiState: S) | ||
public fun remove(uiStateType: KClass<out UiState>) | ||
public fun ret(): S | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters