Add tests for empty or non-empty match

This commit is contained in:
Oleh Prypin
2015-04-12 17:31:43 +03:00
parent 02c6e7306f
commit 8b8224ecaf

View File

@@ -1,6 +1,16 @@
import unittest, nre, optional_t.nonstrict
import unittest, nre, strutils, optional_t.nonstrict
suite "Misc tests":
test "unicode":
check("".find(re("", "8")).match == "")
check("перевірка".replace(re(r"\w", "uW"), "") == "")
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(":") == ":::")