tests: Add test for modure when regex has errors.
This commit is contained in:
parent
8dead2a6c6
commit
55278dcc76
|
@ -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'([)')
|
Loading…
Reference in New Issue