summaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
authorVolTer <mew.pur.pur@abv.bg>2023-02-01 23:29:17 +0100
committerVolTer <mew.pur.pur@abv.bg>2023-02-02 01:34:11 +0100
commit57e39d0ce9a31364dba6a6174cbfd5a0098d8962 (patch)
treebf46e4403160be58b712e68cbc9e00a3cf3ab42f /tests/core
parentd01ac9c73686fdf86f083f4d3ee1301bb54d855f (diff)
Fix String.split() with empty string and delimeter
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/string/test_string.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h
index 0cf3448a48..5d19b5a164 100644
--- a/tests/core/string/test_string.h
+++ b/tests/core/string/test_string.h
@@ -512,6 +512,14 @@ TEST_CASE("[String] Splitting") {
CHECK(l[i] == slices_3[i]);
}
+ s = "";
+ l = s.split();
+ CHECK(l.size() == 1);
+ CHECK(l[0] == "");
+
+ l = s.split("", false);
+ CHECK(l.size() == 0);
+
s = "Mars Jupiter Saturn Uranus";
const char *slices_s[4] = { "Mars", "Jupiter", "Saturn", "Uranus" };
l = s.split_spaces();