JS: rename @Before to @BeforeTest and @After to @AfterTest for better JUnit compatibility

This commit is contained in:
Anton Bannykh
2017-10-10 16:39:39 +03:00
parent bd75a47a07
commit c57b0b4cbc
3 changed files with 6 additions and 6 deletions
@@ -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