Skip to content

Commit 5e96561

Browse files
pi-anldpgeorge
authored andcommitted
tests/run-tests.py: Add support for ctrl keys in REPL tests.
This allows having {\xDD} in tests, which will be expanded to the given hex character. Signed-off-by: Andrew Leech <[email protected]>
1 parent c16a4db commit 5e96561

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/run-tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ def get(required=False):
405405
return rv
406406

407407
def send_get(what):
408+
# Detect {\x00} pattern and convert to ctrl-key codes.
409+
ctrl_code = lambda m: bytes([int(m.group(1))])
410+
what = re.sub(rb'{\\x(\d\d)}', ctrl_code, what)
411+
408412
os.write(master, what)
409413
return get()
410414

0 commit comments

Comments
 (0)