mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 19:02:13 +07:00
Add tests for recent dsl improvements
This commit is contained in:
+33
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user