summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-03-10 17:47:43 +0000
committerDamien George <damien.p.george@gmail.com>2015-03-10 17:47:43 +0000
commit55278dcc763e62513af02118e6bbd74707007e8d (patch)
treec7ff12f17051e4fcfd286a93fd504ab85041536a /tests
parent8dead2a6c64e8589e06e1e218d40e63aea18a009 (diff)
downloadmicropython-55278dcc763e62513af02118e6bbd74707007e8d.tar.gz
micropython-55278dcc763e62513af02118e6bbd74707007e8d.zip
tests: Add test for modure when regex has errors.
Diffstat (limited to 'tests')
-rw-r--r--tests/extmod/ure_error.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/extmod/ure_error.py b/tests/extmod/ure_error.py
new file mode 100644
index 0000000000..1e9f66a9e5
--- /dev/null
+++ b/tests/extmod/ure_error.py
@@ -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'([)')