JS: support @Before and @After annotations in kotlin.test
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user