Use stream operators for appending to InfoLog.
Also add a helper class to keep the previous behaviour of
automatically appending a newline after every new message.
BUG=angleproject:992
Change-Id: I0ff5d2846175cf19de7a6af295af24a92451456f
Reviewed-on: https://chromium-review.googlesource.com/268744
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Program_unittest.cpp b/src/libANGLE/Program_unittest.cpp
index 12fe6f2..575b44c 100644
--- a/src/libANGLE/Program_unittest.cpp
+++ b/src/libANGLE/Program_unittest.cpp
@@ -21,10 +21,23 @@
{
InfoLog infoLog;
EXPECT_EQ(0u, infoLog.getLength());
- infoLog.append(" ");
+ infoLog << " ";
// " \n\0" = 3 characters
EXPECT_EQ(3u, infoLog.getLength());
}
+// Tests that newlines get appended to the info log properly.
+TEST(InfoLogTest, AppendingNewline)
+{
+ InfoLog infoLog;
+
+ infoLog << "First" << 1 << 'x';
+ infoLog << "Second" << 2 << 'y';
+
+ std::string expected = "First1x\nSecond2y\n";
+
+ EXPECT_EQ(expected, infoLog.str());
+}
+
} // namespace