-
-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix back VM resolution on root scope only, add scope logs
- Loading branch information
1 parent
eb6a982
commit 35f0e8a
Showing
4 changed files
with
39 additions
and
28 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
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
34 changes: 34 additions & 0 deletions
34
projects/core/koin-core/src/commonTest/kotlin/org/koin/core/ScopeInfoTest.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,34 @@ | ||
package org.koin.core | ||
|
||
import org.koin.Simple | ||
import org.koin.core.logger.Level | ||
import org.koin.core.module.dsl.scopedOf | ||
import org.koin.core.parameter.parametersOf | ||
import org.koin.dsl.koinApplication | ||
import org.koin.dsl.module | ||
import kotlin.test.Test | ||
|
||
class ScopeInfoTest { | ||
|
||
@Test | ||
fun resolve_via_a_scope(){ | ||
|
||
val koin = koinApplication { | ||
printLogger(Level.DEBUG) | ||
modules( | ||
module { | ||
factory { Simple.ComponentC(get()) } | ||
single { Simple.ComponentA() } | ||
scope<Simple.ComponentA> { | ||
scopedOf(Simple::ComponentB) | ||
} | ||
} | ||
) | ||
}.koin | ||
|
||
val a = koin.get<Simple.ComponentA>() | ||
val scope = koin.createScope<Simple.ComponentA>("_a_",a) | ||
val b = scope.get<Simple.ComponentB>() | ||
scope.get<Simple.ComponentC> { parametersOf(b) } | ||
} | ||
} |