Skip to content

Commit a7ffa97

Browse files
committed
tests: Add tests for non-compliant behaviour of lexer.
1 parent 558a016 commit a7ffa97

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

tests/misc/non_compliant_lexer.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# lexer tests for things that are not implemented, or have non-compliant behaviour
2+
3+
# uPy requires spaces between literal numbers and keywords, CPy doesn't
4+
try:
5+
eval('1and 0')
6+
except SyntaxError:
7+
print('SyntaxError')
8+
try:
9+
eval('1or 0')
10+
except SyntaxError:
11+
print('SyntaxError')
12+
try:
13+
eval('1if 1else 0')
14+
except SyntaxError:
15+
print('SyntaxError')
16+
try:
17+
eval('1if 0else 0')
18+
except SyntaxError:
19+
print('SyntaxError')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SyntaxError
2+
SyntaxError
3+
SyntaxError
4+
SyntaxError

0 commit comments

Comments
 (0)