We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe01433 commit 0920dafCopy full SHA for 0920daf
tests/host/core/test_string.cpp
@@ -494,3 +494,21 @@ TEST_CASE("Strings with NULs", "[core][String]")
494
const char *p = str3.c_str();
495
REQUIRE(!memcmp(p, zeros, 64));
496
}
497
+
498
+TEST_CASE("Replace and string expansion", "[core][String]")
499
+{
500
+ String s, l;
501
+ // Make these large enough to span SSO and non SSO
502
+ String whole = "#123456789012345678901234567890";
503
+ const char *res = "abcde123456789012345678901234567890";
504
+ for (size_t i=1; i < whole.length(); i++) {
505
+ s = whole.substring(0, i);
506
+ l = s;
507
+ l.replace("#", "abcde");
508
+ char buff[64];
509
+ strcpy(buff, res);
510
+ buff[5 + i-1] = 0;
511
+ REQUIRE(!strcmp(l.c_str(), buff));
512
+ REQUIRE(l.length() == strlen(buff));
513
+ }
514
+}
0 commit comments