patch 8.1.1993: more functions can be used as methods
Problem: More functions can be used as methods.
Solution: Make various functions usable as a method.
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index dbe4c2a..190755a 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1280,7 +1280,7 @@
normal gg
- call search('foobar', 'c')
+ eval 'foobar'->search('c')
call assert_equal([1, 1], [line('.'), col('.')])
normal j
@@ -1318,3 +1318,38 @@
set norl
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