Resolve issue where ConstString can lose internal string representation due to not owning it.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This sadly meant most constexpr constructors had to be removed, as it needs to copy the string.
This commit is contained in:
@@ -42,5 +42,23 @@ TEST_CASE("Use case insensitive const string in switch case", "[Utilities]") {
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((optnone))
|
||||
static Arbutils::CaseInsensitiveConstString TestCreateConstString(){
|
||||
char originalVal [6];
|
||||
originalVal[0] = 'f';
|
||||
originalVal[1] = 'o';
|
||||
originalVal[2] = 'o';
|
||||
originalVal[3] = 'b';
|
||||
originalVal[4] = 'a';
|
||||
originalVal[5] = 'r';
|
||||
return Arbutils::CaseInsensitiveConstString(originalVal);
|
||||
}
|
||||
|
||||
TEST_CASE("Out of scope char* doesn't lose reference", "[Utilities]") {
|
||||
Arbutils::CaseInsensitiveConstString val = TestCreateConstString();
|
||||
INFO(val.c_str());
|
||||
REQUIRE(strcmp(val.c_str(), "foobar") == 0);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user