From 57e39d0ce9a31364dba6a6174cbfd5a0098d8962 Mon Sep 17 00:00:00 2001 From: VolTer Date: Wed, 1 Feb 2023 23:29:17 +0100 Subject: Fix String.split() with empty string and delimeter --- tests/core/string/test_string.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/core') 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(); -- cgit v1.2.3