summary refs log tree commit diff stats
path: root/tests/stdlib/nre/misc.nim
diff options
context:
space:
mode:
authorFlaviu Tamas <tamasflaviu@gmail.com>2015-05-26 19:14:04 -0400
committerFlaviu Tamas <tamasflaviu@gmail.com>2015-05-26 19:14:04 -0400
commit0527e1f9fe00642207d78213f7d1436f8aa5ef0d (patch)
tree72f1feef547355ae05bd51a61ca054273bf140e9 /tests/stdlib/nre/misc.nim
parent0d4aeec9be75bb75484507566a8dd36fa792c32c (diff)
downloadNim-0527e1f9fe00642207d78213f7d1436f8aa5ef0d.tar.gz
Rearrange nre files
Diffstat (limited to 'tests/stdlib/nre/misc.nim')
-rw-r--r--tests/stdlib/nre/misc.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/stdlib/nre/misc.nim b/tests/stdlib/nre/misc.nim
new file mode 100644
index 000000000..f4a88b639
--- /dev/null
+++ b/tests/stdlib/nre/misc.nim
@@ -0,0 +1,16 @@
+import unittest, nre, strutils, optional_nonstrict
+
+suite "Misc tests":
+  test "unicode":
+    check("".find(re"(*UTF8)").match == "")
+    check("перевірка".replace(re"(*U)\w", "") == "")
+
+  test "empty or non-empty match":
+    check("abc".findall(re"|.").join(":") == ":a::b::c:")
+    check("abc".findall(re".|").join(":") == "a:b:c:")
+
+    check("abc".replace(re"|.", "x") == "xxxxxxx")
+    check("abc".replace(re".|", "x") == "xxxx")
+
+    check("abc".split(re"|.").join(":") == ":::::")
+    check("abc".split(re".|").join(":") == ":::")