]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add some tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 3 Mar 2021 15:06:34 +0000 (16:06 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 13 Mar 2021 20:22:05 +0000 (21:22 +0100)
tests/Makefile.am
tests/control-flow/for.vala
tests/semantic/assignment-fixed-array-length.test [new file with mode: 0644]

index d32c502df2b213be97930c520374618b528a258e..cd125650b6045e6346287f15ee6eed5ca84e6274 100644 (file)
@@ -870,6 +870,7 @@ TESTS = \
        semantic/array-incompatible-initializer2.test \
        semantic/assignment-element-incompatible-ownership.test \
        semantic/assignment-element-incompatible-type.test \
+       semantic/assignment-fixed-array-length.test \
        semantic/assignment-same-variable.vala \
        semantic/assignment-signal-incompatible-method.test \
        semantic/assignment-signal-incompatible-type.test \
index c435c04171c209944edc4f202ae2e7d57d433226..7b074d787e4012718722bd632f21c1d11ba87ea3 100644 (file)
@@ -8,7 +8,22 @@ void test_for_void_methods () {
        }
 }
 
+void condition_true () {
+       for (;true;) {
+               return;
+       }
+       assert_not_reached ();
+}
+
+void condition_false () {
+       for (;false;) {
+               assert_not_reached ();
+       }
+}
+
 void main () {
+       condition_true ();
+       condition_false ();
        test_for_void_methods ();
 }
 
diff --git a/tests/semantic/assignment-fixed-array-length.test b/tests/semantic/assignment-fixed-array-length.test
new file mode 100644 (file)
index 0000000..5de56ba
--- /dev/null
@@ -0,0 +1,6 @@
+Invalid Code
+
+void main () {
+       int i[42];
+       i.length = 23;
+}