]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: More "unassigned variable" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 23 Apr 2019 07:22:40 +0000 (09:22 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 6 Aug 2019 11:29:26 +0000 (13:29 +0200)
tests/Makefile.am
tests/control-flow/unassigned-local-variable-2.test [new file with mode: 0644]
tests/control-flow/unassigned-local-variable-3.test [new file with mode: 0644]

index bc600c14199176c3312c59b551dc0e08ad083008..98185b294e414f4558945aadf2d6a0bd61c21570 100644 (file)
@@ -141,6 +141,8 @@ TESTS = \
        control-flow/unassigned-captured-local-variable.test \
        control-flow/unassigned-local-block-variable.test \
        control-flow/unassigned-local-variable.test \
+       control-flow/unassigned-local-variable-2.test \
+       control-flow/unassigned-local-variable-3.test \
        control-flow/while-false.vala \
        control-flow/bug628336.vala \
        control-flow/bug639482.vala \
diff --git a/tests/control-flow/unassigned-local-variable-2.test b/tests/control-flow/unassigned-local-variable-2.test
new file mode 100644 (file)
index 0000000..6d9d5e7
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void main () {
+       int i;
+       if (i < 42 || (i = 23) > 42) {
+               assert_not_reached ();
+       }
+}
diff --git a/tests/control-flow/unassigned-local-variable-3.test b/tests/control-flow/unassigned-local-variable-3.test
new file mode 100644 (file)
index 0000000..36ad99a
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void main () {
+       int i;
+       if (i < 42 && (i = 23) > 42) {
+               assert_not_reached ();
+       }
+}