Fabric: Improvements in DebugStringConvertible

Summary:
* Small improvements in pretty-printing algorirhm (adding spaces and new-line caracters). Now it's even more pretty.
 * The `depth` parameter was integrated into `DebugStringConvertibleOptions` which simplifies evething a bit and reduce amount of arguments that `getDebugDescription` requires.

Reviewed By: sahrens

Differential Revision: D14715082

fbshipit-source-id: 3ea0b8db3c1816c5cb43f40ccec9cdc1943f33a5
This commit is contained in:
Valentin Shergin authored and Facebook Github Bot committed 2019-04-04 12:38:21 -07:00
1 parent af0159ae78
commit 97e064b696
3 files changed
+35 -29

No files matched your search

@@ -19,7 +19,7 @@ TEST(DebugStringConvertibleTest, handleSimpleNode) {
ASSERT_STREQ(item->getDebugName().c_str(), "View");
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
ASSERT_STREQ(item->getDebugDescription().c_str(), "<View=hello/>\n");
ASSERT_STREQ(item->getDebugDescription().c_str(), "<View=hello/>");
}
TEST(DebugStringConvertibleTest, handleSimpleNodeWithProps) {
@@ -31,7 +31,7 @@ TEST(DebugStringConvertibleTest, handleSimpleNodeWithProps) {
ASSERT_STREQ(item->getDebugName().c_str(), "View");
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
ASSERT_STREQ(item->getDebugDescription().c_str(), "<View=hello x=1/>\n");
ASSERT_STREQ(item->getDebugDescription().c_str(), "<View=hello x=1/>");
}
TEST(DebugStringConvertibleTest, handleSimpleNodeWithChildren) {
@@ -45,7 +45,7 @@ TEST(DebugStringConvertibleTest, handleSimpleNodeWithChildren) {
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
ASSERT_STREQ(
item->getDebugDescription().c_str(),
"<View=hello>\n <Child=a/>\n</View>\n");
"<View=hello>\n <Child=a/>\n</View>");
}
TEST(DebugStringConvertibleTest, handleNestedNode) {
@@ -61,7 +61,7 @@ TEST(DebugStringConvertibleTest, handleNestedNode) {
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
ASSERT_STREQ(
item->getDebugDescription().c_str(),
"<View=hello x=1>\n <Child=a x=1/>\n</View>\n");
"<View=hello x=1>\n <Child=a x=1/>\n</View>");
}
TEST(DebugStringConvertibleTest, handleNodeWithComplexProps) {
@@ -80,5 +80,5 @@ TEST(DebugStringConvertibleTest, handleNodeWithComplexProps) {
ASSERT_STREQ(item->getDebugValue().c_str(), "hello");
ASSERT_STREQ(
item->getDebugDescription().c_str(),
"<View=hello x=1(height=100 width=200)/>\n");
"<View=hello x=1(height=100 width=200)/>");
}