Add tests for arrays variables in the dsl

This commit is contained in:
Vitaliy.Bibaev
2017-09-06 19:30:42 +03:00
parent 61cebec550
commit e35d99fa98
4 changed files with 27 additions and 0 deletions
@@ -172,6 +172,28 @@ abstract class DslTestCase(private val directoryName: String, private val dsl: D
}
}
fun testArrayDeclaration() {
doTest {
declare(array("int", "a"), false)
}
}
fun testArrayElementUsage() {
doTest {
val array = array("int", "a")
+array[10]
+array[+"11"]
}
}
fun testArrayElementAssignment() {
doTest {
val array = array("int", "a")
+(array.set(0, +"1"))
+(array.set(1, +"2"))
}
}
private fun doTest(init: CodeContext.() -> Unit) {
check(dsl.code(init))
}
@@ -0,0 +1 @@
final int[] a;
@@ -0,0 +1,2 @@
a[0] = 1;
a[1] = 2;
@@ -0,0 +1,2 @@
a[10];
a[11];