diff options
author | kobewi <kobewi4e@gmail.com> | 2022-08-12 16:21:15 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-11-04 15:09:12 +0100 |
commit | 8a47a12207348ad332c4ed5987c0ba432ff5de5a (patch) | |
tree | 9bbefb784ec254802db5b3c117c9db57087c3ac2 /tests/core/string/test_string.h | |
parent | 191c8ed12f624ec97b650b2726fed4e8c4bcf04c (diff) |
Add support for empty delimiter in String.split
Diffstat (limited to 'tests/core/string/test_string.h')
-rw-r--r-- | tests/core/string/test_string.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h index cd1b421ce8..7e4e3aa9f0 100644 --- a/tests/core/string/test_string.h +++ b/tests/core/string/test_string.h @@ -485,6 +485,7 @@ TEST_CASE("[String] Splitting") { const char *slices_l[3] = { "Mars", "Jupiter", "Saturn,Uranus" }; const char *slices_r[3] = { "Mars,Jupiter", "Saturn", "Uranus" }; + const char *slices_3[4] = { "t", "e", "s", "t" }; l = s.split(",", true, 2); CHECK(l.size() == 3); @@ -498,6 +499,13 @@ TEST_CASE("[String] Splitting") { CHECK(l[i] == slices_r[i]); } + s = "test"; + l = s.split(); + CHECK(l.size() == 4); + for (int i = 0; i < l.size(); i++) { + CHECK(l[i] == slices_3[i]); + } + s = "Mars Jupiter Saturn Uranus"; const char *slices_s[4] = { "Mars", "Jupiter", "Saturn", "Uranus" }; l = s.split_spaces(); |