diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-05-24 19:25:41 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-05-24 19:25:41 +0200 |
commit | 6312d8c7563c227b77d2098c9de1048f65c3b51f (patch) | |
tree | 54f2db4851ca32f697d1b234ef91487d43a3ca49 /tests/basic-types | |
parent | 18847c9221362081c9a9d37e2922f3e3ea648088 (diff) | |
download | vala-6312d8c7563c227b77d2098c9de1048f65c3b51f.tar.gz |
tests: Extend "s[p]lice" tests to increase coverage
Diffstat (limited to 'tests/basic-types')
-rw-r--r-- | tests/basic-types/arrays.vala | 4 | ||||
-rw-r--r-- | tests/basic-types/strings.vala | 9 |
2 files changed, 13 insertions, 0 deletions
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 () { |