mirror of
https://github.com/inkarkat/vim-ingo-library.git
synced 2026-10-25 08:15:10 +01:00
14 lines
759 B
VimL
14 lines
759 B
VimL
" Test counting matches in text.
|
|
|
|
call vimtest#StartTap()
|
|
call vimtap#Plan(6)
|
|
|
|
call vimtap#Is(ingo#matches#CountMatches('foobar', ''), 7, 'matches before / after every character with empty pattern')
|
|
call vimtap#Is(ingo#matches#CountMatches('', 'o\+'), 0, 'no matches with empty text')
|
|
call vimtap#Is(ingo#matches#CountMatches('our house is foobar', 'o\+'), 3, '3 occurrences of o\+ in String')
|
|
call vimtap#Is(ingo#matches#CountMatches(['our', 'house', 'is', 'foobar'], 'o\+'), 3, '3 occurrences of o\+ in List')
|
|
call vimtap#Is(ingo#matches#CountMatches('our house is foobar', '.*'), 1, '1 occurrence of .* with String')
|
|
call vimtap#Is(ingo#matches#CountMatches(['our', 'house', 'is', 'foobar', ''], '.*'), 5, '5 of .* in 5-element List')
|
|
|
|
call vimtest#Quit()
|