mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add tests for arrays variables in the dsl
This commit is contained in:
+22
@@ -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];
|
||||
Reference in New Issue
Block a user