]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Extend "assigned local variable" control flow tests
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 6 Apr 2019 08:13:02 +0000 (10:13 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 10 Apr 2019 14:26:19 +0000 (16:26 +0200)
Cover condition statements of WhileStatement and ConditionalExpression

tests/control-flow/assigned-local-variable.vala

index 7946d72ea9609a185bcd4103c764cf4714ed9ced..e8121990475423bb1c1fc8822d889074f6c672b6 100644 (file)
@@ -20,4 +20,26 @@ void main () {
                        assert_not_reached ();
                }
        }
+
+       {
+               string? s;
+               while (!foo (out s) || s == null) {
+                       assert_not_reached ();
+               }
+       }
+       {
+               int i;
+               while ((i = bar ()) > 42 || i < 23) {
+                       assert_not_reached ();
+               }
+       }
+
+       {
+               string? s;
+               assert (!foo (out s) || s == null ? false : true);
+       }
+       {
+               int i;
+               assert ((i = bar ()) > 42 || i < 23 ? false : true);
+       }
 }