tests: Add test for modure when regex has errors.

This commit is contained in:
Damien George 2015-03-10 17:47:43 +00:00
parent 8dead2a6c6
commit 55278dcc76
1 changed files with 21 additions and 0 deletions

21
tests/extmod/ure_error.py Normal file
View File

@ -0,0 +1,21 @@
# test errors in regex
try:
import ure as re
except:
import re
def test_re(r):
try:
re.compile(r)
print("OK")
except: # uPy and CPy use different errors, so just ignore the type
print("Error")
test_re(r'?')
test_re(r'*')
test_re(r'+')
test_re(r')')
test_re(r'[')
test_re(r'([')
test_re(r'([)')