mirror of
https://github.com/micropython/micropython.git
synced 2026-05-01 05:10:15 +02:00
tests: Protect trailing spaces with "\$".
Makes it easier to see the trailing spaces in an editor, and to know that they are intentional. Signed-off-by: Dan Halbert <halbert@halwitz.org>
This commit is contained in:
committed by
Damien George
parent
efe6d3bbdd
commit
6b97759d25
@@ -185,7 +185,7 @@ arg names:
|
||||
58 UNARY_OP 1 __neg__
|
||||
59 STORE_FAST 9
|
||||
60 LOAD_FAST 0
|
||||
61 UNARY_OP 3
|
||||
61 UNARY_OP 3 \$
|
||||
62 STORE_FAST 10
|
||||
63 LOAD_FAST 0
|
||||
64 LOAD_DEREF 14
|
||||
@@ -206,7 +206,7 @@ arg names:
|
||||
84 LOAD_DEREF 14
|
||||
86 LOAD_FAST 1
|
||||
87 BINARY_OP 2 __eq__
|
||||
88 UNARY_OP 3
|
||||
88 UNARY_OP 3 \$
|
||||
89 STORE_FAST 10
|
||||
90 LOAD_DEREF 14
|
||||
92 LOAD_ATTR c
|
||||
|
||||
@@ -76,7 +76,7 @@ arg names:
|
||||
34 RAISE_OBJ
|
||||
35 DUP_TOP
|
||||
36 LOAD_NAME AttributeError
|
||||
38 BINARY_OP 8
|
||||
38 BINARY_OP 8 \$
|
||||
39 POP_JUMP_IF_FALSE 44
|
||||
41 POP_TOP
|
||||
42 POP_EXCEPT_JUMP 45
|
||||
|
||||
@@ -11,4 +11,4 @@ Type "help()" for more information.
|
||||
>>> i.lower('ABC')
|
||||
'abc'
|
||||
>>> None.[K[K[K[K[K
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
MicroPython \.\+ version
|
||||
Type "help()" for more information.
|
||||
>>> # Test REPL autocompletion filtering of underscore attributes
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Start paste mode
|
||||
>>>
|
||||
>>> \$
|
||||
paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
===
|
||||
=== \$
|
||||
=== class TestClass:
|
||||
=== def __init__(self):
|
||||
=== self.public_attr = 1
|
||||
=== self._private_attr = 2
|
||||
=== self.__very_private = 3
|
||||
===
|
||||
=== \$
|
||||
=== def public_method(self):
|
||||
=== pass
|
||||
===
|
||||
=== \$
|
||||
=== def _private_method(self):
|
||||
=== pass
|
||||
===
|
||||
=== \$
|
||||
=== @property
|
||||
=== def public_property(self):
|
||||
=== return 42
|
||||
===
|
||||
=== @property
|
||||
=== \$
|
||||
=== @property \$
|
||||
=== def _private_property(self):
|
||||
=== return 99
|
||||
===
|
||||
===
|
||||
=== \$
|
||||
=== \$
|
||||
>>> # Paste executed
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Create an instance
|
||||
>>> obj = TestClass()
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Test tab completion on the instance
|
||||
>>> # The tab character after `obj.` and 'a' below triggers the completions
|
||||
>>> obj.public_
|
||||
public_attr public_method public_property
|
||||
>>> obj.public_attr
|
||||
1
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -3,20 +3,20 @@ Type "help()" for more information.
|
||||
>>> # tests for autoindent
|
||||
>>> if 1:
|
||||
... print(1)
|
||||
...
|
||||
...
|
||||
...
|
||||
... \$
|
||||
... \$
|
||||
... \$
|
||||
1
|
||||
>>> if 0:
|
||||
... print(2)
|
||||
... else:
|
||||
... print(3)
|
||||
...
|
||||
... \$
|
||||
3
|
||||
>>> if 0:
|
||||
... print(4)
|
||||
... else:
|
||||
... print(5)
|
||||
...
|
||||
... \$
|
||||
5
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -7,4 +7,4 @@ Type "help()" for more information.
|
||||
1
|
||||
>>> 2
|
||||
2
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -54,4 +54,4 @@ two
|
||||
>>> if1 = 2
|
||||
>>> print(if1)
|
||||
2
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -16,4 +16,4 @@ Type "help()" for more information.
|
||||
>>> t = 121
|
||||
>>> \.\+
|
||||
'foobar'
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -3,4 +3,4 @@ MicroPython \.\+ version
|
||||
Type "help()" for more information.
|
||||
>>> # cmdline: -i -c print("test")
|
||||
>>> # -c option combined with -i option results in REPL
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -2,4 +2,4 @@ MicroPython \.\+ version
|
||||
Type "help()" for more information.
|
||||
>>> # cmdline: cmdline/repl_micropyinspect
|
||||
>>> # setting MICROPYINSPECT environment variable before program exit triggers REPL
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
MicroPython \.\+ version
|
||||
Type "help()" for more information.
|
||||
>>> # Test REPL paste mode functionality
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Basic paste mode with a simple function
|
||||
>>>
|
||||
>>> \$
|
||||
paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
===
|
||||
=== \$
|
||||
=== def hello():
|
||||
=== print('Hello from paste mode!')
|
||||
=== hello()
|
||||
===
|
||||
=== \$
|
||||
Hello from paste mode!
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Paste mode with multiple indentation levels
|
||||
>>>
|
||||
>>> \$
|
||||
paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
===
|
||||
=== \$
|
||||
=== def calculate(n):
|
||||
=== if n > 0:
|
||||
=== for i in range(n):
|
||||
@@ -25,109 +25,109 @@ paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
=== print(f'Odd: {i}')
|
||||
=== else:
|
||||
=== print('n must be positive')
|
||||
===
|
||||
=== \$
|
||||
=== calculate(5)
|
||||
===
|
||||
=== \$
|
||||
Even: 0
|
||||
Odd: 1
|
||||
Even: 2
|
||||
Odd: 3
|
||||
Even: 4
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Paste mode with blank lines
|
||||
>>>
|
||||
>>> \$
|
||||
paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
===
|
||||
=== \$
|
||||
=== def function_with_blanks():
|
||||
=== print('First line')
|
||||
===
|
||||
=== \$
|
||||
=== print('After blank line')
|
||||
===
|
||||
===
|
||||
=== \$
|
||||
=== \$
|
||||
=== print('After two blank lines')
|
||||
===
|
||||
=== \$
|
||||
=== function_with_blanks()
|
||||
===
|
||||
=== \$
|
||||
First line
|
||||
After blank line
|
||||
After two blank lines
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Paste mode with class definition and multiple methods
|
||||
>>>
|
||||
>>> \$
|
||||
paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
===
|
||||
=== \$
|
||||
=== class TestClass:
|
||||
=== def __init__(self, value):
|
||||
=== self.value = value
|
||||
===
|
||||
=== \$
|
||||
=== def display(self):
|
||||
=== print(f'Value is: {self.value}')
|
||||
===
|
||||
=== \$
|
||||
=== def double(self):
|
||||
=== self.value *= 2
|
||||
=== return self.value
|
||||
===
|
||||
=== \$
|
||||
=== obj = TestClass(21)
|
||||
=== obj.display()
|
||||
=== print(f'Doubled: {obj.double()}')
|
||||
=== obj.display()
|
||||
===
|
||||
=== \$
|
||||
Value is: 21
|
||||
Doubled: 42
|
||||
Value is: 42
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Paste mode with exception handling
|
||||
>>>
|
||||
>>> \$
|
||||
paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
===
|
||||
=== \$
|
||||
=== try:
|
||||
=== x = 1 / 0
|
||||
=== except ZeroDivisionError:
|
||||
=== print('Caught division by zero')
|
||||
=== finally:
|
||||
=== print('Finally block executed')
|
||||
===
|
||||
=== \$
|
||||
Caught division by zero
|
||||
Finally block executed
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Cancel paste mode with Ctrl-C
|
||||
>>>
|
||||
>>> \$
|
||||
paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
===
|
||||
=== \$
|
||||
=== print('This should not execute')
|
||||
===
|
||||
>>>
|
||||
>>>
|
||||
=== \$
|
||||
>>> \$
|
||||
>>> \$
|
||||
>>> # Normal REPL still works after cancelled paste
|
||||
>>> print('Back to normal REPL')
|
||||
Back to normal REPL
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Paste mode with syntax error
|
||||
>>>
|
||||
>>> \$
|
||||
paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
===
|
||||
=== \$
|
||||
=== def bad_syntax(:
|
||||
=== print('Missing parameter')
|
||||
===
|
||||
=== \$
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 2
|
||||
SyntaxError: invalid syntax
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Paste mode with runtime error
|
||||
>>>
|
||||
>>> \$
|
||||
paste mode; Ctrl-C to cancel, Ctrl-D to finish
|
||||
===
|
||||
=== \$
|
||||
=== def will_error():
|
||||
=== undefined_variable
|
||||
===
|
||||
=== \$
|
||||
=== will_error()
|
||||
===
|
||||
=== \$
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 5, in <module>
|
||||
File "<stdin>", line 3, in will_error
|
||||
NameError: name 'undefined_variable' isn't defined
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # Final test to show REPL is still functioning
|
||||
>>> 1 + 2 + 3
|
||||
6
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -19,7 +19,7 @@ Type "help()" for more information.
|
||||
>>> # forward-word on eol. if cursor is moved, this will result in a SyntaxError
|
||||
>>> \.\+
|
||||
6
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # kill word
|
||||
>>> # backward-kill-word, start in word
|
||||
>>> \.\+
|
||||
@@ -33,7 +33,7 @@ Type "help()" for more information.
|
||||
>>> # forward-kill-word, don't start in word
|
||||
>>> \.\+
|
||||
3
|
||||
>>>
|
||||
>>> \$
|
||||
>>> # extra move/kill shortcuts
|
||||
>>> # ctrl-left
|
||||
>>> \.\+
|
||||
@@ -44,4 +44,4 @@ Type "help()" for more information.
|
||||
>>> # ctrl-w
|
||||
>>> \.\+
|
||||
1
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -4,4 +4,4 @@ Type "help()" for more information.
|
||||
>>> t = \.\+
|
||||
>>> t == 2
|
||||
True
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
@@ -4,4 +4,4 @@ Type "help()" for more information.
|
||||
>>> t = \.\+
|
||||
>>> t == 2
|
||||
True
|
||||
>>>
|
||||
>>> \$
|
||||
|
||||
Reference in New Issue
Block a user