Rename Before and After EACH to TEST. Otherwise they were not processed.

This commit is contained in:
Pavel Punegov
2019-01-14 17:17:54 +03:00
committed by Pavel Punegov
parent ea943b715c
commit 8c8194aa27
2 changed files with 10 additions and 10 deletions
@@ -137,8 +137,8 @@ internal class TestProcessor (val context: KonanBackendContext) {
override val runtimeKindName: Name get() = throw NotImplementedError() override val runtimeKindName: Name get() = throw NotImplementedError()
}, },
BEFORE_EACH("kotlin.test.BeforeEach", "BEFORE_EACH"), BEFORE_TEST("kotlin.test.BeforeTest", "BEFORE_TEST"),
AFTER_EACH("kotlin.test.AfterEach", "AFTER_EACH"), AFTER_TEST("kotlin.test.AfterTest", "AFTER_TEST"),
BEFORE_CLASS("kotlin.test.BeforeClass", "BEFORE_CLASS"), BEFORE_CLASS("kotlin.test.BeforeClass", "BEFORE_CLASS"),
AFTER_CLASS("kotlin.test.AfterClass", "AFTER_CLASS"); AFTER_CLASS("kotlin.test.AfterClass", "AFTER_CLASS");
@@ -146,7 +146,7 @@ internal class TestProcessor (val context: KonanBackendContext) {
open val runtimeKindName = Name.identifier(runtimeKindString) open val runtimeKindName = Name.identifier(runtimeKindString)
companion object { companion object {
val INSTANCE_KINDS = listOf(TEST, BEFORE_EACH, AFTER_EACH) val INSTANCE_KINDS = listOf(TEST, BEFORE_TEST, AFTER_TEST)
val COMPANION_KINDS = listOf(BEFORE_CLASS, AFTER_CLASS) val COMPANION_KINDS = listOf(BEFORE_CLASS, AFTER_CLASS)
} }
} }
@@ -30,8 +30,8 @@ public interface TestSuite {
} }
public enum class TestFunctionKind { public enum class TestFunctionKind {
BEFORE_EACH, BEFORE_TEST,
AFTER_EACH, AFTER_TEST,
BEFORE_CLASS, BEFORE_CLASS,
AFTER_CLASS AFTER_CLASS
} }
@@ -94,7 +94,7 @@ public abstract class BaseClassSuite<INSTANCE, COMPANION>(name: String, ignored:
open fun getCompanion(): COMPANION = throw NotImplementedError("Test class has no companion object") open fun getCompanion(): COMPANION = throw NotImplementedError("Test class has no companion object")
companion object { companion object {
val INSTANCE_KINDS = listOf(TestFunctionKind.BEFORE_EACH, TestFunctionKind.AFTER_EACH) val INSTANCE_KINDS = listOf(TestFunctionKind.BEFORE_TEST, TestFunctionKind.AFTER_TEST)
val COMPANION_KINDS = listOf(TestFunctionKind.BEFORE_CLASS, TestFunctionKind.AFTER_CLASS) val COMPANION_KINDS = listOf(TestFunctionKind.BEFORE_CLASS, TestFunctionKind.AFTER_CLASS)
} }
@@ -110,8 +110,8 @@ public abstract class BaseClassSuite<INSTANCE, COMPANION>(name: String, ignored:
return companionFunction.getOrPut(kind) { mutableSetOf() } return companionFunction.getOrPut(kind) { mutableSetOf() }
} }
val before: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.BEFORE_EACH) val before: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.BEFORE_TEST)
val after: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.AFTER_EACH) val after: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.AFTER_TEST)
val beforeClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.BEFORE_CLASS) val beforeClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.BEFORE_CLASS)
val afterClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.AFTER_CLASS) val afterClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.AFTER_CLASS)
@@ -152,8 +152,8 @@ public class TopLevelSuite(name: String): AbstractTestSuite<TopLevelFun>(name, f
private val specialFunctions = mutableMapOf<TestFunctionKind, MutableSet<TopLevelFun>>() private val specialFunctions = mutableMapOf<TestFunctionKind, MutableSet<TopLevelFun>>()
private fun getFunctions(type: TestFunctionKind) = specialFunctions.getOrPut(type) { mutableSetOf() } private fun getFunctions(type: TestFunctionKind) = specialFunctions.getOrPut(type) { mutableSetOf() }
val before: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_EACH) val before: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_TEST)
val after: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_EACH) val after: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_TEST)
val beforeClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_CLASS) val beforeClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_CLASS)
val afterClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_CLASS) val afterClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_CLASS)