aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-09-17 10:47:17 -0400
committerGitHub <noreply@github.com>2021-09-17 10:47:17 -0400
commitd56002f7b722facd97b0958e141c8ed2d01495f7 (patch)
tree46e0a3bc02ba86b08e5dbf0cfeae7e615fae5b21 /src/nvim/testdir
parent867e8885991ae450019c18aa5e42546bd4b62c2c (diff)
parent1e0d563967d139dfe5f42993c90f888c5a48c634 (diff)
downloadrneovim-d56002f7b722facd97b0958e141c8ed2d01495f7.tar.gz
rneovim-d56002f7b722facd97b0958e141c8ed2d01495f7.tar.bz2
rneovim-d56002f7b722facd97b0958e141c8ed2d01495f7.zip
Merge pull request #15364 from seandewar/vim-8.2.3337
vim-patch:8.2.{3286,3289,3293,3298,3313,3321,3328,3330,3331,3337,3354,3355,3357,3360,3369,3375}
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_cmdline.vim15
-rw-r--r--src/nvim/testdir/test_excmd.vim36
-rw-r--r--src/nvim/testdir/test_ins_complete_no_halt.vim51
-rw-r--r--src/nvim/testdir/test_number.vim11
-rw-r--r--src/nvim/testdir/test_textformat.vim7
-rw-r--r--src/nvim/testdir/test_writefile.vim8
6 files changed, 127 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 8e2a145343..5a6824b5c1 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -599,13 +599,26 @@ endfunc
func Test_cmdline_complete_user_func()
call feedkeys(":func Test_cmdline_complete_user\<Tab>\<Home>\"\<cr>", 'tx')
- call assert_match('"func Test_cmdline_complete_user', @:)
+ call assert_match('"func Test_cmdline_complete_user_', @:)
call feedkeys(":func s:ScriptL\<Tab>\<Home>\"\<cr>", 'tx')
call assert_match('"func <SNR>\d\+_ScriptLocalFunction', @:)
" g: prefix also works
call feedkeys(":echo g:Test_cmdline_complete_user_f\<Tab>\<Home>\"\<cr>", 'tx')
call assert_match('"echo g:Test_cmdline_complete_user_func', @:)
+
+ " using g: prefix does not result in just "g:" matches from a lambda
+ let Fx = { a -> a }
+ call feedkeys(":echo g:\<Tab>\<Home>\"\<cr>", 'tx')
+ call assert_match('"echo g:[A-Z]', @:)
+
+ " existence of script-local dict function does not break user function name
+ " completion
+ function s:a_dict_func() dict
+ endfunction
+ call feedkeys(":call Test_cmdline_complete_user\<Tab>\<Home>\"\<cr>", 'tx')
+ call assert_match('"call Test_cmdline_complete_user_', @:)
+ delfunction s:a_dict_func
endfunc
func Test_cmdline_complete_user_names()
diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim
index ed2bb2c06b..2d01cbba83 100644
--- a/src/nvim/testdir/test_excmd.vim
+++ b/src/nvim/testdir/test_excmd.vim
@@ -313,6 +313,42 @@ func Test_confirm_write_ro()
call delete('Xconfirm_write_ro')
endfunc
+func Test_confirm_write_partial_file()
+ CheckNotGui
+ CheckRunVimInTerminal
+
+ call writefile(['a', 'b', 'c', 'd'], 'Xwrite_partial')
+ call writefile(['set nobackup ff=unix cmdheight=2',
+ \ 'edit Xwrite_partial'], 'Xscript')
+ let buf = RunVimInTerminal('-S Xscript', {'rows': 20})
+
+ call term_sendkeys(buf, ":confirm 2,3w\n")
+ call WaitForAssert({-> assert_match('^Write partial file? *$',
+ \ term_getline(buf, 19))}, 1000)
+ call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$',
+ \ term_getline(buf, 20))}, 1000)
+ call term_sendkeys(buf, 'N')
+ call WaitForAssert({-> assert_match('.* All$', term_getline(buf, 20))}, 1000)
+ call assert_equal(['a', 'b', 'c', 'd'], readfile('Xwrite_partial'))
+ call delete('Xwrite_partial')
+
+ call term_sendkeys(buf, ":confirm 2,3w\n")
+ call WaitForAssert({-> assert_match('^Write partial file? *$',
+ \ term_getline(buf, 19))}, 1000)
+ call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$',
+ \ term_getline(buf, 20))}, 1000)
+ call term_sendkeys(buf, 'Y')
+ call WaitForAssert({-> assert_match('^"Xwrite_partial" \[New\] 2L, 4B written *$',
+ \ term_getline(buf, 19))}, 1000)
+ call WaitForAssert({-> assert_match('^Press ENTER or type command to continue *$',
+ \ term_getline(buf, 20))}, 1000)
+ call assert_equal(['b', 'c'], readfile('Xwrite_partial'))
+
+ call StopVimInTerminal(buf)
+ call delete('Xwrite_partial')
+ call delete('Xscript')
+endfunc
+
" Test for the :winsize command
func Test_winsize_cmd()
call assert_fails('winsize 1', 'E465:')
diff --git a/src/nvim/testdir/test_ins_complete_no_halt.vim b/src/nvim/testdir/test_ins_complete_no_halt.vim
new file mode 100644
index 0000000000..e12925daa9
--- /dev/null
+++ b/src/nvim/testdir/test_ins_complete_no_halt.vim
@@ -0,0 +1,51 @@
+" Test insert mode completion does not get stuck when looping around.
+" In a separate file to avoid the settings to leak to other test cases.
+
+set complete+=kspell
+set completeopt+=menu
+set completeopt+=menuone
+set completeopt+=noselect
+set completeopt+=noinsert
+let g:autocompletion = v:true
+
+func Test_ins_complete_no_halt()
+ function! OpenCompletion()
+ if pumvisible() && (g:autocompletion == v:true)
+ call feedkeys("\<C-e>\<C-n>", "i")
+ return
+ endif
+ if ((v:char >= 'a' && v:char <= 'z') || (v:char >= 'A' && v:char <= 'Z')) && (g:autocompletion == v:true)
+ call feedkeys("\<C-n>", "i")
+ redraw
+ endif
+ endfunction
+
+ autocmd InsertCharPre * noautocmd call OpenCompletion()
+
+ setlocal spell! spelllang=en_us
+
+ call feedkeys("iauto-complete-halt-test test test test test test test test test test test test test test test test test test test\<C-c>", "tx!")
+ call assert_equal(["auto-complete-halt-test test test test test test test test test test test test test test test test test test test"], getline(1, "$"))
+endfunc
+
+func Test_auto_complete_backwards_no_halt()
+ function! OpenCompletion()
+ if pumvisible() && (g:autocompletion == v:true)
+ call feedkeys("\<C-e>\<C-p>", "i")
+ return
+ endif
+ if ((v:char >= 'a' && v:char <= 'z') || (v:char >= 'A' && v:char <= 'Z')) && (g:autocompletion == v:true)
+ call feedkeys("\<C-p>", "i")
+ redraw
+ endif
+ endfunction
+
+ autocmd InsertCharPre * noautocmd call OpenCompletion()
+
+ setlocal spell! spelllang=en_us
+
+ call feedkeys("iauto-complete-halt-test test test test test test test test test test test test test test test test test test test\<C-c>", "tx!")
+ call assert_equal(["auto-complete-halt-test test test test test test test test test test test test test test test test test test test"], getline(1, "$"))
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_number.vim b/src/nvim/testdir/test_number.vim
index 92a1bf3c9a..d737ebe9f0 100644
--- a/src/nvim/testdir/test_number.vim
+++ b/src/nvim/testdir/test_number.vim
@@ -320,4 +320,15 @@ func Test_number_rightleft()
bw!
endfunc
+" This used to cause a divide by zero
+func Test_number_no_text_virtual_edit()
+ vnew
+ call setline(1, ['line one', 'line two'])
+ set number virtualedit=all
+ normal w
+ 4wincmd |
+ normal j
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim
index 29f0433954..bf0706a0c2 100644
--- a/src/nvim/testdir/test_textformat.vim
+++ b/src/nvim/testdir/test_textformat.vim
@@ -975,6 +975,13 @@ func Test_fo_a_w()
exe "normal f4xx"
call assert_equal(['1 2 5 6 7 ', '8 9'], getline(1, 2))
+ " using "cw" leaves cursor in right spot
+ call setline(1, ['Now we g whether that nation, or',
+ \ 'any nation so conceived and,'])
+ set fo=tcqa tw=35
+ exe "normal 2G0cwx\<Esc>"
+ call assert_equal(['Now we g whether that nation, or x', 'nation so conceived and,'], getline(1, 2))
+
set tw=0
set fo&
%bw!
diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim
index 2504fcb14e..aa7882d129 100644
--- a/src/nvim/testdir/test_writefile.vim
+++ b/src/nvim/testdir/test_writefile.vim
@@ -191,6 +191,14 @@ func Test_saveas()
close!
enew | only
call delete('Xfile')
+
+ " :saveas should detect and set the file type.
+ syntax on
+ saveas! Xsaveas.pl
+ call assert_equal('perl', &filetype)
+ syntax off
+ %bw!
+ call delete('Xsaveas.pl')
endfunc
func Test_write_errors()