C++: Add clear() method to SharedString (#8797)

A convenience method to reset to an empty string, like already known
from std::string.

ChangeLog: [C++] Added `SharedString::clear()`
This commit is contained in:
U. Bruhin 2025-06-27 13:44:37 +02:00 committed by GitHub
parent 9a1ccaf502
commit 68b46276af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -53,6 +53,14 @@ SCENARIO("SharedString API")
REQUIRE(str.size() == 5);
}
SECTION("clear")
{
str = "Hello";
str.clear();
REQUIRE(str.size() == 0);
REQUIRE(std::string_view(str.data()) == "");
}
SECTION("to_lowercase")
{
str = "Hello";