Check for null string pointer.

This commit is contained in:
Victor Zverovich
2012-12-17 16:39:49 -08:00
parent f8c9106d67
commit 1b3c197bff
2 changed files with 10 additions and 2 deletions

View File

@@ -609,6 +609,10 @@ TEST(FormatterTest, FormatCString) {
CheckUnknownTypes("test", "s", "string");
EXPECT_EQ("test", str(Format("{0}") << "test"));
EXPECT_EQ("test", str(Format("{0:s}") << "test"));
char nonconst[] = "nonconst";
EXPECT_EQ("nonconst", str(Format("{0}") << nonconst));
EXPECT_THROW_MSG(Format("{0}") << reinterpret_cast<const char*>(0),
FormatError, "string pointer is null");
}
TEST(FormatterTest, FormatPointer) {