Add tests for recent dsl improvements

This commit is contained in:
Vitaliy.Bibaev
2017-09-08 16:46:28 +03:00
parent 62e5ce1a40
commit 1f34be41b0
@@ -66,6 +66,25 @@ abstract class DslTestCase(private val directoryName: String, private val dsl: D
}
}
fun testScope() {
doTest {
scope {
call(THIS, "method")
}
}
}
fun testNestedScopes() {
doTest {
scope {
call(THIS, "method")
scope {
call(THIS, "method")
}
}
}
}
fun testIf() {
doTest {
ifBranch(+"true") {
@@ -227,6 +246,20 @@ abstract class DslTestCase(private val directoryName: String, private val dsl: D
}
}
fun testArrayDefaultDeclaration() {
doTest {
val a = array("int", "array")
declare(a.defaultDeclaration(+"10"))
}
}
fun testArrayCreateFromElements() {
doTest {
val a = array("double", "array")
declare(a, a.of(+"10.0", +"20.0"), false)
}
}
private fun doTest(init: CodeContext.() -> Unit) {
check(dsl.code(init))
}