Skip to content

Commit 89852d3

Browse files
pramasouldpgeorge
authored andcommitted
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.
1 parent 526dd54 commit 89852d3

5 files changed

Lines changed: 43 additions & 0 deletions

File tree

tests/cmdline/repl_emacs_check.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Check for emacs keys in REPL
2+
t = +11
3+
t == 2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Micro Python \.\+ version
2+
>>> # Check for emacs keys in REPL
3+
>>> t = \.\+
4+
>>> t == 2
5+
True
6+
>>>

tests/cmdline/repl_emacs_keys.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# REPL tests of GNU-ish readline navigation
2+
# history buffer navigation
3+
1
4+
2
5+
3
6+

7+

8+
# input line motion
9+
t = 12
10+
'boofar fbar'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Micro Python \.\+ version
2+
>>> # REPL tests of GNU-ish readline navigation
3+
>>> # history buffer navigation
4+
>>> 1
5+
1
6+
>>> 2
7+
2
8+
>>> 3
9+
3
10+
>>> 321
11+
1
12+
>>> 1323
13+
3
14+
>>> # input line motion
15+
>>> t = 121
16+
>>> \.\+
17+
'foobar'
18+
>>>

tests/run-tests

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ def run_tests(pyb, tests, args):
163163
if native == b'CRASH':
164164
skip_native = True
165165

166+
# Check if emacs repl is supported, and skip such tests if it's not
167+
t = run_micropython(pyb, args, 'cmdline/repl_emacs_check.py')
168+
if not 'True' in str(t, 'ascii'):
169+
skip_tests.add('cmdline/repl_emacs_check.py')
170+
skip_tests.add('cmdline/repl_emacs_keys.py')
171+
166172
# Some tests shouldn't be run under Travis CI
167173
if os.getenv('TRAVIS') == 'true':
168174
skip_tests.add('basics/memoryerror.py')

0 commit comments

Comments
 (0)