[vala/0.46] tests: Extend "array foreach" test to increase coverage



commit 85036b1c12977aea21072746629c24dc6f91f2da
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Apr 1 20:07:23 2020 +0200

    tests: Extend "array foreach" test to increase coverage

 tests/control-flow/foreach.vala | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/tests/control-flow/foreach.vala b/tests/control-flow/foreach.vala
index 0646c2d9a..6a36453fd 100644
--- a/tests/control-flow/foreach.vala
+++ b/tests/control-flow/foreach.vala
@@ -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 () {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]