mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-13 13:01:55 +03:00
WString: c_str() returns null pointer after move (#7611)
* (test) WString: c_str() returns null pointer target = std::move(source) does not reset buffer pointer back to the sso * wstring: correctly do move invalidation & copy based on the #7553 without isSSO -> isHeap rename and inline optimizations additionally, remove useless pre-c++11 preprocessor checks Co-authored-by: Takayuki 'January June' Suwa <jjsuwa@sys3175.com>
This commit is contained in:
@ -19,6 +19,19 @@
|
||||
#include <limits.h>
|
||||
#include <StreamString.h>
|
||||
|
||||
TEST_CASE("String::move", "[core][String]")
|
||||
{
|
||||
const char buffer[] = "this string goes over the sso limit";
|
||||
|
||||
String target;
|
||||
String source(buffer);
|
||||
|
||||
target = std::move(source);
|
||||
REQUIRE(source.c_str() != nullptr);
|
||||
REQUIRE(!source.length());
|
||||
REQUIRE(target == buffer);
|
||||
}
|
||||
|
||||
TEST_CASE("String::trim", "[core][String]")
|
||||
{
|
||||
String str;
|
||||
|
Reference in New Issue
Block a user