[Lldb-commits] [lldb] 5b61f78 - [lldb] Add test for lldb_private::Stream's indentation functionality
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 11 02:14:53 PST 2020
Author: Raphael Isemann
Date: 2020-02-11T11:12:54+01:00
New Revision: 5b61f78ad5e0f96b0c21ad9a634fc1b26601a00a
URL: https://github.com/llvm/llvm-project/commit/5b61f78ad5e0f96b0c21ad9a634fc1b26601a00a
DIFF: https://github.com/llvm/llvm-project/commit/5b61f78ad5e0f96b0c21ad9a634fc1b26601a00a.diff
LOG: [lldb] Add test for lldb_private::Stream's indentation functionality
Added:
Modified:
lldb/unittests/Utility/StreamTest.cpp
Removed:
################################################################################
diff --git a/lldb/unittests/Utility/StreamTest.cpp b/lldb/unittests/Utility/StreamTest.cpp
index d963ecb5d2ff..e5cc2fd3ed49 100644
--- a/lldb/unittests/Utility/StreamTest.cpp
+++ b/lldb/unittests/Utility/StreamTest.cpp
@@ -129,6 +129,38 @@ TEST_F(StreamTest, ChangingByteOrder) {
EXPECT_EQ(lldb::eByteOrderPDP, s.GetByteOrder());
}
+TEST_F(StreamTest, SetIndentLevel) {
+ s.Indent("a");
+ EXPECT_EQ("a", TakeValue());
+
+ s.SetIndentLevel(3);
+ s.Indent("a");
+ EXPECT_EQ(" a", TakeValue());
+
+ s.SetIndentLevel(2);
+ s.Indent("a");
+ EXPECT_EQ(" a", TakeValue());
+
+ s.SetIndentLevel(0);
+ s.Indent("a");
+ EXPECT_EQ("a", TakeValue());
+}
+
+TEST_F(StreamTest, Indent) {
+ s.SetIndentLevel(2);
+ s.Indent(nullptr);
+ EXPECT_EQ(" ", TakeValue());
+
+ s.Indent("");
+ EXPECT_EQ(" ", TakeValue());
+
+ s.Indent(" ");
+ EXPECT_EQ(" ", TakeValue());
+
+ s.Indent(" aa");
+ EXPECT_EQ(" aa", TakeValue());
+}
+
TEST_F(StreamTest, PutChar) {
s.PutChar('a');
EXPECT_EQ(1U, s.GetWrittenBytes());
More information about the lldb-commits
mailing list