From: Rico Tzschichholz Date: Sun, 24 May 2020 17:25:41 +0000 (+0200) Subject: tests: Extend "s[p]lice" tests to increase coverage X-Git-Tag: 0.46.11~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=660c4d51314bc7c7f292e47ce28a64bfe6e22554;p=thirdparty%2Fvala.git tests: Extend "s[p]lice" tests to increase coverage --- 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 () {