diff options
Diffstat (limited to 'tests/stdlib/nre/misc.nim')
-rw-r--r-- | tests/stdlib/nre/misc.nim | 16 |
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(":") == ":::") |