JS: rename @Before to @BeforeTest and @After to @AfterTest for better JUnit compatibility
This commit is contained in:
@@ -136,10 +136,10 @@ class JSTestGenerator(val context: TranslationContext) {
|
||||
get() = annotationFinder("Ignore", "kotlin.test")
|
||||
|
||||
private val FunctionDescriptor.isBefore
|
||||
get() = annotationFinder("Before", "kotlin.test")
|
||||
get() = annotationFinder("BeforeTest", "kotlin.test")
|
||||
|
||||
private val FunctionDescriptor.isAfter
|
||||
get() = annotationFinder("After", "kotlin.test")
|
||||
get() = annotationFinder("AfterTest", "kotlin.test")
|
||||
|
||||
private fun DeclarationDescriptor.annotationFinder(shortName: String, vararg packages: String) = packages.any { packageName ->
|
||||
annotations.hasAnnotation(FqName("$packageName.$shortName"))
|
||||
|
||||
@@ -5,11 +5,11 @@ var value = 5
|
||||
|
||||
class SimpleTest {
|
||||
|
||||
@Before fun beforeFun() {
|
||||
@BeforeTest fun beforeFun() {
|
||||
value *= 2
|
||||
}
|
||||
|
||||
@After fun afterFun() {
|
||||
@AfterTest fun afterFun() {
|
||||
value /= 2
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ public annotation class Ignore
|
||||
/**
|
||||
* Marks a function to be invoked before each test.
|
||||
*/
|
||||
public annotation class Before
|
||||
public annotation class BeforeTest
|
||||
|
||||
/**
|
||||
* Marks a function to be invoked after each test.
|
||||
*/
|
||||
public annotation class After
|
||||
public annotation class AfterTest
|
||||
Reference in New Issue
Block a user