diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-08 22:37:07 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-08 22:38:23 -0400 |
commit | fe6cf2812b819297602ce355f8cfea157d64e110 (patch) | |
tree | 803f82173125c369e35b35c69a5297628b86961b /src/nvim/testdir/test_functions.vim | |
parent | 3c6eb9871a9a7423e57f5c47e090457b26b6407b (diff) | |
download | rneovim-fe6cf2812b819297602ce355f8cfea157d64e110.tar.gz rneovim-fe6cf2812b819297602ce355f8cfea157d64e110.tar.bz2 rneovim-fe6cf2812b819297602ce355f8cfea157d64e110.zip |
vim-patch:8.0.1105: match() and matchend() are not tested
Problem: match() and matchend() are not tested.
Solution: Add tests. (Ozaki Kiichi, closes vim/vim#2088)
https://github.com/vim/vim/commit/1190cf68e27a123cf9f6fb57897782a3b9f7b810
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 3b16f2ce9f..285c4e6327 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -573,10 +573,46 @@ func Test_strridx() call assert_equal(-1, strridx('hello', 'hello world')) endfunc +func Test_match_func() + call assert_equal(4, match('testing', 'ing')) + call assert_equal(4, match('testing', 'ing', 2)) + call assert_equal(-1, match('testing', 'ing', 5)) + call assert_equal(-1, match('testing', 'ing', 8)) + call assert_equal(1, match(['vim', 'testing', 'execute'], 'ing')) + call assert_equal(-1, match(['vim', 'testing', 'execute'], 'img')) +endfunc + func Test_matchend() call assert_equal(7, matchend('testing', 'ing')) call assert_equal(7, matchend('testing', 'ing', 2)) call assert_equal(-1, matchend('testing', 'ing', 5)) + call assert_equal(-1, matchend('testing', 'ing', 8)) + call assert_equal(match(['vim', 'testing', 'execute'], 'ing'), matchend(['vim', 'testing', 'execute'], 'ing')) + call assert_equal(match(['vim', 'testing', 'execute'], 'img'), matchend(['vim', 'testing', 'execute'], 'img')) +endfunc + +func Test_matchlist() + call assert_equal(['acd', 'a', '', 'c', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)')) + call assert_equal(['d', '', '', '', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2)) + call assert_equal([], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 4)) +endfunc + +func Test_matchstr() + call assert_equal('ing', matchstr('testing', 'ing')) + call assert_equal('ing', matchstr('testing', 'ing', 2)) + call assert_equal('', matchstr('testing', 'ing', 5)) + call assert_equal('', matchstr('testing', 'ing', 8)) + call assert_equal('testing', matchstr(['vim', 'testing', 'execute'], 'ing')) + call assert_equal('', matchstr(['vim', 'testing', 'execute'], 'img')) +endfunc + +func Test_matchstrpos() + call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing')) + call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2)) + call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5)) + call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 8)) + call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing')) + call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) endfunc func Test_nextnonblank_prevnonblank() |