summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Leech <andrew.leech@planetinnovation.com.au>2025-06-18 07:21:36 +1000
committerDamien George <damien@micropython.org>2025-06-19 17:23:39 +1000
commit5e965618beb24927091a897e9cc81241d22d89ad (patch)
tree654414de1263e2e7e95e6e4e8c69559bb1d08066
parentc16a4db151c0fac7db45c7c896741f707e9ad364 (diff)
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>
-rwxr-xr-xtests/run-tests.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/run-tests.py b/tests/run-tests.py
index 5eebc7246..628fde9d3 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -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()