summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTom Soulanille <soul@prama.com>2015-07-29 23:16:51 -0700
committerDamien George <damien.p.george@gmail.com>2015-08-06 00:03:44 +0100
commit89852d38ef097892e1d4624c4ec4389275603872 (patch)
treed8976ac0e7ee4f2db667ecbf70335138201c180b /tests
parent526dd542528c681c81558ba8395759e891cdecf2 (diff)
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/cmdline/repl_emacs_check.py3
-rw-r--r--tests/cmdline/repl_emacs_check.py.exp6
-rw-r--r--tests/cmdline/repl_emacs_keys.py10
-rw-r--r--tests/cmdline/repl_emacs_keys.py.exp18
-rwxr-xr-xtests/run-tests6
5 files changed, 43 insertions, 0 deletions
diff --git a/tests/cmdline/repl_emacs_check.py b/tests/cmdline/repl_emacs_check.py
new file mode 100644
index 000000000..320971622
--- /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 000000000..d3834429b
--- /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 000000000..ae9e6e14a
--- /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 000000000..8bbf08bd1
--- /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 e65c1d261..937976681 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')