mirror of
https://github.com/neovim/neovim.git
synced 2026-07-30 04:18:02 +00:00
feat(eval/method): partially port v8.1.1993
Problem: More functions can be used as methods.
Solution: Make various functions usable as a method.
196b466443
server2client requires +clientserver, which hasn't been ported yet.
The eval.txt docs and test_clientserver.vim tests for server2client already exist, so include those
changes.
test_bufline.vim: Test for setbufline requires v8.1.1189 (which was reverted in #10848).
This commit is contained in:
@@ -1315,7 +1315,7 @@ func Test_search_match_at_curpos()
|
||||
|
||||
normal gg
|
||||
|
||||
call search('foobar', 'c')
|
||||
eval 'foobar'->search('c')
|
||||
call assert_equal([1, 1], [line('.'), col('.')])
|
||||
|
||||
normal j
|
||||
@@ -1354,6 +1354,41 @@ func Test_search_display_pattern()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_searchdecl()
|
||||
let lines =<< trim END
|
||||
int global;
|
||||
|
||||
func()
|
||||
{
|
||||
int global;
|
||||
if (cond) {
|
||||
int local;
|
||||
}
|
||||
int local;
|
||||
// comment
|
||||
}
|
||||
END
|
||||
new
|
||||
call setline(1, lines)
|
||||
10
|
||||
call assert_equal(0, searchdecl('local', 0, 0))
|
||||
call assert_equal(7, getcurpos()[1])
|
||||
|
||||
10
|
||||
call assert_equal(0, 'local'->searchdecl(0, 1))
|
||||
call assert_equal(9, getcurpos()[1])
|
||||
|
||||
10
|
||||
call assert_equal(0, searchdecl('global'))
|
||||
call assert_equal(5, getcurpos()[1])
|
||||
|
||||
10
|
||||
call assert_equal(0, searchdecl('global', 1))
|
||||
call assert_equal(1, getcurpos()[1])
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_search_special()
|
||||
" this was causing illegal memory access and an endless loop
|
||||
set t_PE=
|
||||
|
||||
Reference in New Issue
Block a user