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:
committed by
Damien George
parent
c16a4db151
commit
5e965618be
@@ -405,6 +405,10 @@ def run_micropython(pyb, args, test_file, test_file_abspath, is_special=False):
|
|||||||
return rv
|
return rv
|
||||||
|
|
||||||
def send_get(what):
|
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)
|
os.write(master, what)
|
||||||
return get()
|
return get()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user