[vala/0.46] tests: Extend "s[p]lice" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.46] tests: Extend "s[p]lice" tests to increase coverage
- Date: Mon, 22 Jun 2020 09:06:11 +0000 (UTC)
commit 660c4d51314bc7c7f292e47ce28a64bfe6e22554
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun May 24 19:25:41 2020 +0200
tests: Extend "s[p]lice" tests to increase coverage
tests/basic-types/arrays.vala | 4 ++++
tests/basic-types/strings.vala | 9 +++++++++
2 files changed, 13 insertions(+)
---
diff --git a/tests/basic-types/arrays.vala b/tests/basic-types/arrays.vala
index ac43c2050..f4777a7a7 100644
--- a/tests/basic-types/arrays.vala
+++ b/tests/basic-types/arrays.vala
@@ -38,6 +38,10 @@ void test_integer_array () {
assert (c[0] == 23);
assert (c[1] == 11);
+ int[]? c0 = a[0:0];
+ assert (c0 == null);
+ assert (c0.length == 0);
+
// in expressions
assert (23 in a);
assert (!(-1 in a));
diff --git a/tests/basic-types/strings.vala b/tests/basic-types/strings.vala
index a4fcda4f7..ecead74c0 100644
--- a/tests/basic-types/strings.vala
+++ b/tests/basic-types/strings.vala
@@ -70,6 +70,9 @@ void test_string_slice () {
r = s.slice (-7, -5);
assert (r == "my");
+
+ r = s.slice (0, 0);
+ assert (r == "");
}
void test_string_splice () {
@@ -89,6 +92,12 @@ void test_string_splice () {
s = s.splice (-14, -5);
assert (s == "helloworld");
+
+ s = "hello".splice (0, 0);
+ assert (s == "hello");
+
+ s = "world".splice (0, 0, "hello");
+ assert (s == "helloworld");
}
void test_string_substring () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]