Skip to content

Commit

Permalink
Replace FlowAssert with Turbine (#1863)
Browse files Browse the repository at this point in the history
Same code, separate project!
  • Loading branch information
JakeWharton committed Aug 4, 2020
1 parent dcdb71a commit 03c2ecd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 140 deletions.
13 changes: 13 additions & 0 deletions extensions/coroutines-extensions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ kotlin {
implementation deps.kotlin.test.common
implementation deps.kotlin.test.commonAnnotations
implementation deps.stately.collections
implementation deps.turbine
}
}
jvmMain {
Expand Down Expand Up @@ -54,6 +55,11 @@ kotlin {
nativeTest {
dependencies {
implementation project(':drivers:native-driver')
implementation(deps.kotlin.coroutines.native) {
version {
strictly("${versions.kotlinCoroutines}-native-mt")
}
}
}
}
}
Expand Down Expand Up @@ -85,6 +91,13 @@ kotlin {
kotlinOptions.freeCompilerArgs += ['-linker-options', '-lsqlite3']
}
}

sourceSets.matching { it.name.endsWith("Test") }.all {
it.languageSettings {
useExperimentalAnnotation('kotlin.time.ExperimentalTime')
useExperimentalAnnotation('kotlinx.coroutines.ExperimentalCoroutinesApi')
}
}
}

apply from: "$rootDir/gradle/gradle-mvn-push.gradle"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.squareup.sqldelight.runtime.coroutines

import app.cash.turbine.test
import com.squareup.sqldelight.Query
import com.squareup.sqldelight.internal.copyOnWriteList
import com.squareup.sqldelight.runtime.coroutines.Employee.Companion.MAPPER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.squareup.sqldelight.runtime.coroutines

import app.cash.turbine.test
import com.squareup.sqldelight.runtime.coroutines.Employee.Companion.MAPPER
import com.squareup.sqldelight.runtime.coroutines.Employee.Companion.SELECT_EMPLOYEES
import com.squareup.sqldelight.runtime.coroutines.Employee.Companion.USERNAME
Expand All @@ -9,6 +10,7 @@ import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlinx.coroutines.flow.zip
import kotlinx.coroutines.yield

class QueryAsFlowTest {
private lateinit var db: TestDb
Expand Down Expand Up @@ -70,7 +72,8 @@ class QueryAsFlowTest {
cancel()

db.employee(Employee("john", "John Johnson"))
expectNoMoreEvents()
yield() // Ensure any events can be delivered.
expectNoEvents()
}
}

Expand Down
1 change: 1 addition & 0 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ ext.deps = [
kotlinPoet: 'com.squareup:kotlinpoet:1.5.0',
junit: 'junit:junit:4.12',
truth: 'com.google.truth:truth:0.42',
turbine: 'app.cash.turbine:turbine:0.1.0',
bugsnag: 'com.bugsnag:bugsnag:2.0.0',
intellijCore: fileTree(dir: "$rootDir/lib/intellij-core/lib", include: [
'idea.jar', 'openapi.jar', 'util.jar', 'trove4j.jar', 'extensions.jar',
Expand Down

0 comments on commit 03c2ecd

Please sign in to comment.