Add tests for empty or non-empty match
This commit is contained in:
parent
02c6e7306f
commit
8b8224ecaf
1 changed files with 11 additions and 1 deletions
|
|
@ -1,6 +1,16 @@
|
||||||
import unittest, nre, optional_t.nonstrict
|
import unittest, nre, strutils, optional_t.nonstrict
|
||||||
|
|
||||||
suite "Misc tests":
|
suite "Misc tests":
|
||||||
test "unicode":
|
test "unicode":
|
||||||
check("".find(re("", "8")).match == "")
|
check("".find(re("", "8")).match == "")
|
||||||
check("перевірка".replace(re(r"\w", "uW"), "") == "")
|
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(":") == ":::")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue