unit-tests: Create a simple test runner implementation
This commit is contained in:
committed by
ilmat192
parent
77195e8e90
commit
f26e5b5f02
@@ -1950,6 +1950,11 @@ task deserialized_members(type: LinkKonanTest) {
|
||||
source = "serialization/deserialize_members.kt"
|
||||
}
|
||||
|
||||
task testing_smoke(type: RunKonanTest) {
|
||||
source = "testing/smoke.kt"
|
||||
flags = [] // TODO: Add flag to generate test-runner
|
||||
}
|
||||
|
||||
// Just check that the driver is able to produce runnable binaries.
|
||||
task driver0(type: RunDriverKonanTest) {
|
||||
goldValue = "Hello, world!\n"
|
||||
@@ -2121,3 +2126,4 @@ if (isMac()) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
import org.junit.*
|
||||
|
||||
|
||||
@Test
|
||||
fun simple() {}
|
||||
|
||||
class SimpleTestA{
|
||||
companion object {
|
||||
@BeforeClass
|
||||
fun beforeClass() {
|
||||
println("before class SimpleTestA")
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
fun afterClass() {
|
||||
println("after class SimpleTestA")
|
||||
}
|
||||
}
|
||||
@Before
|
||||
fun before() {
|
||||
println("SimpleTestA::before")
|
||||
}
|
||||
|
||||
@After
|
||||
fun after() {
|
||||
println("SimpleTestA::after")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun a() {
|
||||
println("SimpleTestA::a")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun b() {
|
||||
println("SimpleTestA::b")
|
||||
}
|
||||
}
|
||||
|
||||
class SimpleTestB{
|
||||
companion object {
|
||||
@BeforeClass
|
||||
fun beforeClass() {
|
||||
println("before class SimpleTestB")
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
fun afterClass() {
|
||||
println("after class SimpleTestB")
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
println("SimpleTestB::before")
|
||||
}
|
||||
|
||||
@After
|
||||
fun after() {
|
||||
println("SimpleTestB::after")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun a() {
|
||||
println("SimpleTestB::a")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun b() {
|
||||
println("SimpleTestB::b")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ---- This should be generated...
|
||||
private val test = {
|
||||
val objA = SimpleTestA()
|
||||
|
||||
val objB = SimpleTestB()
|
||||
|
||||
TestRunner.register(listOf(
|
||||
TestSuite(
|
||||
beforeClass = { SimpleTestA.beforeClass() },
|
||||
afterClass = { SimpleTestA.afterClass() },
|
||||
before = { objA.before() },
|
||||
after = { objA.after() },
|
||||
funcs = arrayOf({ objA.a() }, { objA.b() })),
|
||||
TestSuite(
|
||||
beforeClass = { SimpleTestB.beforeClass() },
|
||||
afterClass = { SimpleTestB.afterClass() },
|
||||
before = { objB.before() },
|
||||
after = { objB.after() },
|
||||
funcs = arrayOf({ objB.a() }, { objB.b() }))
|
||||
|
||||
))
|
||||
}()
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import kotlin.test.Test
|
||||
|
||||
class A {
|
||||
@Test
|
||||
fun test() {
|
||||
println("A.test")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun test() {
|
||||
println("test")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user