JS: support @Before and @After annotations in kotlin.test

This commit is contained in:
Anton Bannykh
2017-09-01 19:56:52 +03:00
parent 8c5d18c1f2
commit f4b329a055
3 changed files with 67 additions and 13 deletions
@@ -1,13 +1,24 @@
import kotlin.test.*
var value = 5
class SimpleTest {
@Before fun beforeFun() {
value *= 2
}
@After fun afterFun() {
value /= 2
}
@Test fun testFoo() {
assertEquals(20, foo())
assertNotEquals(value, foo())
}
@Test fun testBar() {
assertEquals(10, foo())
assertEquals(value, foo())
}
@Ignore @Test fun testFooWrong() {
@@ -24,4 +24,14 @@ public annotation class Test
/**
* Marks a test or a suite as ignored/pending.
*/
public annotation class Ignore
public annotation class Ignore
/**
* Marks a function to be invoked before each test.
*/
public annotation class Before
/**
* Marks a function to be invoked after each test.
*/
public annotation class After