summary refs log tree commit diff stats
path: root/tests/stdlib/nre/misc.nim
blob: f4a88b639b6185bd1af4bf6ce8f4188ecce39913 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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(":") == ":::")
an class="bp">self, *keys): """Change the colors from now on.""" keys = flatten(keys) attr = self.settings.colorscheme.get_attr(*keys) try: self.win.attrset(attr) except _curses.error: pass def color_at(self, y, x, wid, *keys): """Change the colors at the specified position""" keys = flatten(keys) attr = self.settings.colorscheme.get_attr(*keys) try: self.win.chgat(y, x, wid, attr) except _curses.error: pass def color_reset(self): """Change the colors to the default colors""" CursesShortcuts.color(self, 'reset')