Changes for how Literal changes to normal StringView.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -41,4 +41,26 @@ TEST_CASE("Literal conststring to non literal, then use", "[Utilities]") {
|
||||
REQUIRE(strcmp(val.c_str(), "foobar") == 0);
|
||||
}
|
||||
|
||||
#ifndef WINDOWS
|
||||
__attribute__((optnone))
|
||||
#endif
|
||||
static ArbUt::StringView
|
||||
TestCreateConstString() {
|
||||
char originalVal[7];
|
||||
originalVal[0] = 'f';
|
||||
originalVal[1] = 'o';
|
||||
originalVal[2] = 'o';
|
||||
originalVal[3] = 'b';
|
||||
originalVal[4] = 'a';
|
||||
originalVal[5] = 'r';
|
||||
originalVal[6] = '\0';
|
||||
return ArbUt::StringView(originalVal);
|
||||
}
|
||||
|
||||
TEST_CASE("Out of scope char* doesn't lose reference", "[Utilities]") {
|
||||
ArbUt::StringView val = TestCreateConstString();
|
||||
INFO(val.c_str());
|
||||
REQUIRE(strcmp(val.c_str(), "foobar") == 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user