From ed0a70087a15621e7f45567feef1900f348c0916 Mon Sep 17 00:00:00 2001 From: Alex Genco Date: Sat, 17 Oct 2020 07:36:36 -0700 Subject: vim-patch:8.1.1056: no eval function for Ruby Problem: No eval function for Ruby. Solution: Add rubyeval(). (Ozaki Kiichi, closes vim/vim#4152) https://github.com/vim/vim/commit/e99be0e6d28fad96efd2b2be23fa38e7559e80e1 --- src/nvim/testdir/test_ruby.vim | 132 +++++++++++++++++++++-------------------- 1 file changed, 69 insertions(+), 63 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ruby.vim b/src/nvim/testdir/test_ruby.vim index 77a42e0a8a..07ad8561c3 100644 --- a/src/nvim/testdir/test_ruby.vim +++ b/src/nvim/testdir/test_ruby.vim @@ -4,13 +4,6 @@ if !has('ruby') finish end -" Helper function as there is no builtin rubyeval() function similar -" to perleval, luaevel() or pyeval(). -func RubyEval(ruby_expr) - let s = split(execute('ruby print ' . a:ruby_expr), "\n") - return (len(s) == 0) ? '' : s[-1] -endfunc - func Test_ruby_change_buffer() call setline(line('$'), ['1 line 1']) ruby Vim.command("normal /^1\n") @@ -50,12 +43,12 @@ func Test_set_cursor() normal gg rubydo $curwin.cursor = [1, 5] call assert_equal([1, 6], [line('.'), col('.')]) - call assert_equal('[1, 5]', RubyEval('$curwin.cursor')) + call assert_equal([1, 5], rubyeval('$curwin.cursor')) " Check that movement after setting cursor position keeps current column. normal j call assert_equal([2, 6], [line('.'), col('.')]) - call assert_equal('[2, 5]', RubyEval('$curwin.cursor')) + call assert_equal([2, 5], rubyeval('$curwin.cursor')) " call assert_fails('ruby $curwin.cursor = [1]', " \ 'ArgumentError: array length must be 2') @@ -66,25 +59,25 @@ endfunc func Test_buffer_count() new call setline(1, ['one', 'two', 'three']) - call assert_equal('3', RubyEval('$curbuf.count')) - call assert_equal('3', RubyEval('$curbuf.length')) + call assert_equal(3, rubyeval('$curbuf.count')) + call assert_equal(3, rubyeval('$curbuf.length')) bwipe! endfunc " Test buffer.name (buffer name) func Test_buffer_name() new Xfoo - call assert_equal(expand('%:p'), RubyEval('$curbuf.name')) + call assert_equal(expand('%:p'), rubyeval('$curbuf.name')) bwipe - call assert_equal('', RubyEval('$curbuf.name')) + call assert_equal('', rubyeval('$curbuf.name')) endfunc " Test buffer.number (number of the buffer). func Test_buffer_number() new - call assert_equal(string(bufnr('%')), RubyEval('$curbuf.number')) + call assert_equal(bufnr('%'), rubyeval('$curbuf.number')) new - call assert_equal(string(bufnr('%')), RubyEval('$curbuf.number')) + call assert_equal(bufnr('%'), rubyeval('$curbuf.number')) %bwipe endfunc @@ -128,7 +121,7 @@ func Test_buffer_line() new call setline(1, ['one', 'two', 'three']) 2 - call assert_equal('two', RubyEval('$curbuf.line')) + call assert_equal('two', rubyeval('$curbuf.line')) ruby $curbuf.line = 'TWO' call assert_equal(['one', 'TWO', 'three'], getline(1, '$')) @@ -141,7 +134,7 @@ func Test_buffer_line_number() new call setline(1, ['one', 'two', 'three']) 2 - call assert_equal('2', RubyEval('$curbuf.line_number')) + call assert_equal(2, rubyeval('$curbuf.line_number')) bwipe! endfunc @@ -149,8 +142,8 @@ endfunc func Test_buffer_get() new call setline(1, ['one', 'two']) - call assert_equal('one', RubyEval('$curbuf[1]')) - call assert_equal('two', RubyEval('$curbuf[2]')) + call assert_equal('one', rubyeval('$curbuf[1]')) + call assert_equal('two', rubyeval('$curbuf[2]')) " call assert_fails('ruby $curbuf[0]', " \ 'IndexError: line number 0 out of range') @@ -184,7 +177,7 @@ func Test_window_height() call assert_equal(2, winheight(0)) " Test getting window height - call assert_equal('2', RubyEval('$curwin.height')) + call assert_equal(2, rubyeval('$curwin.height')) bwipe endfunc @@ -198,7 +191,7 @@ func Test_window_width() call assert_equal(2, winwidth(0)) " Test getting window width - call assert_equal('2', RubyEval('$curwin.width')) + call assert_equal(2, rubyeval('$curwin.width')) bwipe endfunc @@ -213,10 +206,10 @@ func Test_window_buffer() ruby $b1 = $curwin.buffer ruby $w1 = $curwin - " call assert_equal(RubyEval('$b1'), RubyEval('$w1.buffer')) - " call assert_equal(RubyEval('$b2'), RubyEval('$w2.buffer')) - call assert_equal(string(bufnr('Xfoo1')), RubyEval('$w1.buffer.number')) - call assert_equal(string(bufnr('Xfoo2')), RubyEval('$w2.buffer.number')) + " call assert_equal(rubyeval('$b1'), rubyeval('$w1.buffer')) + " call assert_equal(rubyeval('$b2'), rubyeval('$w2.buffer')) + call assert_equal(bufnr('Xfoo1'), rubyeval('$w1.buffer.number')) + call assert_equal(bufnr('Xfoo2'), rubyeval('$w2.buffer.number')) ruby $b1, $w1, $b2, $w2 = nil %bwipe @@ -224,8 +217,8 @@ endfunc " Test Vim::Window.current (get current window object) func Test_Vim_window_current() - let cw = RubyEval('$curwin') - " call assert_equal(cw, RubyEval('Vim::Window.current')) + let cw = rubyeval('$curwin.to_s') + " call assert_equal(cw, rubyeval('Vim::Window.current')) call assert_match('^#$', cw) endfunc @@ -234,27 +227,27 @@ func Test_Vim_window_count() new Xfoo1 new Xfoo2 split - call assert_equal('4', RubyEval('Vim::Window.count')) + call assert_equal(4, rubyeval('Vim::Window.count')) %bwipe - call assert_equal('1', RubyEval('Vim::Window.count')) + call assert_equal(1, rubyeval('Vim::Window.count')) endfunc " Test Vim::Window[n] (get window object of window n) func Test_Vim_window_get() new Xfoo1 new Xfoo2 - call assert_match('Xfoo2$', RubyEval('Vim::Window[0].buffer.name')) + call assert_match('Xfoo2$', rubyeval('Vim::Window[0].buffer.name')) wincmd j - call assert_match('Xfoo1$', RubyEval('Vim::Window[1].buffer.name')) + call assert_match('Xfoo1$', rubyeval('Vim::Window[1].buffer.name')) wincmd j - call assert_equal('', RubyEval('Vim::Window[2].buffer.name')) + call assert_equal('', rubyeval('Vim::Window[2].buffer.name')) %bwipe endfunc " Test Vim::Buffer.current (return the buffer object of current buffer) func Test_Vim_buffer_current() - let cb = RubyEval('$curbuf') - " call assert_equal(cb, RubyEval('Vim::Buffer.current')) + let cb = rubyeval('$curbuf.to_s') + " call assert_equal(cb, rubyeval('Vim::Buffer.current')) call assert_match('^#$', cb) endfunc @@ -262,9 +255,9 @@ endfunc func Test_Vim_buffer_count() new Xfoo1 new Xfoo2 - call assert_equal('3', RubyEval('Vim::Buffer.count')) + call assert_equal(3, rubyeval('Vim::Buffer.count')) %bwipe - call assert_equal('1', RubyEval('Vim::Buffer.count')) + call assert_equal(1, rubyeval('Vim::Buffer.count')) endfunc " Test Vim::buffer[n] (return the buffer object of buffer number n) @@ -273,9 +266,9 @@ func Test_Vim_buffer_get() new Xfoo2 " Index of Vim::Buffer[n] goes from 0 to the number of buffers. - call assert_equal('', RubyEval('Vim::Buffer[0].name')) - call assert_match('Xfoo1$', RubyEval('Vim::Buffer[1].name')) - call assert_match('Xfoo2$', RubyEval('Vim::Buffer[2].name')) + call assert_equal('', rubyeval('Vim::Buffer[0].name')) + call assert_match('Xfoo1$', rubyeval('Vim::Buffer[1].name')) + call assert_match('Xfoo2$', rubyeval('Vim::Buffer[2].name')) call assert_fails('ruby print Vim::Buffer[3].name', \ "NoMethodError: undefined method `name' for nil:NilClass") %bwipe @@ -301,33 +294,33 @@ func Test_Vim_set_option() endfunc func Test_Vim_evaluate() - call assert_equal('123', RubyEval('Vim::evaluate("123")')) + call assert_equal(123, rubyeval('Vim::evaluate("123")')) " Vim::evaluate("123").class gives Integer or Fixnum depending " on versions of Ruby. - call assert_match('^Integer\|Fixnum$', RubyEval('Vim::evaluate("123").class')) + call assert_match('^Integer\|Fixnum$', rubyeval('Vim::evaluate("123").class')) - call assert_equal('1.23', RubyEval('Vim::evaluate("1.23")')) - call assert_equal('Float', RubyEval('Vim::evaluate("1.23").class')) + call assert_equal(1.23, rubyeval('Vim::evaluate("1.23")')) + call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class')) - call assert_equal('foo', RubyEval('Vim::evaluate("\"foo\"")')) - call assert_equal('String', RubyEval('Vim::evaluate("\"foo\"").class')) + call assert_equal('foo', rubyeval('Vim::evaluate("\"foo\"")')) + call assert_equal('String', rubyeval('Vim::evaluate("\"foo\"").class')) - call assert_equal('[1, 2]', RubyEval('Vim::evaluate("[1, 2]")')) - call assert_equal('Array', RubyEval('Vim::evaluate("[1, 2]").class')) + call assert_equal([1, 2], rubyeval('Vim::evaluate("[1, 2]")')) + call assert_equal('Array', rubyeval('Vim::evaluate("[1, 2]").class')) - call assert_equal('{"1"=>2}', RubyEval('Vim::evaluate("{1:2}")')) - call assert_equal('Hash', RubyEval('Vim::evaluate("{1:2}").class')) + call assert_equal({'1': 2}, rubyeval('Vim::evaluate("{1:2}")')) + call assert_equal('Hash', rubyeval('Vim::evaluate("{1:2}").class')) - call assert_equal('', RubyEval('Vim::evaluate("v:null")')) - call assert_equal('NilClass', RubyEval('Vim::evaluate("v:null").class')) + call assert_equal(v:null, rubyeval('Vim::evaluate("v:null")')) + call assert_equal('NilClass', rubyeval('Vim::evaluate("v:null").class')) - " call assert_equal('', RubyEval('Vim::evaluate("v:none")')) - " call assert_equal('NilClass', RubyEval('Vim::evaluate("v:none").class')) + " call assert_equal(v:null, rubyeval('Vim::evaluate("v:none")')) + " call assert_equal('NilClass', rubyeval('Vim::evaluate("v:none").class')) - call assert_equal('true', RubyEval('Vim::evaluate("v:true")')) - call assert_equal('TrueClass', RubyEval('Vim::evaluate("v:true").class')) - call assert_equal('false', RubyEval('Vim::evaluate("v:false")')) - call assert_equal('FalseClass',RubyEval('Vim::evaluate("v:false").class')) + call assert_equal(v:true, rubyeval('Vim::evaluate("v:true")')) + call assert_equal('TrueClass', rubyeval('Vim::evaluate("v:true").class')) + call assert_equal(v:false, rubyeval('Vim::evaluate("v:false")')) + call assert_equal('FalseClass',rubyeval('Vim::evaluate("v:false").class')) endfunc func Test_Vim_evaluate_list() @@ -361,9 +354,22 @@ func Test_Vim_message() endfunc func Test_print() - ruby print "Hello World!" - let messages = split(execute('message'), "\n") - call assert_equal('Hello World!', messages[-1]) + func RubyPrint(expr) + return trim(execute('ruby print ' . a:expr)) + endfunc + + call assert_equal('123', RubyPrint('123')) + call assert_equal('1.23', RubyPrint('1.23')) + call assert_equal('Hello World!', RubyPrint('"Hello World!"')) + call assert_equal('[1, 2]', RubyPrint('[1, 2]')) + call assert_equal('{"k1"=>"v1", "k2"=>"v2"}', RubyPrint('({"k1" => "v1", "k2" => "v2"})')) + call assert_equal('true', RubyPrint('true')) + call assert_equal('false', RubyPrint('false')) + call assert_equal('', RubyPrint('nil')) + call assert_match('Vim', RubyPrint('Vim')) + call assert_match('Module', RubyPrint('Vim.class')) + + delfunc RubyPrint endfunc func Test_p() @@ -373,13 +379,13 @@ func Test_p() " Check return values of p method - call assert_equal('123', RubyEval('p(123)')) - call assert_equal('[1, 2, 3]', RubyEval('p(1, 2, 3)')) + call assert_equal(123, rubyeval('p(123)')) + call assert_equal([1, 2, 3], rubyeval('p(1, 2, 3)')) " Avoid the "message maintainer" line. let $LANG = '' messages clear - call assert_equal('true', RubyEval('p() == nil')) + call assert_equal(v:true, rubyeval('p() == nil')) let messages = split(execute('message'), "\n") call assert_equal(0, len(messages)) -- cgit From 3f0850e9f053db6e1e5b4911c975c13f4a1624b0 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 21 Oct 2020 23:25:21 -0400 Subject: vim-patch:8.2.1874: can't do something just before leaving Insert mode Problem: Can't do something just before leaving Insert mode. Solution: Add the InsertLeavePre autocommand event. (closes vim/vim#7177) https://github.com/vim/vim/commit/b53e13a91ab2fc9d52bd044715daa84972f4ce47 N/A patches for version.c: vim-patch:8.1.1877: graduated features scattered Problem: Graduated features scattered. Solution: Put graduated and obsolete features together. https://github.com/vim/vim/commit/ffc0716af8e448ef8a2a3249edfd0260546933df vim-patch:8.2.1875: warning when building GTK gui Problem: Warning when building GTK gui. Solution: Add missing function parameter. https://github.com/vim/vim/commit/3da855c8e28140d9f02b1572e445f8d4f977cf64 vim-patch:8.2.1877: test for function list fails Problem: Test for function list fails. Solution: Move "obsolete" comments one line up. https://github.com/vim/vim/commit/b8f519e5382f9876ae7f8bc64d9814d07a8ef972 vim-patch:8.2.1878: GTK: error for redefining function Problem: GTK: error for redefining function. (Tony Mechelynck) Solution: Remove "gtk_" prefix from local functions and prepend "gui_" to global functions. https://github.com/vim/vim/commit/8a99e66b4f7616d9b0b9cefe742f82f9122087d5 vim-patch:8.2.1881: cannot build with GTK3 Problem: Cannot build with GTK3. Solution: Adjust form functions. https://github.com/vim/vim/commit/692d1a51e74fea2db3c7e9ae7c7c6c3a1a1945ee vim-patch:8.2.1883: compiler warnings when using Python Problem: Compiler warnings when using Python. Solution: Adjust PyCFunction to also have the second argument. Use "int" return type for some functions. Insert "(void *)" to get rid of the remaining warnings. https://github.com/vim/vim/commit/4ce5fe4c87820c7d22964d6e91d7b07e96640e6f --- src/nvim/testdir/test_edit.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim index caebc341e0..15c718b243 100644 --- a/src/nvim/testdir/test_edit.vim +++ b/src/nvim/testdir/test_edit.vim @@ -1441,31 +1441,40 @@ endfunc func Test_edit_InsertLeave() new + au InsertLeavePre * let g:did_au_pre = 1 au InsertLeave * let g:did_au = 1 + let g:did_au_pre = 0 let g:did_au = 0 call feedkeys("afoo\", 'tx') + call assert_equal(1, g:did_au_pre) call assert_equal(1, g:did_au) call assert_equal('foo', getline(1)) + let g:did_au_pre = 0 let g:did_au = 0 call feedkeys("Sbar\", 'tx') + call assert_equal(1, g:did_au_pre) call assert_equal(0, g:did_au) call assert_equal('bar', getline(1)) inoremap x xx + let g:did_au_pre = 0 let g:did_au = 0 call feedkeys("Saax", 'tx') + call assert_equal(1, g:did_au_pre) call assert_equal(1, g:did_au) call assert_equal('aaxx', getline(1)) inoremap x xx + let g:did_au_pre = 0 let g:did_au = 0 call feedkeys("Sbbx", 'tx') + call assert_equal(1, g:did_au_pre) call assert_equal(0, g:did_au) call assert_equal('bbxx', getline(1)) bwipe! - au! InsertLeave + au! InsertLeave InsertLeavePre iunmap x endfunc -- cgit From d69a8a3fc4ad24b51817e5fd90cf2081cb981977 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 22 Oct 2020 00:30:07 -0400 Subject: vim-patch:8.2.0952: no simple way to interrupt Vim Problem: No simple way to interrupt Vim. Solution: Add the SigUSR1 autocommand, triggered by SIGUSR1. (Jacob Hayes, closes vim/vim#1718) https://github.com/vim/vim/commit/be5ee8686a50acf07b823bd293f9c765e533d213 --- src/nvim/testdir/test_autocmd.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 094bb3ebd1..04a678eeb8 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -1897,4 +1897,17 @@ func Test_autocmd_FileReadCmd() delfunc ReadFileCmd endfunc +" Tests for SigUSR1 autocmd event, which is only available on posix systems. +func Test_autocmd_sigusr1() + CheckUnix + + let g:sigusr1_passed = 0 + au Signal SIGUSR1 let g:sigusr1_passed = 1 + call system('/bin/kill -s usr1 ' . getpid()) + call WaitForAssert({-> assert_true(g:sigusr1_passed)}) + + au! Signal + unlet g:sigusr1_passed +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 49b8d43052ef2610e1fa87c484daa735a79c79ee Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 22 Oct 2020 18:26:03 -0400 Subject: vim-patch:8.2.1885: filetype tests unnessarily creates swap files Problem: Filetype tests unnessarily creates swap files. Solution: Disable 'swapfile'. (Ken Takata, closes vim/vim#7183) https://github.com/vim/vim/commit/2733779a1a36c06f5f900666ac94bfe4c25ea39b N/A patches for version.c: vim-patch:8.2.1887: Github actions not optimally configured Problem: Github actions not optimally configured. Solution: Run CI on any pushed branches. Set fail-fast. (Ozaki Kiichi, closes vim/vim#7184) https://github.com/vim/vim/commit/15ab48f088842de512ca5f13aa39a4dc7cac8477 --- src/nvim/testdir/test_filetype.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index c7ca682c8c..9f79c1b545 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -532,6 +532,7 @@ let s:filename_case_checks = { \ } func CheckItems(checks) + set noswapfile for [ft, names] in items(a:checks) for i in range(0, len(names) - 1) new @@ -548,6 +549,7 @@ func CheckItems(checks) bwipe! endfor endfor + set swapfile& endfunc func Test_filetype_detection() -- cgit From 2894649c2ea89642705cfe3b1e7912335a13bad5 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 22 Oct 2020 21:02:42 -0400 Subject: vim-patch:8.2.0901: formatting CJK text isn't optimal Problem: Formatting CJK text isn't optimal. Solution: Properly break CJK lines. (closes vim/vim#3875) https://github.com/vim/vim/commit/e52702f00322c8a8861efd0bd6a3775e685e5685 --- src/nvim/testdir/test_cjk_linebreak.vim | 91 +++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 src/nvim/testdir/test_cjk_linebreak.vim (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_cjk_linebreak.vim b/src/nvim/testdir/test_cjk_linebreak.vim new file mode 100644 index 0000000000..7a1cedeeac --- /dev/null +++ b/src/nvim/testdir/test_cjk_linebreak.vim @@ -0,0 +1,91 @@ +scriptencoding utf-8 + +func Run_cjk_linebreak_after() + set textwidth=12 + for punct in [ + \ '!', '%', ')', ',', ':', ';', '>', '?', ']', '}', '’', '”', '†', '‡', + \ '…', '‰', '‱', '‼', '⁇', '⁈', '⁉', '℃', '℉', '、', '。', '〉', '》', + \ '」', '』', '】', '〕', '〗', '〙', '〛', '!', ')', ',', '.', ':', + \ ';', '?', ']', '}'] + call setline('.', '这是一个测试'.punct.'试试 CJK 行禁则补丁。') + normal gqq + call assert_equal('这是一个测试'.punct, getline(1)) + %d_ + endfor +endfunc + +func Test_cjk_linebreak_after() + set formatoptions=croqn2mB1j + call Run_cjk_linebreak_after() +endfunc + +" TODO: this test fails +"func Test_cjk_linebreak_after_rigorous() +" set formatoptions=croqn2mB1j] +" call Run_cjk_linebreak_after() +"endfunc + +func Run_cjk_linebreak_before() + set textwidth=12 + for punct in [ + \ '(', '<', '[', '`', '{', '‘', '“', '〈', '《', '「', '『', '【', '〔', + \ '〖', '〘', '〚', '(', '[', '{'] + call setline('.', '这是个测试'.punct.'试试 CJK 行禁则补丁。') + normal gqq + call assert_equal('这是个测试', getline(1)) + %d_ + endfor +endfunc + +func Test_cjk_linebreak_before() + set formatoptions=croqn2mB1j + call Run_cjk_linebreak_before() +endfunc + +func Test_cjk_linebreak_before_rigorous() + set formatoptions=croqn2mB1j] + call Run_cjk_linebreak_before() +endfunc + +func Run_cjk_linebreak_nobetween() + " …… must not start a line + call setline('.', '这是个测试……试试 CJK 行禁则补丁。') + set textwidth=12 ambiwidth=double + normal gqq + " TODO: this fails + " call assert_equal('这是个测试……', getline(1)) + %d_ + + call setline('.', '这是一个测试……试试 CJK 行禁则补丁。') + set textwidth=12 ambiwidth=double + normal gqq + call assert_equal('这是一个测', getline(1)) + %d_ + + " but —— can + call setline('.', '这是个测试——试试 CJK 行禁则补丁。') + set textwidth=12 ambiwidth=double + normal gqq + call assert_equal('这是个测试', getline(1)) +endfunc + +func Test_cjk_linebreak_nobetween() + set formatoptions=croqn2mB1j + call Run_cjk_linebreak_nobetween() +endfunc + +func Test_cjk_linebreak_nobetween_rigorous() + set formatoptions=croqn2mB1j] + call Run_cjk_linebreak_nobetween() +endfunc + +func Test_cjk_linebreak_join_punct() + for punct in ['——', '〗', ',', '。', '……'] + call setline(1, '文本文本'.punct) + call setline(2, 'English') + set formatoptions=croqn2mB1j + normal ggJ + call assert_equal('文本文本'.punct.'English', getline(1)) + %d_ + endfor +endfunc -- cgit From 78ec28bca8eb868948ac4ad41b74148874f5a3bb Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 23 Oct 2020 00:52:29 -0400 Subject: vim-patch:8.2.0912: a few test cases for CJK formatting are disabled Problem: A few test cases for CJK formatting are disabled. Solution: Fix the tests and enable them. (closes vim/vim#6212) https://github.com/vim/vim/commit/11f1ffd18282c44ca4b74cf7cf336da6d09e396d --- src/nvim/testdir/test_cjk_linebreak.vim | 40 +++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_cjk_linebreak.vim b/src/nvim/testdir/test_cjk_linebreak.vim index 7a1cedeeac..dfaa8fa1af 100644 --- a/src/nvim/testdir/test_cjk_linebreak.vim +++ b/src/nvim/testdir/test_cjk_linebreak.vim @@ -1,36 +1,39 @@ scriptencoding utf-8 -func Run_cjk_linebreak_after() +func Run_cjk_linebreak_after(rigorous) set textwidth=12 for punct in [ \ '!', '%', ')', ',', ':', ';', '>', '?', ']', '}', '’', '”', '†', '‡', \ '…', '‰', '‱', '‼', '⁇', '⁈', '⁉', '℃', '℉', '、', '。', '〉', '》', \ '」', '』', '】', '〕', '〗', '〙', '〛', '!', ')', ',', '.', ':', \ ';', '?', ']', '}'] - call setline('.', '这是一个测试'.punct.'试试 CJK 行禁则补丁。') + call setline('.', '这是一个测试' .. punct.'试试 CJK 行禁则补丁。') normal gqq - call assert_equal('这是一个测试'.punct, getline(1)) + if a:rigorous + call assert_equal('这是一个测', getline(1)) + else + call assert_equal('这是一个测试' .. punct, getline(1)) + endif %d_ endfor endfunc func Test_cjk_linebreak_after() set formatoptions=croqn2mB1j - call Run_cjk_linebreak_after() + call Run_cjk_linebreak_after(0) endfunc -" TODO: this test fails -"func Test_cjk_linebreak_after_rigorous() -" set formatoptions=croqn2mB1j] -" call Run_cjk_linebreak_after() -"endfunc +func Test_cjk_linebreak_after_rigorous() + set formatoptions=croqn2mB1j] + call Run_cjk_linebreak_after(1) +endfunc func Run_cjk_linebreak_before() set textwidth=12 for punct in [ \ '(', '<', '[', '`', '{', '‘', '“', '〈', '《', '「', '『', '【', '〔', \ '〖', '〘', '〚', '(', '[', '{'] - call setline('.', '这是个测试'.punct.'试试 CJK 行禁则补丁。') + call setline('.', '这是个测试' .. punct.'试试 CJK 行禁则补丁。') normal gqq call assert_equal('这是个测试', getline(1)) %d_ @@ -47,13 +50,16 @@ func Test_cjk_linebreak_before_rigorous() call Run_cjk_linebreak_before() endfunc -func Run_cjk_linebreak_nobetween() +func Run_cjk_linebreak_nobetween(rigorous) " …… must not start a line call setline('.', '这是个测试……试试 CJK 行禁则补丁。') set textwidth=12 ambiwidth=double normal gqq - " TODO: this fails - " call assert_equal('这是个测试……', getline(1)) + if a:rigorous + call assert_equal('这是个测', getline(1)) + else + call assert_equal('这是个测试……', getline(1)) + endif %d_ call setline('.', '这是一个测试……试试 CJK 行禁则补丁。') @@ -71,21 +77,21 @@ endfunc func Test_cjk_linebreak_nobetween() set formatoptions=croqn2mB1j - call Run_cjk_linebreak_nobetween() + call Run_cjk_linebreak_nobetween(0) endfunc func Test_cjk_linebreak_nobetween_rigorous() set formatoptions=croqn2mB1j] - call Run_cjk_linebreak_nobetween() + call Run_cjk_linebreak_nobetween(1) endfunc func Test_cjk_linebreak_join_punct() for punct in ['——', '〗', ',', '。', '……'] - call setline(1, '文本文本'.punct) + call setline(1, '文本文本' .. punct) call setline(2, 'English') set formatoptions=croqn2mB1j normal ggJ - call assert_equal('文本文本'.punct.'English', getline(1)) + call assert_equal('文本文本' .. punct.'English', getline(1)) %d_ endfor endfunc -- cgit From a67bcb3fbfe3abac9a11ed5d1a1ffa7833a4d61f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 24 Oct 2020 20:48:47 -0400 Subject: vim-patch:8.2.0618: echoing a null list results in no output Problem: Echoing a null list results in no output. (Yegappan Lakshmanan) Solution: Return "[]" instead of NULL in echo_string_core(). https://github.com/vim/vim/commit/db950e4c0318c084c31bc7b50665284f4a47c285 --- src/nvim/testdir/test_messages.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim index 7fbf04311d..ca14494248 100644 --- a/src/nvim/testdir/test_messages.vim +++ b/src/nvim/testdir/test_messages.vim @@ -74,6 +74,7 @@ func Test_echomsg() call assert_equal("\n12345", execute(':echomsg 12345')) call assert_equal("\n[]", execute(':echomsg []')) call assert_equal("\n[1, 2, 3]", execute(':echomsg [1, 2, 3]')) + call assert_equal("\n[1, 2, []]", execute(':echomsg [1, 2, v:_null_list]')) call assert_equal("\n{}", execute(':echomsg {}')) call assert_equal("\n{'a': 1, 'b': 2}", execute(':echomsg {"a": 1, "b": 2}')) if has('float') -- cgit From a868cd920a69e55284c0b8137d349e91f0b8f742 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 25 Oct 2020 12:38:52 -0400 Subject: vim-patch:8.2.1901: variable completion does not work in command line window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Variable completion does not work in command line window. Solution: Use the "prevwin". (closes vim/vim#7198) https://github.com/vim/vim/commit/4ff2f2fb6bef01a06bd726bae8dfa8dd6355d594 N/A patches for version.c: vim-patch:8.2.1899: crash in out-of-memory situation Problem: Crash in out-of-memory situation. Solution: Bail out if shell_name is NULL. (Dominique Pellé, closes vim/vim#7196) https://github.com/vim/vim/commit/67def64a4e4590a5f3b55ebfc33c42a3dcd7b559 --- src/nvim/testdir/test_ins_complete.vim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim index 1339a9f25d..b8632b9595 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -327,7 +327,10 @@ func Test_compl_in_cmdwin() set wildmenu wildchar= com! -nargs=1 -complete=command GetInput let input = com! -buffer TestCommand echo 'TestCommand' + let w:test_winvar = 'winvar' + let b:test_bufvar = 'bufvar' + " User-defined commands let input = '' call feedkeys("q:iGetInput T\\\", 'tx!') call assert_equal('TestCommand', input) @@ -336,8 +339,29 @@ func Test_compl_in_cmdwin() call feedkeys("q::GetInput T\\:q\", 'tx!') call assert_equal('T', input) + com! -nargs=1 -complete=var GetInput let input = + " Window-local variables + let input = '' + call feedkeys("q:iGetInput w:test_\\\", 'tx!') + call assert_equal('w:test_winvar', input) + + let input = '' + call feedkeys("q::GetInput w:test_\\:q\", 'tx!') + call assert_equal('w:test_', input) + + " Buffer-local variables + let input = '' + call feedkeys("q:iGetInput b:test_\\\", 'tx!') + call assert_equal('b:test_bufvar', input) + + let input = '' + call feedkeys("q::GetInput b:test_\\:q\", 'tx!') + call assert_equal('b:test_', input) + delcom TestCommand delcom GetInput + unlet w:test_winvar + unlet b:test_bufvar set wildmenu& wildchar& endfunc -- cgit From 089f4f8e4a297aa8e7c689331ffd16ffe415120a Mon Sep 17 00:00:00 2001 From: skippi Date: Sun, 18 Oct 2020 21:36:30 -0500 Subject: vim-patch:8.1.1769: 'shellslash' is also used for completion Problem: 'shellslash' is also used for completion. Solution: Add the 'completeslash' option. (Yasuhiro Matsumoto, closes vim/vim#3612) https://github.com/vim/vim/commit/ac3150d385e6e3f3fe76642aac3cda954d30583f --- src/nvim/testdir/test_ins_complete.vim | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim index b8632b9595..45b0d159d4 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -365,6 +365,52 @@ func Test_compl_in_cmdwin() set wildmenu& wildchar& endfunc +" Test for insert path completion with completeslash option +func Test_ins_completeslash() + if !has('win32') + return + endif + + call mkdir('Xdir') + + let orig_shellslash = &shellslash + set cpt& + + new + + set noshellslash + + set completeslash= + exe "normal oXd\\" + call assert_equal('Xdir\', getline('.')) + + set completeslash=backslash + exe "normal oXd\\" + call assert_equal('Xdir\', getline('.')) + + set completeslash=slash + exe "normal oXd\\" + call assert_equal('Xdir/', getline('.')) + + set shellslash + + set completeslash= + exe "normal oXd\\" + call assert_equal('Xdir/', getline('.')) + + set completeslash=backslash + exe "normal oXd\\" + call assert_equal('Xdir\', getline('.')) + + set completeslash=slash + exe "normal oXd\\" + call assert_equal('Xdir/', getline('.')) + %bw! + call delete('Xdir', 'rf') + + let &shellslash = orig_shellslash +endfunc + func Test_pum_with_folds_two_tabs() CheckScreendump -- cgit From f8fd3d44ac7a89d5573b93a16896abb457e528e0 Mon Sep 17 00:00:00 2001 From: skippi Date: Sun, 25 Oct 2020 18:48:41 -0500 Subject: vim-patch:8.1.1791: 'completeslash' also applies to globpath() Problem: 'completeslash' also applies to globpath(). Solution: Add the WILD_IGNORE_COMPLETESLASH flag. (test by Yasuhiro Matsumoto, closes vim/vim#4760) --- src/nvim/testdir/test_ins_complete.vim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim index 45b0d159d4..be79b33f9c 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -367,17 +367,15 @@ endfunc " Test for insert path completion with completeslash option func Test_ins_completeslash() - if !has('win32') - return - endif - + CheckMSWindows + call mkdir('Xdir') let orig_shellslash = &shellslash set cpt& new - + set noshellslash set completeslash= @@ -408,7 +406,12 @@ func Test_ins_completeslash() %bw! call delete('Xdir', 'rf') + set noshellslash + set completeslash=slash + call assert_true(stridx(globpath(&rtp, 'syntax/*.vim', 1, 1)[0], '\') != -1) + let &shellslash = orig_shellslash + set completeslash= endfunc func Test_pum_with_folds_two_tabs() -- cgit From 6a0cb2a948cd7b523a2dc545b165acf6f44d10fb Mon Sep 17 00:00:00 2001 From: skippi Date: Mon, 19 Oct 2020 20:55:27 -0500 Subject: vim-patch:8.2.1747: result of expand() unexpectedly depends on 'completeslash' Problem: Result of expand() unexpectedly depends on 'completeslash'. Solution: Temporarily reset 'completeslash'. (Yasuhiro Matsumoto, closes vim/vim#7021) https://github.com/vim/vim/commit/8f187fc6304222956f94a700758a490cc8c0af99 --- src/nvim/testdir/test_ins_complete.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim index be79b33f9c..57a0a7aaf4 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -414,6 +414,19 @@ func Test_ins_completeslash() set completeslash= endfunc +func Test_issue_7021() + CheckMSWindows + + let orig_shellslash = &shellslash + set noshellslash + + set completeslash=slash + call assert_false(expand('~') =~ '/') + + let &shellslash = orig_shellslash + set completeslash= +endfunc + func Test_pum_with_folds_two_tabs() CheckScreendump -- cgit From cb6b5e5540e737fdf391905f87eb3ed3c98b0fbd Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 27 Oct 2020 19:22:28 -0400 Subject: vim-patch:8.2.1910: reading past the end of the command line Problem: Reading past the end of the command line. Solution: Check for NUL. (closes vim/vim#7204) https://github.com/vim/vim/commit/caf73dcfade0a435ea3f989285b43f07c40c9948 Cherry-pick undo_cmdmod() from patch 8.2.1137. N/A patches for version.c: vim-patch:8.1.2050: popup window test fails in some configurations Problem: Popup window test fails in some configurations. (James McCoy) Solution: Clear the command line. https://github.com/vim/vim/commit/7e0f462db594e3e2eee3a55531250a6afc9c0b92 vim-patch:8.2.0913: code for resetting v:register is duplicated Problem: Code for resetting v:register is duplicated. Solution: Add reset_reg_var(). https://github.com/vim/vim/commit/439c036ed062de1c87cc7e3fe050a9569fb12089 reset_reg_var() is not ported. Use set_reg_var(get_default_register_name()) instead. vim-patch:8.2.1913: GTK GUI: rounding for the cell height is too strict Problem: GTK GUI: rounding for the cell height is too strict. Solution: Round up above 15/16 of a pixel. (closes vim/vim#7203) https://github.com/vim/vim/commit/70cf45810cb9be5bd17074f7fb4ee238f2c4d57b vim-patch:8.2.1922: Win32: scrolling problems when part of window is off-screen Problem: Win32: scrolling doesn't work properly when part of window is off-screen. Solution: Fall back to GDI scrolling if part of the window is off-screen. Handle multi-monitor setup better. (Ken Takata, closes vim/vim#7219) https://github.com/vim/vim/commit/185577e47e5004a5d08a5405a02ab6a261078e42 --- src/nvim/testdir/test_edit.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim index 15c718b243..abad6983dc 100644 --- a/src/nvim/testdir/test_edit.vim +++ b/src/nvim/testdir/test_edit.vim @@ -1587,4 +1587,11 @@ func Test_edit_browse() bwipe! endfunc +func Test_read_invalid() + " set encoding=latin1 + " This was not properly checking for going past the end. + call assert_fails('r`=', 'E484') + set encoding=utf-8 +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 3d6584223df15e1eee2999baa07813944599a825 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 27 Oct 2020 23:52:02 -0400 Subject: vim-patch:8.2.0131: command line is not cleared when switching tabs Problem: Command line is not cleared when switching tabs and the command line height differs. Solution: Set the "clear_cmdline" flag when needed. (Naruhiko Nishino, closes vim/vim#5495) https://github.com/vim/vim/commit/479950f6c9aee4806f28a2b2fe5471e18a034cff --- src/nvim/testdir/test_cmdline.vim | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 871143699a..e3c42a4fe3 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -722,7 +722,7 @@ func Test_verbosefile() endfunc func Test_verbose_option() - " See test/functional/ui/cmdline_spec.lua + " See test/functional/legacy/cmdline_spec.lua CheckScreendump let lines =<< trim [SCRIPT] @@ -842,6 +842,25 @@ func Test_buffers_lastused() bwipeout bufc endfunc +func Test_cmdlineclear_tabenter() + " See test/functional/legacy/cmdline_spec.lua + CheckScreendump + + let lines =<< trim [SCRIPT] + call setline(1, range(30)) + [SCRIPT] + + call writefile(lines, 'XtestCmdlineClearTabenter') + let buf = RunVimInTerminal('-S XtestCmdlineClearTabenter', #{rows: 10}) + call term_wait(buf, 50) + " in one tab make the command line higher with CTRL-W - + call term_sendkeys(buf, ":tabnew\\-\-gtgt") + call VerifyScreenDump(buf, 'Test_cmdlineclear_tabenter', {}) + + call StopVimInTerminal(buf) + call delete('XtestCmdlineClearTabenter') +endfunc + " test that ";" works to find a match at the start of the first line func Test_zero_line_search() new -- cgit From 4e24e31a6b2c45e0bc2ab15059a51092b29ebaf5 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 29 Oct 2020 01:51:08 -0400 Subject: vim-patch:8.2.0929: v:register is not cleared after an operator was executed Problem: v:register is not cleared after an operator was executed. Solution: Clear v:register after finishing an operator (Andy Massimino, closes vim/vim#5305) https://github.com/vim/vim/commit/cc613031b96f1cfa5a184253e745c26f1def9be4 --- src/nvim/testdir/test_registers.vim | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_registers.vim b/src/nvim/testdir/test_registers.vim index d20f8d1eef..19a7c6c9d0 100644 --- a/src/nvim/testdir/test_registers.vim +++ b/src/nvim/testdir/test_registers.vim @@ -167,6 +167,75 @@ func Test_set_register() enew! endfunc +func Test_v_register() + enew + call setline(1, 'nothing') + + func s:Put() + let s:register = v:register + exec 'normal! "' .. v:register .. 'P' + endfunc + nnoremap (test) :call s:Put() + nmap S (test) + + let @z = "testz\n" + let @" = "test@\n" + + let s:register = '' + call feedkeys('"_ddS', 'mx') + call assert_equal('test@', getline('.')) " fails before 8.2.0929 + call assert_equal('"', s:register) " fails before 8.2.0929 + + let s:register = '' + call feedkeys('"zS', 'mx') + call assert_equal('z', s:register) + + let s:register = '' + call feedkeys('"zSS', 'mx') + call assert_equal('"', s:register) + + let s:register = '' + call feedkeys('"_S', 'mx') + call assert_equal('_', s:register) + + let s:register = '' + normal "_ddS + call assert_equal('"', s:register) " fails before 8.2.0929 + call assert_equal('test@', getline('.')) " fails before 8.2.0929 + + let s:register = '' + execute 'normal "z:call' "s:Put()\n" + call assert_equal('z', s:register) + call assert_equal('testz', getline('.')) + + " Test operator and omap + let @b = 'testb' + func s:OpFunc(...) + let s:register2 = v:register + endfunc + set opfunc=s:OpFunc + + normal "bg@l + normal S + call assert_equal('"', s:register) " fails before 8.2.0929 + call assert_equal('b', s:register2) + + func s:Motion() + let s:register1 = v:register + normal! l + endfunc + onoremap Q :call s:Motion() + + normal "bg@Q + normal S + call assert_equal('"', s:register) + call assert_equal('b', s:register1) + call assert_equal('"', s:register2) + + set opfunc& + bwipe! +endfunc + func Test_ve_blockpaste() new set ve=all -- cgit From 10bf69a43e8f58b0d49bc6253e4e2758060670a8 Mon Sep 17 00:00:00 2001 From: Rom Grk Date: Mon, 26 Oct 2020 18:48:39 -0400 Subject: vim-patch:8.2.1909: number of status line items is limited to 80 Problem: Number of status line items is limited to 80. Solution: Dynamically allocate the arrays. (Rom Grk, closes vim/vim#7181) https://github.com/vim/vim/commit/8133cc6bf454eb90bb0868f7cf806fce5c0c9fe6 The members of stl_item_T have not been prefixed with stl_ contrary to the vim patch because the amount of stl_ prefixes on single lines of code in that region was hurtful to readability. --- src/nvim/testdir/test_options.vim | 1 - src/nvim/testdir/test_statusline.vim | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 9e8da74db7..10e16f4198 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -267,7 +267,6 @@ func Test_set_errors() call assert_fails('set commentstring=x', 'E537:') call assert_fails('set complete=x', 'E539:') call assert_fails('set statusline=%{', 'E540:') - call assert_fails('set statusline=' . repeat("%p", 81), 'E541:') call assert_fails('set statusline=%(', 'E542:') if has('cursorshape') " This invalid value for 'guicursor' used to cause Vim to crash. diff --git a/src/nvim/testdir/test_statusline.vim b/src/nvim/testdir/test_statusline.vim index 7efd181d04..4e38f7ebd8 100644 --- a/src/nvim/testdir/test_statusline.vim +++ b/src/nvim/testdir/test_statusline.vim @@ -354,6 +354,21 @@ func Test_statusline() delfunc GetNested delfunc GetStatusLine + " Test statusline works with 80+ items + function! StatusLabel() + redrawstatus + return '[label]' + endfunc + let statusline = '%{StatusLabel()}' + for i in range(150) + let statusline .= '%#TabLine' . (i % 2 == 0 ? 'Fill' : 'Sel') . '#' . string(i)[0] + endfor + let &statusline = statusline + redrawstatus + set statusline& + delfunc StatusLabel + + " Check statusline in current and non-current window " with the 'fillchars' option. set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:- -- cgit From 925ddd28391aa7bab06ec7e4f7aac34b727ee1d5 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 30 Oct 2020 19:04:23 -0400 Subject: vim-patch:8.2.1925: list/dict test fails Problem: List/dict test fails. Solution: Correct expected exception. https://github.com/vim/vim/commit/6d967125ad87b1c2a9467357286c3514d5dd1c40 Cherry-pick e_dictkey[] change from patch 8.2.1924. N/A patches for version.c: vim-patch:8.2.1929: MS-Windows: problem loading Perl 5.32 Problem: MS-Windows: problem loading Perl 5.32. Solution: Define NO_THREAD_SAFE_LOCALE. (Ken Takata, closes vim/vim#7234) https://github.com/vim/vim/commit/0289065e41ce3148f929e16a55aa3b161c80576f vim-patch:8.2.1932: compiler warnings when building with Athena GUI Problem: Compiler warnings when building with Athena GUI. Solution: Fix function signatures. https://github.com/vim/vim/commit/963734e316bd17dd7290abcac28b875435d06381 --- src/nvim/testdir/test_listdict.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_listdict.vim b/src/nvim/testdir/test_listdict.vim index 31a8b48d37..8e2a987e74 100644 --- a/src/nvim/testdir/test_listdict.vim +++ b/src/nvim/testdir/test_listdict.vim @@ -199,9 +199,9 @@ func Test_dict_big() try let n = d[1500] catch - let str=substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '') + let str = substitute(v:exception, '\v(.{14}).*( "\d{4}").*', '\1\2', '') endtry - call assert_equal('Vim(let):E716: 1500', str) + call assert_equal('Vim(let):E716: "1500"', str) " lookup each items for i in range(1500) -- cgit From 7af8de0dab5069751940e40a27aa77c715f9e82c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 31 Oct 2020 23:01:01 -0400 Subject: vim-patch:8.2.0639: MS-Windows: messages test still fails Problem: MS-Windows: messages test still fails. Solution: Filter out the maintainer message. https://github.com/vim/vim/commit/49b2fb36ca94be14b98caf86420863d9bbe81a24 --- src/nvim/testdir/test_messages.vim | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim index ca14494248..30239a90c2 100644 --- a/src/nvim/testdir/test_messages.vim +++ b/src/nvim/testdir/test_messages.vim @@ -1,20 +1,16 @@ " Tests for :messages, :echomsg, :echoerr -function Test_messages() +source shared.vim + +func Test_messages() let oldmore = &more try set nomore - " Avoid the "message maintainer" line. - let $LANG = '' - let $LC_ALL = '' - let $LC_MESSAGES = '' - let $LC_COLLATE = '' let arr = map(range(10), '"hello" . v:val') for s in arr echomsg s | redraw endfor - let result = '' " get last two messages redir => result @@ -25,22 +21,17 @@ function Test_messages() " clear messages without last one 1messages clear - redir => result - redraw | messages - redir END - let msg_list = split(result, "\n") + let msg_list = GetMessages() call assert_equal(['hello9'], msg_list) " clear all messages messages clear - redir => result - redraw | messages - redir END - call assert_equal('', result) + let msg_list = GetMessages() + call assert_equal([], msg_list) finally let &more = oldmore endtry -endfunction +endfunc " Patch 7.4.1696 defined the "clearmode()" command for clearing the mode " indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message -- cgit From 057e21b1e771e164346dd1723dbaf539e002270c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 31 Oct 2020 22:37:39 -0400 Subject: vim-patch:8.2.0666: Ruby test fails on MS-Windows Problem: Ruby test fails on MS-Windows. Solution: Remove the "maintainer" line. (Ken Takata, closes vim/vim#6015) https://github.com/vim/vim/commit/88e6cc253903c86d06abb59b35c85e6aef0152f3 Cherry-pick feature check from patch 8.1.1544. Cherry-pick test_ruby.vim changes from patch 8.2.0183. --- src/nvim/testdir/test_ruby.vim | 69 +++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 34 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_ruby.vim b/src/nvim/testdir/test_ruby.vim index 07ad8561c3..9c74c35049 100644 --- a/src/nvim/testdir/test_ruby.vim +++ b/src/nvim/testdir/test_ruby.vim @@ -1,8 +1,7 @@ " Tests for ruby interface -if !has('ruby') - finish -end +source check.vim +CheckFeature ruby func Test_ruby_change_buffer() call setline(line('$'), ['1 line 1']) @@ -36,7 +35,7 @@ func Test_rubyfile() call delete(tempfile) endfunc -func Test_set_cursor() +func Test_ruby_set_cursor() " Check that setting the cursor position works. new call setline(1, ['first line', 'second line']) @@ -56,7 +55,7 @@ func Test_set_cursor() endfunc " Test buffer.count and buffer.length (number of lines in buffer) -func Test_buffer_count() +func Test_ruby_buffer_count() new call setline(1, ['one', 'two', 'three']) call assert_equal(3, rubyeval('$curbuf.count')) @@ -65,7 +64,7 @@ func Test_buffer_count() endfunc " Test buffer.name (buffer name) -func Test_buffer_name() +func Test_ruby_buffer_name() new Xfoo call assert_equal(expand('%:p'), rubyeval('$curbuf.name')) bwipe @@ -73,7 +72,7 @@ func Test_buffer_name() endfunc " Test buffer.number (number of the buffer). -func Test_buffer_number() +func Test_ruby_buffer_number() new call assert_equal(bufnr('%'), rubyeval('$curbuf.number')) new @@ -83,7 +82,7 @@ func Test_buffer_number() endfunc " Test buffer.delete({n}) (delete line {n}) -func Test_buffer_delete() +func Test_ruby_buffer_delete() new call setline(1, ['one', 'two', 'three']) ruby $curbuf.delete(2) @@ -97,7 +96,7 @@ func Test_buffer_delete() endfunc " Test buffer.append({str}, str) (append line {str} after line {n}) -func Test_buffer_append() +func Test_ruby_buffer_append() new ruby $curbuf.append(0, 'one') ruby $curbuf.append(1, 'three') @@ -117,7 +116,7 @@ func Test_buffer_append() endfunc " Test buffer.line (get or set the current line) -func Test_buffer_line() +func Test_ruby_buffer_line() new call setline(1, ['one', 'two', 'three']) 2 @@ -130,7 +129,7 @@ func Test_buffer_line() endfunc " Test buffer.line_number (get current line number) -func Test_buffer_line_number() +func Test_ruby_buffer_line_number() new call setline(1, ['one', 'two', 'three']) 2 @@ -139,7 +138,7 @@ func Test_buffer_line_number() bwipe! endfunc -func Test_buffer_get() +func Test_ruby_buffer_get() new call setline(1, ['one', 'two']) call assert_equal('one', rubyeval('$curbuf[1]')) @@ -153,7 +152,7 @@ func Test_buffer_get() bwipe! endfunc -func Test_buffer_set() +func Test_ruby_buffer_set() new call setline(1, ['one', 'two']) ruby $curbuf[2] = 'TWO' @@ -169,7 +168,7 @@ func Test_buffer_set() endfunc " Test window.width (get or set window height). -func Test_window_height() +func Test_ruby_window_height() new " Test setting window height @@ -183,7 +182,7 @@ func Test_window_height() endfunc " Test window.width (get or set window width). -func Test_window_width() +func Test_ruby_window_width() vnew " Test setting window width @@ -197,7 +196,7 @@ func Test_window_width() endfunc " Test window.buffer (get buffer object of a window object). -func Test_window_buffer() +func Test_ruby_window_buffer() new Xfoo1 new Xfoo2 ruby $b2 = $curwin.buffer @@ -216,14 +215,14 @@ func Test_window_buffer() endfunc " Test Vim::Window.current (get current window object) -func Test_Vim_window_current() +func Test_ruby_Vim_window_current() let cw = rubyeval('$curwin.to_s') " call assert_equal(cw, rubyeval('Vim::Window.current')) call assert_match('^#$', cw) endfunc " Test Vim::Window.count (number of windows) -func Test_Vim_window_count() +func Test_ruby_Vim_window_count() new Xfoo1 new Xfoo2 split @@ -233,7 +232,7 @@ func Test_Vim_window_count() endfunc " Test Vim::Window[n] (get window object of window n) -func Test_Vim_window_get() +func Test_ruby_Vim_window_get() new Xfoo1 new Xfoo2 call assert_match('Xfoo2$', rubyeval('Vim::Window[0].buffer.name')) @@ -245,14 +244,14 @@ func Test_Vim_window_get() endfunc " Test Vim::Buffer.current (return the buffer object of current buffer) -func Test_Vim_buffer_current() +func Test_ruby_Vim_buffer_current() let cb = rubyeval('$curbuf.to_s') " call assert_equal(cb, rubyeval('Vim::Buffer.current')) call assert_match('^#$', cb) endfunc " Test Vim::Buffer:.count (return the number of buffers) -func Test_Vim_buffer_count() +func Test_ruby_Vim_buffer_count() new Xfoo1 new Xfoo2 call assert_equal(3, rubyeval('Vim::Buffer.count')) @@ -261,7 +260,7 @@ func Test_Vim_buffer_count() endfunc " Test Vim::buffer[n] (return the buffer object of buffer number n) -func Test_Vim_buffer_get() +func Test_ruby_Vim_buffer_get() new Xfoo1 new Xfoo2 @@ -276,7 +275,7 @@ endfunc " Test Vim::command({cmd}) (execute a Ex command)) " Test Vim::command({cmd}) -func Test_Vim_command() +func Test_ruby_Vim_command() new call setline(1, ['one', 'two', 'three', 'four']) ruby Vim::command('2,3d') @@ -285,7 +284,7 @@ func Test_Vim_command() endfunc " Test Vim::set_option (set a vim option) -func Test_Vim_set_option() +func Test_ruby_Vim_set_option() call assert_equal(0, &number) ruby Vim::set_option('number') call assert_equal(1, &number) @@ -293,14 +292,16 @@ func Test_Vim_set_option() call assert_equal(0, &number) endfunc -func Test_Vim_evaluate() +func Test_ruby_Vim_evaluate() call assert_equal(123, rubyeval('Vim::evaluate("123")')) " Vim::evaluate("123").class gives Integer or Fixnum depending " on versions of Ruby. call assert_match('^Integer\|Fixnum$', rubyeval('Vim::evaluate("123").class')) - call assert_equal(1.23, rubyeval('Vim::evaluate("1.23")')) - call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class')) + if has('float') + call assert_equal(1.23, rubyeval('Vim::evaluate("1.23")')) + call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class')) + endif call assert_equal('foo', rubyeval('Vim::evaluate("\"foo\"")')) call assert_equal('String', rubyeval('Vim::evaluate("\"foo\"").class')) @@ -323,7 +324,7 @@ func Test_Vim_evaluate() call assert_equal('FalseClass',rubyeval('Vim::evaluate("v:false").class')) endfunc -func Test_Vim_evaluate_list() +func Test_ruby_Vim_evaluate_list() call setline(line('$'), ['2 line 2']) ruby Vim.command("normal /^2\n") let l = ["abc", "def"] @@ -337,7 +338,7 @@ EOF call assert_equal('abc/def', getline('$')) endfunc -func Test_Vim_evaluate_dict() +func Test_ruby_Vim_evaluate_dict() let d = {'a': 'foo', 'b': 123} redir => l:out ruby d = Vim.evaluate("d"); print d @@ -346,14 +347,14 @@ func Test_Vim_evaluate_dict() endfunc " Test Vim::message({msg}) (display message {msg}) -func Test_Vim_message() +func Test_ruby_Vim_message() throw 'skipped: TODO: ' ruby Vim::message('A message') let messages = split(execute('message'), "\n") call assert_equal('A message', messages[-1]) endfunc -func Test_print() +func Test_ruby_print() func RubyPrint(expr) return trim(execute('ruby print ' . a:expr)) endfunc @@ -372,9 +373,9 @@ func Test_print() delfunc RubyPrint endfunc -func Test_p() +func Test_ruby_p() ruby p 'Just a test' - let messages = split(execute('message'), "\n") + let messages = GetMessages() call assert_equal('"Just a test"', messages[-1]) " Check return values of p method @@ -387,6 +388,6 @@ func Test_p() messages clear call assert_equal(v:true, rubyeval('p() == nil')) - let messages = split(execute('message'), "\n") + let messages = GetMessages() call assert_equal(0, len(messages)) endfunc -- cgit From 4b398413e46d604ec03e30875a46506988cdbbc0 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 1 Nov 2020 12:17:45 -0500 Subject: vim-patch:8.2.1936: session sets the local 'scrolloff' value to the global value Problem: Session sets the local 'scrolloff' value to the global value. Solution: Do not let restoring the global option value change the local value. https://github.com/vim/vim/commit/388908352f88e7391accb3545b082db0fc89d9f7 --- src/nvim/testdir/test_mksession.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index 3243edbf55..215065f941 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -470,4 +470,17 @@ func Test_mkvimrc() call delete('Xtestvimrc') endfunc +func Test_scrolloff() + set sessionoptions+=localoptions + setlocal so=1 siso=1 + mksession! Xtest_mks.out + setlocal so=-1 siso=-1 + source Xtest_mks.out + call assert_equal(1, &l:so) + call assert_equal(1, &l:siso) + call delete('Xtest_mks.out') + setlocal so& siso& + set sessionoptions& +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From f9adb3eccb871aee5455674a704186e10e6fecff Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 1 Nov 2020 18:56:47 -0500 Subject: vim-patch:8.2.0864: pragmas are indented all the way to the left Problem: Pragmas are indented all the way to the left. Solution: Add an option to indent progmas like normal code. (Max Rumpf, closes vim/vim#5468) https://github.com/vim/vim/commit/d881b516da0184052d2f9d33c3f72c5c014316bd N/A patches for version.c: vim-patch:8.1.2030: tests fail when build with normal features and terminal Problem: Tests fail when build with normal features and terminal. (Dominique Pelle) Solution: Disable tests that won't work. (closes vim/vim#4932) https://github.com/vim/vim/commit/997d42427eaab889058eb047e08d55de9e4a968a vim-patch:8.1.2063: some tests fail when +balloon_eval_term is missing Problem: Some tests fail when +balloon_eval_term is missing but _balloon_eval is present. (Dominique Pelle) Solution: Check the right feature in the test. (closes vim/vim#4962) https://github.com/vim/vim/commit/1e82a784ace6d2c4dce594dd6156bcb0028bba9e vim-patch:8.2.1938: wiping out a terminal buffer makes some tests fail Problem: Wiping out a terminal buffer makes some tests fail. Solution: Do not wipe out the terminal buffer unless wanted. https://github.com/vim/vim/commit/a46765a79745ff27b4a44659fb8389519c961977 --- src/nvim/testdir/test_cindent.vim | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_cindent.vim b/src/nvim/testdir/test_cindent.vim index debc9da46d..b6c2d1467e 100644 --- a/src/nvim/testdir/test_cindent.vim +++ b/src/nvim/testdir/test_cindent.vim @@ -127,4 +127,40 @@ func Test_cindent_case() bwipe! endfunc +func Test_cindent_pragma() + new + setl cindent ts=4 sw=4 + setl cino=Ps + + let code =<< trim [CODE] + { + #pragma omp parallel + { + #pragma omp task + foo(); + # pragma omp taskwait + } + } + [CODE] + + call append(0, code) + normal gg + normal =G + + let expected =<< trim [CODE] + { + #pragma omp parallel + { + #pragma omp task + foo(); + # pragma omp taskwait + } + } + + [CODE] + + call assert_equal(expected, getline(1, '$')) + enew! | close +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 1b728490d38cc112ad4a4566644786be98816563 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 2 Nov 2020 21:57:29 -0500 Subject: vim-patch:8.2.1942: insufficient test coverage for the Netbeans interface Problem: Insufficient test coverage for the Netbeans interface. Solution: Add more tests. Fix an uncovered bug. (Yegappan Lakshmanan, closes vim/vim#7240) https://github.com/vim/vim/commit/dbfa795d8b66c99ee758b132d6043871b9061563 N/A patches for version.c: vim-patch:8.2.1165: insufficient testing for the Tcl interface Problem: Insufficient testing for the Tcl interface. Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#6423) https://github.com/vim/vim/commit/e4358906fdbd0b2df1889dad49c79a9c8cee5ac4 --- src/nvim/testdir/test_quickfix.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index cf0af07528..049163890e 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -3602,6 +3602,10 @@ func Test_lhelpgrep_autocmd() au BufEnter * call setqflist([], 'f') augroup END call assert_fails('helpgrep quickfix', 'E925:') + " run the test with a help window already open + help + wincmd w + call assert_fails('helpgrep quickfix', 'E925:') augroup QF_Test au! BufEnter augroup END -- cgit