[vala/staging] tests: Extend "array foreach" test to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] tests: Extend "array foreach" test to increase coverage
- Date: Wed, 1 Apr 2020 19:28:43 +0000 (UTC)
commit 3943d731019fbe00e3086be276896c1e49ebd6ba
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 188964317..0c5968a7b 100644
--- a/tests/control-flow/foreach.vala
+++ b/tests/control-flow/foreach.vala
@@ -37,6 +37,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 = "";
@@ -44,6 +45,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]