[vala] tests: Add test for nested conditional expression



commit 22dff9c3a603c76e3597647ebd1a414af5a46d8e
Author: Jürg Billeter <j bitron ch>
Date:   Sat Sep 17 20:48:35 2016 +0200

    tests: Add test for nested conditional expression

 tests/Makefile.am                          |    1 +
 tests/control-flow/nested-conditional.vala |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ca2a52c..0832a41 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -76,6 +76,7 @@ TESTS = \
        control-flow/expressions-conditional.vala \
        control-flow/for.vala \
        control-flow/foreach.vala \
+       control-flow/nested-conditional.vala \
        control-flow/switch.vala \
        control-flow/sideeffects.vala \
        control-flow/bug639482.vala \
diff --git a/tests/control-flow/nested-conditional.vala b/tests/control-flow/nested-conditional.vala
new file mode 100644
index 0000000..910416b
--- /dev/null
+++ b/tests/control-flow/nested-conditional.vala
@@ -0,0 +1,8 @@
+bool bar () {
+       assert_not_reached();
+}
+
+void main () {
+       var foo = true ? 0 : (bar() ? 1 : 2);
+       assert(foo == 0);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]