labath accepted this revision.
labath added a comment.
Looks good. Thanks for adding the test. See inline comment for possible
simplification.
================
Comment at: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py:22
+
+ Note: just sending escape characters to pexpect and checking the buffer
+ doesn't work well, so we run real commands. We want to type
----------------
There are several reasons why doing that doesn't work well. The first is that
the "console" output would differ depending on whether lldb/libedit has had a
chance to disable echo or not. Assuming you got past that, the second problem
would be that the output would contain a lot of ansi cursor movement escape
sequences, and redraws, and you'd have to encode in the test the exact way in
which libedit chose to implement the line editing operations. Checking for the
effect of the command indeed seems like the best way to exercise this
functionality.
================
Comment at: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py:27
+
+ 1. Send "el ommand" -> "el command[]"
+ 2. Ctrl+left once -> "el []command"
----------------
```
el ommand[]
el []ommand
```
================
Comment at: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py:37-38
+
+ # Run help for different commands for escape variants to make sure each
+ # one matches uniquely (the buffer isn't cleared in between matches).
+ cases = [
----------------
The buffer isn't exactly "cleared", but each "expect" command should only match
from the end of the previous match, so repeating the same command should not be
a problem. What the other (few) pexpect tests do is put an
`self.expect_prompt()` to ensure all output from the previous command is
ignored, and lldb is ready to receive a new command. You could do that too. In
fact, you could probably use the helper "expect" command which does all of this
for you:
`self.expect("el ommand{L}c{L}{L}h{R}p".format(...), substrs=["Syntax:
command"])`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70137/new/
https://reviews.llvm.org/D70137
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits