misc.nim 548 B

1234567891011121314151617
  1. import unittest, nre, strutils, optional_nonstrict
  2. suite "Misc tests":
  3. test "unicode":
  4. check("".find(re"(*UTF8)").match == "")
  5. check("перевірка".replace(re"(*U)\w", "") == "")
  6. test "empty or non-empty match":
  7. check("abc".findall(re"|.").join(":") == ":a::b::c:")
  8. check("abc".findall(re".|").join(":") == "a:b:c:")
  9. check("abc".replace(re"|.", "x") == "xxxxxxx")
  10. check("abc".replace(re".|", "x") == "xxxx")
  11. check("abc".split(re"|.").join(":") == ":::::")
  12. check("abc".split(re".|").join(":") == ":::")