mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add tests for assignment statements
This commit is contained in:
+18
@@ -141,6 +141,24 @@ abstract class DslTestCase(private val directoryName: String, private val dsl: D
|
||||
}
|
||||
}
|
||||
|
||||
fun testAssignment() {
|
||||
doTest {
|
||||
val a = declare(variable("int", "a"), true)
|
||||
a.assign(+"100")
|
||||
}
|
||||
}
|
||||
|
||||
fun testNestedAssigment() {
|
||||
doTest {
|
||||
val a = declare(variable("int", "a"), true)
|
||||
ifBranch(+"true") {
|
||||
a.assign(+"100")
|
||||
}.elseBranch {
|
||||
a.assign(+"200")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun doTest(block: Dsl.() -> Unit) {
|
||||
dsl.block()
|
||||
check()
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
int a;
|
||||
a = 100;
|
||||
@@ -0,0 +1,6 @@
|
||||
int a;
|
||||
if(true) {
|
||||
a = 100;
|
||||
} else {
|
||||
a = 200;
|
||||
};
|
||||
Reference in New Issue
Block a user