Skip to content

Commit

Permalink
Clean up and test for function definition
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgiuliani committed Jul 10, 2024
1 parent c4939fe commit 9260207
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.koin.sample.android.library.CommonRepository
import org.koin.sample.android.library.MyScope
import org.koin.sample.androidx.app.ScopedStuff
import org.koin.sample.androidx.data.DataConsumer
import org.koin.sample.androidx.data.MyDataConsumer
import org.koin.sample.androidx.di.AppModule
import org.koin.sample.androidx.di.DataModule
import org.koin.sample.androidx.repository.RepositoryModule
Expand All @@ -33,6 +34,7 @@ class AndroidModuleTest {
scope.get<ScopedStuff>()

assert(koin.getOrNull<DataConsumer>() != null)
assert(koin.getOrNull<MyDataConsumer>() != null)

stopKoin()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ package org.koin.sample.androidx.data
import org.koin.core.annotation.Factory

@Factory
class DataConsumer
class DataConsumer

class MyDataConsumer(val dc : DataConsumer)

@Factory
fun funDataConsumer(dc : DataConsumer) = MyDataConsumer(dc)
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private fun OutputStream.writeExternalDefinitionFunction(
ctor: String,
binds: String
) {
appendText("@Definition(\"${def.packageName}\")\n")
appendText("\n@Definition(\"${def.packageName}\")\n")
appendText("fun Module.$DEFINE_PREFIX${def.label}() = ${def.keyword.keyword}($qualifier$createAtStart) { ${param}${label()}$ctor } $binds")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fun OutputStream.generateDefaultModuleHeader(definitions: List<KoinMetaData.Defi
}

fun OutputStream.generateDefaultModuleFunction() {
appendText("\n")
appendText("\n\n")
appendText(DEFAULT_MODULE_FUNCTION)
}

Expand Down

0 comments on commit 9260207

Please sign in to comment.