llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

<details>
<summary>Changes</summary>

Originally added in a81bd7f1014f316b42bf7274f76a340b833e663b / 
https://reviews.llvm.org/D35525, this test either was not strict enough, or 
lldb's behaviour has drifted since.

I think the intention was to check exactly when the output of "help format" 
would wrap. Which should happen when we have printed up to the terminal width, 
minus a few characters because we walk backwards to the closest whitespace 
point to break at (so we don't split a word).

I've updated the test to check the exact outputs and cover printing one line 
and two instances where we need to split different amounts onto a second line.

---
Full diff: https://github.com/llvm/llvm-project/pull/178216.diff


1 Files Affected:

- (modified) lldb/test/API/commands/help/TestHelp.py (+28-2) 


``````````diff
diff --git a/lldb/test/API/commands/help/TestHelp.py 
b/lldb/test/API/commands/help/TestHelp.py
index 6aaff17fa4ea6..d03924ecf8b27 100644
--- a/lldb/test/API/commands/help/TestHelp.py
+++ b/lldb/test/API/commands/help/TestHelp.py
@@ -237,12 +237,38 @@ def test_help_unknown_flag(self):
 
     @no_debug_info_test
     def test_help_format_output(self):
-        """Test that help output reaches TerminalWidth."""
+        """Test that help output reaches TerminalWidth and wraps to the next
+        line if needed."""
+        self.runCmd("settings set term-width 118")
+        self.expect(
+            "help format",
+            matching=True,
+            patterns=[
+                r"^<format> -- One of the format names \(or one-character 
names\) that can be used to show a variable's value:\n"
+                r"\s+\"default\"\n"
+            ],
+        )
+
+        # The length of the first line will not be exactly 108 because we split
+        # at the last whitespace point before the limit.
         self.runCmd("settings set term-width 108")
         self.expect(
             "help format",
             matching=True,
-            substrs=["<format> -- One of the format names"],
+            patterns=[
+                r"^<format> -- One of the format names \(or one-character 
names\) that can be used to show a variable's\n"
+                r"\s+value:\n"
+            ],
+        )
+
+        self.runCmd("settings set term-width 90")
+        self.expect(
+            "help format",
+            matching=True,
+            patterns=[
+                r"<format> -- One of the format names \(or one-character 
names\) that can be used to show a\n"
+                r"\s+variable's value:\n"
+            ],
         )
 
     @no_debug_info_test

``````````

</details>


https://github.com/llvm/llvm-project/pull/178216
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to