Files
2018-10-09 08:45:22 +02:00

14 lines
681 B
VimL

" Test removal of leading and trailing pattern.
call vimtest#StartTap()
call vimtap#Plan(5)
call vimtap#Is(ingo#str#TrimPattern('', '[xX]\+'), '', 'no-op on empty string')
call vimtap#Is(ingo#str#TrimPattern('fox bar', '[xX]\+'), 'fox bar', 'no surrounding matches, inner kept intact')
call vimtap#Is(ingo#str#TrimPattern('xXxXfox barXx', '[xX]\+'), 'fox bar', 'remove surrounding matches')
call vimtap#Is(ingo#str#TrimPattern('xXxXfox barXxX', 'x\+', 'X\+'), 'XxXfox barXx', 'use different patterns for leading and trailing matches')
call vimtap#Is(ingo#str#TrimPattern('xXxXfox barXx', '[uU]\+', '[xX]\+'), 'xXxXfox bar', 'only trailing pattern matches')
call vimtest#Quit()