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 <andrew.leech@planetinnovation.com.au>
This commit is contained in:
parent
c16a4db151
commit
5e965618be
1 changed files with 4 additions and 0 deletions
|
|
@ -405,6 +405,10 @@ def run_micropython(pyb, args, test_file, test_file_abspath, is_special=False):
|
|||
return rv
|
||||
|
||||
def send_get(what):
|
||||
# Detect {\x00} pattern and convert to ctrl-key codes.
|
||||
ctrl_code = lambda m: bytes([int(m.group(1))])
|
||||
what = re.sub(rb'{\\x(\d\d)}', ctrl_code, what)
|
||||
|
||||
os.write(master, what)
|
||||
return get()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue