Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test and fix nit.
  • Loading branch information
rustyconover committed Jan 26, 2020
commit 6727bc0fcab49e226e074de391d56f23646915c6
2 changes: 1 addition & 1 deletion src/debug_utils-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct ToStringHelper {
typename dummy = bool>
static std::string Convert(const T& value) { return std::to_string(value); }
static std::string Convert(const char* value) {
return value ? value : "(null)";
return value != nullptr ? value : "(null)";
}
static std::string Convert(const std::string& value) { return value; }
static std::string Convert(bool value) { return value ? "true" : "false"; }
Expand Down
1 change: 1 addition & 0 deletions test/cctest/test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ TEST(UtilTest, SPrintF) {
const char* bar = "bar";
EXPECT_EQ(SPrintF("%s %s", foo, "bar"), "foo bar");
EXPECT_EQ(SPrintF("%s %s", foo, bar), "foo bar");
EXPECT_EQ(SPrintF("%s", nullptr), "(null)");

EXPECT_EQ(SPrintF("[%% %s %%]", foo), "[% foo %]");

Expand Down