]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "do-while" parser tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 7 Jan 2018 13:22:20 +0000 (14:22 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 10 Jan 2018 19:45:27 +0000 (20:45 +0100)
tests/Makefile.am
tests/parser/do-statement.vala [new file with mode: 0644]

index 36a16cfbfc8f02c8ef6b23f998463a3af08ed062..7f11b093e5dd4a93ffd2be6faeb12220c35165af 100644 (file)
@@ -317,6 +317,7 @@ TESTS = \
        annotations/deprecated.vala \
        annotations/description.vala \
        annotations/noaccessormethod.test \
+       parser/do-statement.vala \
        parser/template.vala \
        parser/tuple.vala \
        $(NULL)
diff --git a/tests/parser/do-statement.vala b/tests/parser/do-statement.vala
new file mode 100644 (file)
index 0000000..f2fe992
--- /dev/null
@@ -0,0 +1,14 @@
+void main () {
+       int i = 0;
+
+       do {
+               i++;
+       } while (i < 2);
+       assert (i == 2);
+
+       do {
+               i = 42;
+               break;
+       } while (true);
+       assert (i == 42);
+}