Browse Source

Add test for recently discovered bug in stack-buffer-constructed plStrings

Michael Hansen 10 years ago
parent
commit
a6cbdc2f13
  1. 16
      Sources/Tests/CoreTests/test_plString.cpp

16
Sources/Tests/CoreTests/test_plString.cpp

@ -85,6 +85,22 @@ TEST(plString, Utility)
EXPECT_EQ(utf8_test_data_length, plString(utf8_test_data).GetSize()); EXPECT_EQ(utf8_test_data_length, plString(utf8_test_data).GetSize());
} }
TEST(plString, StackStrings)
{
char stack_buf[256];
strcpy(stack_buf, "Test");
plString test(stack_buf);
EXPECT_EQ(plString("Test"), test);
EXPECT_EQ(strlen("Test"), test.GetSize());
strcpy(stack_buf, "operator=");
test = stack_buf;
EXPECT_EQ(plString("operator="), test);
EXPECT_EQ(strlen("operator="), test.GetSize());
}
TEST(plString, ConvertUtf8) TEST(plString, ConvertUtf8)
{ {
// From UTF-8 to plString // From UTF-8 to plString

Loading…
Cancel
Save