]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Extend "array foreach" test to increase coverage d08837bd13043f1dbe0a198ad11499bb239abec7
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 1 Apr 2020 18:07:23 +0000 (20:07 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 2 Apr 2020 06:03:45 +0000 (08:03 +0200)
tests/control-flow/foreach.vala

index 0646c2d9a2498c3537c222c7fae260f13115cca1..6a36453fd9feb720b3004fdc317a9a71c26460db 100644 (file)
@@ -43,6 +43,7 @@ void test_foreach_multidim_array () {
 }
 
 const int[] FOO = { 1, 2, 3, 4, 5, 6 };
+const int BAR[] = { 6, 5, 4, 3, 2, 1 };
 
 void test_foreach_const_array () {
        string result = "";
@@ -50,6 +51,12 @@ void test_foreach_const_array () {
                result += i.to_string ();
        }
        assert (result == "123456");
+
+       string result2 = "";
+       foreach (var i in BAR) {
+               result2 += i.to_string ();
+       }
+       assert (result2 == "654321");
 }
 
 void test_foreach_slice_array () {