Extract stub library file from "Redundant async" inspection tests

This commit is contained in:
Mikhail Glukhikh
2018-11-28 13:52:29 +03:00
parent 4e1d8fcfd0
commit 6b60d49e09
10 changed files with 52 additions and 328 deletions
@@ -0,0 +1,44 @@
package kotlinx.coroutines
interface Deferred<T> {
suspend fun await(): T
}
interface CoroutineContext
object DefaultDispatcher : CoroutineContext
enum class CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED
}
interface Job
fun <T> async(
context: CoroutineContext = DefaultDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
parent: Job? = null,
f: suspend () -> T
): Deferred<T> {
TODO()
}
fun <T> runBlocking(
context: CoroutineContext = DefaultDispatcher,
f: suspend () -> T
) {
TODO()
}
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
f: suspend () -> T
) {
TODO()
}
@@ -3,47 +3,6 @@
package kotlinx.coroutines
interface Deferred<T> {
suspend fun await(): T
}
interface CoroutineContext
object DefaultDispatcher : CoroutineContext
enum class CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED
}
interface Job
fun <T> async(
context: CoroutineContext = DefaultDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
parent: Job? = null,
f: suspend () -> T
): Deferred<T> {
TODO()
}
fun <T> runBlocking(
context: CoroutineContext = DefaultDispatcher,
f: suspend () -> T
) {
TODO()
}
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
f: suspend () -> T
) {
TODO()
}
suspend fun test(ctx: CoroutineContext) {
<caret>async(ctx) { 42 }.await()
}
@@ -3,47 +3,6 @@
package kotlinx.coroutines
interface Deferred<T> {
suspend fun await(): T
}
interface CoroutineContext
object DefaultDispatcher : CoroutineContext
enum class CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED
}
interface Job
fun <T> async(
context: CoroutineContext = DefaultDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
parent: Job? = null,
f: suspend () -> T
): Deferred<T> {
TODO()
}
fun <T> runBlocking(
context: CoroutineContext = DefaultDispatcher,
f: suspend () -> T
) {
TODO()
}
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
f: suspend () -> T
) {
TODO()
}
suspend fun test(ctx: CoroutineContext) {
withContext(ctx) { 42 }
}
@@ -3,47 +3,6 @@
package kotlinx.coroutines
interface Deferred<T> {
suspend fun await(): T
}
interface CoroutineContext
object DefaultDispatcher : CoroutineContext
enum class CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED
}
interface Job
fun <T> async(
context: CoroutineContext = DefaultDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
parent: Job? = null,
f: suspend () -> T
): Deferred<T> {
TODO()
}
fun <T> runBlocking(
context: CoroutineContext = DefaultDispatcher,
f: suspend () -> T
) {
TODO()
}
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
f: suspend () -> T
) {
TODO()
}
suspend fun test() {
<caret>async { 42 }.await()
}
@@ -3,47 +3,6 @@
package kotlinx.coroutines
interface Deferred<T> {
suspend fun await(): T
}
interface CoroutineContext
object DefaultDispatcher : CoroutineContext
enum class CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED
}
interface Job
fun <T> async(
context: CoroutineContext = DefaultDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
parent: Job? = null,
f: suspend () -> T
): Deferred<T> {
TODO()
}
fun <T> runBlocking(
context: CoroutineContext = DefaultDispatcher,
f: suspend () -> T
) {
TODO()
}
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
f: suspend () -> T
) {
TODO()
}
suspend fun test() {
withContext(DefaultDispatcher) { 42 }
}
@@ -3,47 +3,6 @@
package kotlinx.coroutines
interface Deferred<T> {
suspend fun await(): T
}
interface CoroutineContext
object DefaultDispatcher : CoroutineContext
enum class CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED
}
interface Job
fun <T> async(
context: CoroutineContext = DefaultDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
parent: Job? = null,
f: suspend () -> T
): Deferred<T> {
TODO()
}
fun <T> runBlocking(
context: CoroutineContext = DefaultDispatcher,
f: suspend () -> T
) {
TODO()
}
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
f: suspend () -> T
) {
TODO()
}
suspend fun test(ctx: CoroutineContext) {
<caret>async(parent = null) { 42 }.await()
}
@@ -2,47 +2,6 @@
package kotlinx.coroutines
interface Deferred<T> {
suspend fun await(): T
}
interface CoroutineContext
object DefaultDispatcher : CoroutineContext
enum class CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED
}
interface Job
fun <T> async(
context: CoroutineContext = DefaultDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
parent: Job? = null,
f: suspend () -> T
): Deferred<T> {
TODO()
}
fun <T> runBlocking(
context: CoroutineContext = DefaultDispatcher,
f: suspend () -> T
) {
TODO()
}
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
f: suspend () -> T
) {
TODO()
}
suspend fun test(ctx: CoroutineContext) {
<caret>async(ctx, CoroutineStart.LAZY) { 42 }.await()
}
@@ -2,47 +2,6 @@
package kotlinx.coroutines
interface Deferred<T> {
suspend fun await(): T
}
interface CoroutineContext
object DefaultDispatcher : CoroutineContext
enum class CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED
}
interface Job
fun <T> async(
context: CoroutineContext = DefaultDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
parent: Job? = null,
f: suspend () -> T
): Deferred<T> {
TODO()
}
fun <T> runBlocking(
context: CoroutineContext = DefaultDispatcher,
f: suspend () -> T
) {
TODO()
}
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
f: suspend () -> T
) {
TODO()
}
suspend fun test(ctx: CoroutineContext) {
withContext(ctx, CoroutineStart.LAZY) { 42 }
}
@@ -3,47 +3,6 @@
package kotlinx.coroutines
interface Deferred<T> {
suspend fun await(): T
}
interface CoroutineContext
object DefaultDispatcher : CoroutineContext
enum class CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED
}
interface Job
fun <T> async(
context: CoroutineContext = DefaultDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
parent: Job? = null,
f: suspend () -> T
): Deferred<T> {
TODO()
}
fun <T> runBlocking(
context: CoroutineContext = DefaultDispatcher,
f: suspend () -> T
) {
TODO()
}
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
f: suspend () -> T
) {
TODO()
}
suspend fun test(ctx: CoroutineContext) {
<caret>async(start = CoroutineStart.LAZY) { 42 }.await()
}
@@ -114,6 +114,14 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa
}
break
}
val parentFile = mainFile.parentFile
if (parentFile != null) {
for (file in parentFile.walkTopDown().maxDepth(1)) {
if (file.name.endsWith(".lib.kt")) {
extraFileNames += file.name
}
}
}
myFixture.configureByFiles(*(listOf(mainFile.name) + extraFileNames).toTypedArray()).first()