]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Extend "s[p]lice" tests to increase coverage 6312d8c7563c227b77d2098c9de1048f65c3b51f
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 24 May 2020 17:25:41 +0000 (19:25 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 24 May 2020 17:25:41 +0000 (19:25 +0200)
tests/basic-types/arrays.vala
tests/basic-types/strings.vala

index ac43c2050abf29f81bca96a8a71aaae76761878a..f4777a7a7b7f725f6be2b7372b41474133f36508 100644 (file)
@@ -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));
index a4fcda4f7afca151dbcb3b4a0cfd2aab9c2027bc..ecead74c0241a13c5449783e36c2734a350f5fa9 100644 (file)
@@ -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 () {