From 89852d38ef097892e1d4624c4ec4389275603872 Mon Sep 17 00:00:00 2001 From: Tom Soulanille Date: Wed, 29 Jul 2015 23:16:51 -0700 Subject: [PATCH] run-tests: Test REPL emacs keys, but only if present. Uses cmdline/repl_emacs_check.py to check for presence of emacs keys in repl before doing full feature test. --- tests/cmdline/repl_emacs_check.py | 3 +++ tests/cmdline/repl_emacs_check.py.exp | 6 ++++++ tests/cmdline/repl_emacs_keys.py | 10 ++++++++++ tests/cmdline/repl_emacs_keys.py.exp | 18 ++++++++++++++++++ tests/run-tests | 6 ++++++ 5 files changed, 43 insertions(+) create mode 100644 tests/cmdline/repl_emacs_check.py create mode 100644 tests/cmdline/repl_emacs_check.py.exp create mode 100644 tests/cmdline/repl_emacs_keys.py create mode 100644 tests/cmdline/repl_emacs_keys.py.exp diff --git a/tests/cmdline/repl_emacs_check.py b/tests/cmdline/repl_emacs_check.py new file mode 100644 index 0000000000..3209716229 --- /dev/null +++ b/tests/cmdline/repl_emacs_check.py @@ -0,0 +1,3 @@ +# Check for emacs keys in REPL +t = +11 +t == 2 diff --git a/tests/cmdline/repl_emacs_check.py.exp b/tests/cmdline/repl_emacs_check.py.exp new file mode 100644 index 0000000000..d3834429bd --- /dev/null +++ b/tests/cmdline/repl_emacs_check.py.exp @@ -0,0 +1,6 @@ +Micro Python \.\+ version +>>> # Check for emacs keys in REPL +>>> t = \.\+ +>>> t == 2 +True +>>> diff --git a/tests/cmdline/repl_emacs_keys.py b/tests/cmdline/repl_emacs_keys.py new file mode 100644 index 0000000000..ae9e6e14af --- /dev/null +++ b/tests/cmdline/repl_emacs_keys.py @@ -0,0 +1,10 @@ +# REPL tests of GNU-ish readline navigation +# history buffer navigation +1 +2 +3 + + +# input line motion +t = 12 +'boofar fbar' diff --git a/tests/cmdline/repl_emacs_keys.py.exp b/tests/cmdline/repl_emacs_keys.py.exp new file mode 100644 index 0000000000..8bbf08bd12 --- /dev/null +++ b/tests/cmdline/repl_emacs_keys.py.exp @@ -0,0 +1,18 @@ +Micro Python \.\+ version +>>> # REPL tests of GNU-ish readline navigation +>>> # history buffer navigation +>>> 1 +1 +>>> 2 +2 +>>> 3 +3 +>>> 321 +1 +>>> 1323 +3 +>>> # input line motion +>>> t = 121 +>>> \.\+ +'foobar' +>>> diff --git a/tests/run-tests b/tests/run-tests index e65c1d2612..9379766814 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -163,6 +163,12 @@ def run_tests(pyb, tests, args): if native == b'CRASH': skip_native = True + # Check if emacs repl is supported, and skip such tests if it's not + t = run_micropython(pyb, args, 'cmdline/repl_emacs_check.py') + if not 'True' in str(t, 'ascii'): + skip_tests.add('cmdline/repl_emacs_check.py') + skip_tests.add('cmdline/repl_emacs_keys.py') + # Some tests shouldn't be run under Travis CI if os.getenv('TRAVIS') == 'true': skip_tests.add('basics/memoryerror.py')