Changes for how Literal changes to normal StringView.
continuous-integration/drone/push Build is passing

This commit is contained in:
Deukhoofd committed 2020-06-27 14:16:15 +02:00
1 parent 773e765c83
commit 083c00f85e
3 files changed
+25 -1

No files matched your search

+22
View File
@@ -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