0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.0615: regexp benchmark stest is old style

Problem:    Regexp benchmark stest is old style.
Solution:   Make it a new style test.  Fix using a NULL list.  Add more tests.
            (Yegappan Lakshmanan, closes #5963)
This commit is contained in:
Bram Moolenaar
2020-04-21 22:19:45 +02:00
parent ff06f283e3
commit ad48e6c159
19 changed files with 179 additions and 44 deletions

View File

@@ -794,18 +794,41 @@ func Test_mode()
set complete&
endfunc
" Test for append()
func Test_append()
enew!
split
call append(0, ["foo"])
call append(1, [])
call append(1, test_null_list())
call assert_equal(['foo', ''], getline(1, '$'))
split
only
undo
undo
" Using $ instead of '$' must give an error
call assert_fails("call append($, 'foobar')", 'E116:')
endfunc
" Test for setline()
func Test_setline()
new
call setline(0, ["foo"])
call setline(0, [])
call setline(0, test_null_list())
call setline(1, ["bar"])
call setline(1, [])
call setline(1, test_null_list())
call setline(2, [])
call setline(2, test_null_list())
call setline(3, [])
call setline(3, test_null_list())
call setline(2, ["baz"])
call assert_equal(['bar', 'baz'], getline(1, '$'))
close!
endfunc
func Test_getbufvar()
let bnr = bufnr('%')
let b:var_num = '1234'
@@ -913,6 +936,7 @@ func Test_match_func()
call assert_equal(-1, match(['a', 'b', 'c', 'a'], 'a', 5))
call assert_equal(4, match('testing', 'ing', -1))
call assert_fails("let x=match('testing', 'ing', 0, [])", 'E745:')
call assert_equal(-1, match(test_null_list(), 2))
endfunc
func Test_matchend()
@@ -1796,6 +1820,7 @@ func Test_call()
call assert_equal(3, 'len'->call([123]))
call assert_fails("call call('len', 123)", 'E714:')
call assert_equal(0, call('', []))
call assert_equal(0, call('len', test_null_list()))
function Mylen() dict
return len(self.data)
@@ -1962,7 +1987,6 @@ func Test_range()
execute "normal! a\<C-r>=[complete(col('.'), range(10)), ''][1]\<CR>"
" complete_info()
execute "normal! a\<C-r>=[complete(col('.'), range(10)), ''][1]\<CR>\<C-r>=[complete_info(range(5)), ''][1]\<CR>"
call assert_fails('call complete(1, ["a"])', 'E785:')
" copy()
call assert_equal([1, 2, 3], copy(range(1, 3)))