From 39776d1a6513e33a33addb69deae72ab2ecafef4 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 1 Nov 2021 00:28:00 +0000 Subject: vim-patch:8.1.2011: more functions can be used as methods Problem: More functions can be used as methods. Solution: Make various functions usable as a method. Make the window command test faster. https://github.com/vim/vim/commit/ce90e36f5969e733a0a919f1736453332c33aad6 test_* functions in the patch are N/A as they modify internal state. Include test changes for test_ignore_error and test_feedinput (though they aren't run). Other changed tests were excluded from previous patches, except test_termcodes.vim, which hasn't been ported yet. --- src/nvim/eval.lua | 6 +++--- src/nvim/testdir/test_messages.vim | 2 +- src/nvim/testdir/test_taglist.vim | 2 +- src/nvim/testdir/test_timers.vim | 2 +- src/nvim/testdir/test_window_cmd.vim | 11 +++++++---- 5 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 2a12a4d119..d685387995 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -374,11 +374,11 @@ return { synstack={args=2}, system={args={1, 2}, base=1}, systemlist={args={1, 3}, base=1}, - tabpagebuflist={args={0, 1}}, + tabpagebuflist={args={0, 1}, base=1}, tabpagenr={args={0, 1}}, - tabpagewinnr={args={1, 2}}, + tabpagewinnr={args={1, 2}, base=1}, tagfiles={}, - taglist={args={1, 2}}, + taglist={args={1, 2}, base=1}, tan={args=1, base=1, func="float_op_wrapper", data="&tan"}, tanh={args=1, base=1, func="float_op_wrapper", data="&tanh"}, tempname={}, diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim index 08586dffe1..2140fe21ea 100644 --- a/src/nvim/testdir/test_messages.vim +++ b/src/nvim/testdir/test_messages.vim @@ -87,7 +87,7 @@ func Test_echoerr() if has('float') call assert_equal("\n1.23 IgNoRe", execute(':echoerr 1.23 "IgNoRe"')) endif - call test_ignore_error('') + eval ''->test_ignore_error() call assert_match("function('\\d*')", execute(':echoerr {-> 1234}')) call test_ignore_error('RESET') endfunc diff --git a/src/nvim/testdir/test_taglist.vim b/src/nvim/testdir/test_taglist.vim index e830813081..e11815ff33 100644 --- a/src/nvim/testdir/test_taglist.vim +++ b/src/nvim/testdir/test_taglist.vim @@ -14,7 +14,7 @@ func Test_taglist() split Xtext call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo"), {i, v -> v.name})) - call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xtext"), {i, v -> v.name})) + call assert_equal(['FFoo', 'BFoo'], map("Foo"->taglist("Xtext"), {i, v -> v.name})) call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xfoo"), {i, v -> v.name})) call assert_equal(['BFoo', 'FFoo'], map(taglist("Foo", "Xbar"), {i, v -> v.name})) diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index ceaa5de92b..e41a691467 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -239,7 +239,7 @@ func FeedAndPeek(timer) endfunc func Interrupt(timer) - " call test_feedinput("\") + " eval "\"->test_feedinput() call nvim_input("\") endfunc diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index 039de0c623..588ff5a103 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -452,7 +452,7 @@ func Test_window_newtab() wincmd T call assert_equal(2, tabpagenr('$')) call assert_equal(['Xb', 'Xa'], map(tabpagebuflist(1), 'bufname(v:val)')) - call assert_equal(['Xc' ], map(tabpagebuflist(2), 'bufname(v:val)')) + call assert_equal(['Xc' ], map(2->tabpagebuflist(), 'bufname(v:val)')) %bw! endfunc @@ -577,8 +577,11 @@ endfunc function! Fun_RenewFile() " Need to wait a bit for the timestamp to be older. - sleep 2 - silent execute '!echo "1" > tmp.txt' + let old_ftime = getftime("tmp.txt") + while getftime("tmp.txt") == old_ftime + sleep 100m + silent execute '!echo "1" > tmp.txt' + endwhile sp wincmd p edit! tmp.txt @@ -814,7 +817,7 @@ func Test_winnr() tabnew call assert_equal(8, tabpagewinnr(1, 'j')) - call assert_equal(2, tabpagewinnr(1, 'k')) + call assert_equal(2, 1->tabpagewinnr('k')) call assert_equal(4, tabpagewinnr(1, 'h')) call assert_equal(6, tabpagewinnr(1, 'l')) -- cgit