From de13113dc16e3f3a453e783dc7ea692ac4967231 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 4 Nov 2018 13:16:24 +0100 Subject: test/timer_spec: relax lower-bound Test is unreliable on macOS 10.13. The lower-bound isn't central to the purpose of the test, so just relax it. ref https://github.com/neovim/neovim/pull/9095#issuecomment-429603452 > We don't guarantee that a X ms timer is triggered during Y ms sleep > for any X to happen with X=10ms, Y=40ms. related: #6829 --- src/nvim/testdir/test_timers.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index da61751bf4..8a3e57bb02 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -44,7 +44,7 @@ func Test_repeat_many() let timer = timer_start(50, 'MyHandler', {'repeat': -1}) sleep 200m call timer_stop(timer) - call assert_inrange(2, 4, g:val) + call assert_inrange((has('mac') ? 1 : 2), 4, g:val) endfunc func Test_with_partial_callback() @@ -167,6 +167,9 @@ func Test_stop_all_in_callback() let g:timer1 = timer_start(10, 'StopTimerAll') let info = timer_info() call assert_equal(1, len(info)) + if has('mac') + sleep 100m + endif sleep 40m let info = timer_info() call assert_equal(0, len(info)) -- cgit From f08869cff2eae65eede8df41fab274c77dd76c60 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 6 Nov 2018 07:49:20 -0500 Subject: vim-patch:8.1.0511: ml_get error when calling a function with a range (#9207) Problem: ml_get error when calling a function with a range. Solution: Don't position the cursor after the last line. https://github.com/vim/vim/commit/9e353b5265bd7fa103caf4e5a9b3c99f344f548e --- src/nvim/testdir/test_functions.vim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index b1138bfc96..7dc9f31ce7 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1018,3 +1018,22 @@ func Test_trim() let chars = join(map(range(1, 0x20) + [0xa0], {n -> nr2char(n)}), '') call assert_equal("x", trim(chars . "x" . chars)) endfunc + +func EditAnotherFile() + let word = expand('') + edit Xfuncrange2 +endfunc + +func Test_func_range_with_edit() + " Define a function that edits another buffer, then call it with a range that + " is invalid in that buffer. + call writefile(['just one line'], 'Xfuncrange2') + new + call setline(1, range(10)) + write Xfuncrange1 + call assert_fails('5,8call EditAnotherFile()', 'E16:') + + call delete('Xfuncrange1') + call delete('Xfuncrange2') + bwipe! +endfunc -- cgit From 18435a25347eeecb0886281d278c060aa7f82f6c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 9 Nov 2018 03:33:28 -0500 Subject: vim-patch:8.1.0337: :file fails in quickfix command (#9215) Problem: :file fails in quickfix command. Solution: Allow :file without argument when curbuf_lock is set. (Jason Franklin) https://github.com/vim/vim/commit/379fb76b080521f7c09265ec3264b9e698923518 --- src/nvim/testdir/test_quickfix.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 624e642e7f..bfe5791ec8 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -2235,6 +2235,35 @@ func Test_cclose_in_autocmd() " call test_override('starting', 0) endfunc +" Check that ":file" without an argument is possible even when "curbuf_lock" +" is set. +func Test_file_from_copen() + " Works without argument. + augroup QF_Test + au! + au FileType qf file + augroup END + copen + + augroup QF_Test + au! + augroup END + cclose + + " Fails with argument. + augroup QF_Test + au! + au FileType qf call assert_fails(':file foo', 'E788') + augroup END + copen + augroup QF_Test + au! + augroup END + cclose + + augroup! QF_Test +endfunction + func Test_resize_from_copen() augroup QF_Test au! -- cgit From f8639dc99cb085432b14da086af316176152bc1f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 10 Nov 2018 11:12:04 +0100 Subject: test: adjust time-sensitive tests (#9220) - window_split_tab_spec.lua: Put cursor at bottom of :terminal buffer so that it follows output. - inccommand_spec.lua: Increase timeout to allow 2nd retry. - Timer tests are less reliable on Travis CI macOS 10.12/10.13. ref #6829 ref e39dade80b02 ref de13113dc16e ref https://github.com/neovim/neovim/pull/9095#issuecomment-429603452 > We don't guarantee that a X ms timer is triggered during Y ms sleep > for any X to happen with X=10ms, Y=40ms. --- src/nvim/testdir/test_lambda.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_lambda.vim b/src/nvim/testdir/test_lambda.vim index 311cc6e2cb..2ac84c2213 100644 --- a/src/nvim/testdir/test_lambda.vim +++ b/src/nvim/testdir/test_lambda.vim @@ -31,11 +31,11 @@ function! Test_lambda_with_timer() endfunction call s:Foo() - sleep 200ms + sleep 210ms " do not collect lambda call garbagecollect() let m = s:n - sleep 200ms + sleep 210ms call timer_stop(s:timer_id) call assert_true(m > 1) call assert_true(s:n > m + 1) -- cgit From 9f3fb66111d3a7923106df60837f3150b3cf55b9 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 11 Nov 2018 13:13:14 -0500 Subject: vim-patch:8.1.0516: :move command sets 'modified' #9224 Problem: :move command marks buffer modified when nothing changed. Solution: Do not set 'modified'. Add a test. (Jason Franklin) https://github.com/vim/vim/commit/ddd1f9183bed00d096f29c503721ac559174a29f --- src/nvim/testdir/test_alot.vim | 1 + src/nvim/testdir/test_move.vim | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/nvim/testdir/test_move.vim (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index 36dcdc3386..0602ff6a45 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -28,6 +28,7 @@ source test_lambda.vim source test_mapping.vim source test_menu.vim source test_messages.vim +source test_move.vim source test_partial.vim source test_popup.vim source test_put.vim diff --git a/src/nvim/testdir/test_move.vim b/src/nvim/testdir/test_move.vim new file mode 100644 index 0000000000..d774c93dbd --- /dev/null +++ b/src/nvim/testdir/test_move.vim @@ -0,0 +1,40 @@ +" Test the ":move" command. + +func Test_move() + enew! + call append(0, ['line 1', 'line 2', 'line 3']) + g /^$/ delete _ + set nomodified + + move . + call assert_equal(['line 1', 'line 2', 'line 3'], getline(1, 3)) + call assert_false(&modified) + + 1,2move 0 + call assert_equal(['line 1', 'line 2', 'line 3'], getline(1, 3)) + call assert_false(&modified) + + 1,3move 3 + call assert_equal(['line 1', 'line 2', 'line 3'], getline(1, 3)) + call assert_false(&modified) + + 1move 2 + call assert_equal(['line 2', 'line 1', 'line 3'], getline(1, 3)) + call assert_true(&modified) + set nomodified + + 3move 0 + call assert_equal(['line 3', 'line 2', 'line 1'], getline(1, 3)) + call assert_true(&modified) + set nomodified + + 2,3move 0 + call assert_equal(['line 2', 'line 1', 'line 3'], getline(1, 3)) + call assert_true(&modified) + set nomodified + + call assert_fails('1,2move 1', 'E134') + call assert_fails('2,3move 2', 'E134') + + %bwipeout! +endfunc -- cgit From 208cdb84a6991bb3652db70b7ac6aea7ab36dcb7 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 3 Sep 2018 10:40:28 -0400 Subject: vim-patch:8.1.0340: no test for :spellinfo Problem: No test for :spellinfo. Solution: Add a test. (Dominique Pelle, closes vim/vim#3394) https://github.com/vim/vim/commit/9049b686121367941bf534c041975938135c7e20 --- src/nvim/testdir/test_spell.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_spell.vim b/src/nvim/testdir/test_spell.vim index a2828b21d2..3dbbce83fc 100644 --- a/src/nvim/testdir/test_spell.vim +++ b/src/nvim/testdir/test_spell.vim @@ -85,6 +85,35 @@ func Test_spellreall() bwipe! endfunc +func Test_spellinfo() + new + + set enc=latin1 spell spelllang=en + call assert_match("^\nfile: .*/runtime/spell/en.latin1.spl\n$", execute('spellinfo')) + + set enc=cp1250 spell spelllang=en + call assert_match("^\nfile: .*/runtime/spell/en.ascii.spl\n$", execute('spellinfo')) + + if has('multi_byte') + set enc=utf-8 spell spelllang=en + call assert_match("^\nfile: .*/runtime/spell/en.utf-8.spl\n$", execute('spellinfo')) + endif + + set enc=latin1 spell spelllang=en_us,en_nz + call assert_match("^\n" . + \ "file: .*/runtime/spell/en.latin1.spl\n" . + \ "file: .*/runtime/spell/en.latin1.spl\n$", execute('spellinfo')) + + set spell spelllang= + call assert_fails('spellinfo', 'E756:') + + set nospell spelllang=en + call assert_fails('spellinfo', 'E756:') + + set enc& spell& spelllang& + bwipe +endfunc + func Test_zz_basic() call LoadAffAndDic(g:test_data_aff1, g:test_data_dic1) call RunGoodBad("wrong OK puts. Test the end", -- cgit From e5046822c96ecfd7c774bf3ab025caf5aebd06d8 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 3 Sep 2018 13:11:07 -0400 Subject: oldtests: skip Test_spellinfo() nvim supports only `set encoding=utf8`. --- src/nvim/testdir/test_spell.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_spell.vim b/src/nvim/testdir/test_spell.vim index 3dbbce83fc..b3438cc649 100644 --- a/src/nvim/testdir/test_spell.vim +++ b/src/nvim/testdir/test_spell.vim @@ -86,6 +86,7 @@ func Test_spellreall() endfunc func Test_spellinfo() + throw 'skipped: Nvim does not support enc=latin1' new set enc=latin1 spell spelllang=en -- cgit From d81b9d5ec536ff7a9dbb35892adb1d1cd1651026 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 15 Nov 2018 05:42:18 -0500 Subject: vim-patch:8.1.0146: when $LANG is set the compiler test may fail (#9238) Problem: When $LANG is set the compiler test may fail. Solution: Unset $LANG. https://github.com/vim/vim/commit/f0447e89a52885630947510f2d1b55f665a1a20e --- src/nvim/testdir/test_compiler.vim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_compiler.vim b/src/nvim/testdir/test_compiler.vim index 84fba0f9a4..4600a28da5 100644 --- a/src/nvim/testdir/test_compiler.vim +++ b/src/nvim/testdir/test_compiler.vim @@ -5,6 +5,11 @@ func Test_compiler() return endif + " $LANG changes the output of Perl. + if $LANG != '' + unlet $LANG + endif + e Xfoo.pl compiler perl call assert_equal('perl', b:current_compiler) -- cgit From 9fe472c91b7f05be3ab5f5e0a459e303fa0eacc7 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 17 Nov 2018 08:18:01 -0500 Subject: vim-patch:8.1.0258: not enough testing for the CompleteDone event Problem: Not enough testing for the CompleteDone event. Solution: Add a test. (closes vim/vim#3297) https://github.com/vim/vim/commit/af559d2c9f44bc88a7d94f9236b3c024563a8e73 --- 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 5ff63e58ba..d3429617d0 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -142,6 +142,19 @@ function Test_CompleteDoneDict() au! CompleteDone endfunc +func Test_CompleteDone_undo() + au CompleteDone * call append(0, "prepend1") + new + call setline(1, ["line1", "line2"]) + call feedkeys("Go\\\\", "tx") + call assert_equal(["prepend1", "line1", "line2", "line1", ""], + \ getline(1, '$')) + undo + call assert_equal(["line1", "line2"], getline(1, '$')) + bwipe! + au! CompleteDone +endfunc + function! s:CompleteDone_CompleteFuncDictNoUserData( findstart, base ) if a:findstart return 0 -- cgit From a9ae5bf36b9a742e99e0945df0a0c6e473de1bf3 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 17 Nov 2018 22:20:44 -0500 Subject: vim-patch:8.1.0298: window resize test sometimes fails on Mac Problem: Window resize test sometimes fails on Mac. Solution: Add Test_popup_and_window_resize() to flaky tests. https://github.com/vim/vim/commit/46fad2ef0bd5124f1be22c807214c243fb5611d8 --- src/nvim/testdir/runtest.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 99b2b940d7..8e9ee0494d 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -245,6 +245,7 @@ let s:flaky = [ \ 'Test_oneshot()', \ 'Test_out_cb()', \ 'Test_paused()', + \ 'Test_popup_and_window_resize()', " sometimes fails on Mac \ 'Test_quoteplus()', \ 'Test_quotestar()', \ 'Test_reltime()', -- cgit From 2b7e58cb2c59d6ad6f548b00abd85f396a8a244f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 17 Nov 2018 22:23:04 -0500 Subject: vim-patch:8.1.0299: misplaced comment Problem: misplaced comment Solution: Remove comment https://github.com/vim/vim/commit/142ae736d984f4575c1c6ec1a4f679ae4ddf9413 --- src/nvim/testdir/runtest.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 8e9ee0494d..4fe7db135b 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -245,7 +245,7 @@ let s:flaky = [ \ 'Test_oneshot()', \ 'Test_out_cb()', \ 'Test_paused()', - \ 'Test_popup_and_window_resize()', " sometimes fails on Mac + \ 'Test_popup_and_window_resize()', \ 'Test_quoteplus()', \ 'Test_quotestar()', \ 'Test_reltime()', -- cgit From eab181a74e8534974f6cc887bae9b65fddcfe25e Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 17 Nov 2018 22:37:31 -0500 Subject: vim-patch:8.1.0318: the getftype() test may fail for char devices Problem: The getftype() test may fail for char devices if the file disappeared in between the listing and the getftype() call. Solution: Ignore empty result. (Ozaki Kiichi, closes vim/vim#3360) https://github.com/vim/vim/commit/3b3a506f57a397d83db361be35189c591bff10fb --- src/nvim/testdir/test_stat.vim | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_stat.vim b/src/nvim/testdir/test_stat.vim index c276df0a92..74b76d668e 100644 --- a/src/nvim/testdir/test_stat.vim +++ b/src/nvim/testdir/test_stat.vim @@ -141,17 +141,29 @@ func Test_getftype() endif for cdevfile in systemlist('find /dev -type c -maxdepth 2 2>/dev/null') - call assert_equal('cdev', getftype(cdevfile)) + let type = getftype(cdevfile) + " ignore empty result, can happen if the file disappeared + if type != '' + call assert_equal('cdev', type) + endif endfor for bdevfile in systemlist('find /dev -type b -maxdepth 2 2>/dev/null') - call assert_equal('bdev', getftype(bdevfile)) + let type = getftype(bdevfile) + " ignore empty result, can happen if the file disappeared + if type != '' + call assert_equal('bdev', type) + endif endfor " The /run/ directory typically contains socket files. " If it does not, test won't fail but will not test socket files. for socketfile in systemlist('find /run -type s -maxdepth 2 2>/dev/null') - call assert_equal('socket', getftype(socketfile)) + let type = getftype(socketfile) + " ignore empty result, can happen if the file disappeared + if type != '' + call assert_equal('socket', type) + endif endfor " TODO: file type 'other' is not tested. How can we test it? -- cgit From 344dd2757ac24417252ac4d5c73382eb07f81ede Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 18 Nov 2018 12:05:43 -0500 Subject: vim-patch:8.1.0536: file time test fails when using NFS (#9251) Problem: File time test fails when using NFS. Solution: Use three file times instead of localtim(). (James McCoy, closes vim/vim#3618) https://github.com/vim/vim/commit/addc156c38d442367854f71baee31f2eb003c699 --- src/nvim/testdir/test_stat.vim | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_stat.vim b/src/nvim/testdir/test_stat.vim index 74b76d668e..253f74c2ad 100644 --- a/src/nvim/testdir/test_stat.vim +++ b/src/nvim/testdir/test_stat.vim @@ -1,31 +1,33 @@ " Tests for stat functions and checktime func CheckFileTime(doSleep) - let fname = 'Xtest.tmp' + let fnames = ['Xtest1.tmp', 'Xtest2.tmp', 'Xtest3.tmp'] + let times = [] let result = 0 - let ts = localtime() - if a:doSleep - sleep 1 - endif + " Use three files istead of localtim(), with a network filesystem the file + " times may differ at bit let fl = ['Hello World!'] - call writefile(fl, fname) - let tf = getftime(fname) - if a:doSleep - sleep 1 - endif - let te = localtime() + for fname in fnames + call writefile(fl, fname) + call add(times, getftime(fname)) + if a:doSleep + sleep 1 + endif + endfor - let time_correct = (ts <= tf && tf <= te) + let time_correct = (times[0] <= times[1] && times[1] <= times[2]) if a:doSleep || time_correct - call assert_true(time_correct) - call assert_equal(strlen(fl[0] . "\n"), getfsize(fname)) - call assert_equal('file', getftype(fname)) - call assert_equal('rw-', getfperm(fname)[0:2]) + call assert_true(time_correct, printf('Expected %s <= %s <= %s', times[0], times[1], times[2])) + call assert_equal(strlen(fl[0] . "\n"), getfsize(fnames[0])) + call assert_equal('file', getftype(fnames[0])) + call assert_equal('rw-', getfperm(fnames[0])[0:2]) let result = 1 endif - call delete(fname) + for fname in fnames + call delete(fname) + endfor return result endfunc -- cgit From e53ae88e7ecb20f39f9f9c73cd9b39bc12a665ab Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 18 Nov 2018 19:38:51 -0500 Subject: vim-patch:8.1.0398: no test for -o and -O command line arguments (#9253) Problem: No test for -o and -O command line arguments. Solution: Add a test. (Dominique Pelle, closes vim/vim#3438) https://github.com/vim/vim/commit/8f4499b81612568b4964e8445d86e34e6d644b13 --- src/nvim/testdir/test_startup.vim | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 2f4d857986..3bc9eaf756 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -150,6 +150,83 @@ func Test_compatible_args() call delete('Xtestout') endfunc +" Test the -o[N] and -O[N] arguments to open N windows split +" horizontally or vertically. +func Test_o_arg() + let after = [ + \ 'call writefile([winnr("$"), + \ winheight(1), winheight(2), &lines, + \ winwidth(1), winwidth(2), &columns, + \ bufname(winbufnr(1)), bufname(winbufnr(2))], + \ "Xtestout")', + \ 'qall', + \ ] + if RunVim([], after, '-o2') + " Open 2 windows split horizontally. Expect: + " - 2 windows + " - both windows should have the same or almost the same height + " - sum of both windows height (+ 3 for both statusline and Ex command) + " should be equal to the number of lines + " - both windows should have the same width which should be equal to the + " number of columns + " - buffer of both windows should have no name + let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') + call assert_equal('2', wn) + call assert_inrange(0, 1, wh1 - wh2) + call assert_equal(string(wh1 + wh2 + 3), ln) + call assert_equal(ww1, ww2) + call assert_equal(ww1, cn) + call assert_equal('', bn1) + call assert_equal('', bn2) + endif + + if RunVim([], after, '-o foo bar') + " Same expectations as for -o2 but buffer names should be foo and bar + let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') + call assert_equal('2', wn) + call assert_inrange(0, 1, wh1 - wh2) + call assert_equal(string(wh1 + wh2 + 3), ln) + call assert_equal(ww1, ww2) + call assert_equal(ww1, cn) + call assert_equal('foo', bn1) + call assert_equal('bar', bn2) + endif + + if RunVim([], after, '-O2') + " Open 2 windows split vertically. Expect: + " - 2 windows + " - both windows should have the same or almost the same width + " - sum of both windows width (+ 1 separator) should be equal to the + " number of columns + " - both windows should have the same height + " - window height (+ 2 for the statusline and Ex command) should be equal + " to the number of lines + " - buffer of both windowns should have no name + let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') + call assert_equal('2', wn) + call assert_inrange(0, 1, ww1 - ww2) + call assert_equal(string(ww1 + ww2 + 1), cn) + call assert_equal(wh1, wh2) + call assert_equal(string(wh1 + 2), ln) + call assert_equal('', bn1) + call assert_equal('', bn2) + endif + + if RunVim([], after, '-O foo bar') + " Same expectations as for -O2 but buffer names should be foo and bar + let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') + call assert_equal('2', wn) + call assert_inrange(0, 1, ww1 - ww2) + call assert_equal(string(ww1 + ww2 + 1), cn) + call assert_equal(wh1, wh2) + call assert_equal(string(wh1 + 2), ln) + call assert_equal('foo', bn1) + call assert_equal('bar', bn2) + endif + + call delete('Xtestout') +endfunc + func Test_file_args() let after = [ \ 'call writefile(argv(), "Xtestout")', -- cgit From a5637597a6df1465df50584d853dbd8d77cb24da Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 19 Nov 2018 21:10:52 -0500 Subject: vim-patch:8.0.1427: the :leftabove modifier doesn't work for :copen Problem: The :leftabove modifier doesn't work for :copen. Solution: Respect the split modifier. (Yegappan Lakshmanan, closes vim/vim#2496) https://github.com/vim/vim/commit/de04654ddc865af94ef04b1738b335a924be7923 --- src/nvim/testdir/test_quickfix.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index bfe5791ec8..cb3e7ca8f6 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -2637,3 +2637,30 @@ func Test_shorten_fname() silent! clist call assert_equal('test_quickfix.vim', bufname('test_quickfix.vim')) endfunc + +" Test for the position of the quickfix and location list window +func Test_qfwin_pos() + " Open two windows + new | only + new + cexpr ['F1:10:L10'] + copen + " Quickfix window should be the bottom most window + call assert_equal(3, winnr()) + close + " Open at the very top + wincmd t + topleft copen + call assert_equal(1, winnr()) + close + " open left of the current window + wincmd t + below new + leftabove copen + call assert_equal(2, winnr()) + close + " open right of the current window + rightbelow copen + call assert_equal(3, winnr()) + close +endfunc -- cgit From e71f43f8e7beaa0d1ed35b63ea55e43f886a0875 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 19 Nov 2018 21:52:38 -0500 Subject: vim-patch:8.0.0737: crash when X11 selection is very big Problem: Crash when X11 selection is very big. Solution: Use static items instead of allocating them. Add callbacks. (Ozaki Kiichi) https://github.com/vim/vim/commit/cdb7e1b7f9e18a7b165ff09103a9994f84966123 --- src/nvim/testdir/shared.vim | 7 ++++--- src/nvim/testdir/test_quotestar.vim | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index b1f1d8fe66..a19929e79b 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -136,14 +136,15 @@ endfunc " Wait for up to a second for "expr" to become true. " Return time slept in milliseconds. With the +reltime feature this can be " more than the actual waiting time. Without +reltime it can also be less. -func WaitFor(expr) +func WaitFor(expr, ...) + let timeout = get(a:000, 0, 1000) " using reltime() is more accurate, but not always available if has('reltime') let start = reltime() else let slept = 0 endif - for i in range(100) + for i in range(timeout / 10) try if eval(a:expr) if has('reltime') @@ -158,7 +159,7 @@ func WaitFor(expr) endif sleep 10m endfor - return 1000 + return timeout endfunc " Wait for up to a given milliseconds. diff --git a/src/nvim/testdir/test_quotestar.vim b/src/nvim/testdir/test_quotestar.vim index 3a7edcbd7c..3ce1a84281 100644 --- a/src/nvim/testdir/test_quotestar.vim +++ b/src/nvim/testdir/test_quotestar.vim @@ -87,6 +87,18 @@ func Do_test_quotestar_for_x11() " Check that the *-register of this vim instance is changed as expected. call WaitFor('@* == "yes"', 3000) + " Handle the large selection over 262040 byte. + let length = 262044 + let sample = 'a' . repeat('b', length - 2) . 'c' + let @* = sample + call WaitFor('remote_expr("' . name . '", "len(@*) >= ' . length . '", "", 1)', 3000) + let res = remote_expr(name, "@*", "", 2) + call assert_equal(length, len(res)) + " Check length to prevent a large amount of output at assertion failure. + if length == len(res) + call assert_equal(sample, res) + endif + if has('unix') && has('gui') && !has('gui_running') let @* = '' -- cgit From fdc2707b41a0c82bb621c2d437f775690bff45ee Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 19 Nov 2018 22:31:11 -0500 Subject: vim-patch:8.0.1249: no error when WaitFor() gets an invalid wrong expression Problem: No error when WaitFor() gets an invalid wrong expression. Solution: Do not ignore errors in evaluationg the expression. Fix places where the expression was wrong. https://github.com/vim/vim/commit/c20e0d52071a3f6e12321ec3344024faa4695da9 --- src/nvim/testdir/shared.vim | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index a19929e79b..eb6798f353 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -145,15 +145,12 @@ func WaitFor(expr, ...) let slept = 0 endif for i in range(timeout / 10) - try - if eval(a:expr) - if has('reltime') - return float2nr(reltimefloat(reltime(start)) * 1000) - endif - return slept + if eval(a:expr) + if has('reltime') + return float2nr(reltimefloat(reltime(start)) * 1000) endif - catch - endtry + return slept + endif if !has('reltime') let slept += 10 endif -- cgit From f1d2297c5ece3463ae098b9cd779e067cbf653fa Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 19 Nov 2018 23:45:28 -0500 Subject: vim-patch:8.0.1163: popup test is flaky Problem: Popup test is flaky. Solution: Add a WaitFor() and fix another. https://github.com/vim/vim/commit/c79977a437d91306d576fb59e490601409503303 --- src/nvim/testdir/test_popup.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index 6fd58a1483..9cd591838c 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -681,14 +681,15 @@ func Test_popup_and_window_resize() call term_wait(g:buf, 100) call term_sendkeys(g:buf, "\") call term_wait(g:buf, 100) + call WaitFor('term_getline(g:buf, 1) =~ "^!"') call assert_match('^!\s*$', term_getline(g:buf, 1)) exe 'resize +' . (h - 1) call term_wait(g:buf, 100) redraw! - call WaitFor('"" == term_getline(g:buf, 1)') + call WaitFor('term_getline(g:buf, 1) == ""') call assert_equal('', term_getline(g:buf, 1)) sleep 100m - call WaitFor('"^!" =~ term_getline(g:buf, term_getcursor(g:buf)[0] + 1)') + call WaitFor('term_getline(g:buf, term_getcursor(g:buf)[0] + 1) =~ "^!"') call assert_match('^!\s*$', term_getline(g:buf, term_getcursor(g:buf)[0] + 1)) bwipe! endfunc -- cgit From 3c228e8935ab39f9c63f9e32152cb3d2b4bce543 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 19 Nov 2018 23:45:59 -0500 Subject: vim-patch:8.0.1165: popup test is still flaky Problem: Popup test is still flaky. Solution: Add a term_wait() call. (Ozaki Kiichi) https://github.com/vim/vim/commit/f52c38315669f85bbcf3bd74c590148bf588f6c6 --- src/nvim/testdir/test_popup.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index 9cd591838c..b8f7ac0459 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -677,20 +677,26 @@ func Test_popup_and_window_resize() endif let g:buf = term_start([$NVIM_PRG, '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3}) call term_sendkeys(g:buf, (h / 3 - 1)."o\G") + call term_wait(g:buf, 100) call term_sendkeys(g:buf, "i\") call term_wait(g:buf, 100) call term_sendkeys(g:buf, "\") call term_wait(g:buf, 100) + " popup first entry "!" must be at the top call WaitFor('term_getline(g:buf, 1) =~ "^!"') call assert_match('^!\s*$', term_getline(g:buf, 1)) exe 'resize +' . (h - 1) call term_wait(g:buf, 100) redraw! + " popup shifted down, first line is now empty call WaitFor('term_getline(g:buf, 1) == ""') call assert_equal('', term_getline(g:buf, 1)) sleep 100m + " popup is below cursor line and shows first match "!" call WaitFor('term_getline(g:buf, term_getcursor(g:buf)[0] + 1) =~ "^!"') call assert_match('^!\s*$', term_getline(g:buf, term_getcursor(g:buf)[0] + 1)) + " cursor line also shows ! + call assert_match('^!\s*$', term_getline(g:buf, term_getcursor(g:buf)[0])) bwipe! endfunc -- cgit From 54a586736bab4a657b1457c59d1c0959f009687d Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 19 Nov 2018 23:46:31 -0500 Subject: vim-patch:8.0.1171: popup test is still a bit flaky Problem: Popup test is still a bit flaky. Solution: Change term_wait() calls. (Ozaki Kiichi) https://github.com/vim/vim/commit/712549e04eddd6687c4b7654ec9af6da6c365603 --- src/nvim/testdir/test_popup.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index b8f7ac0459..c9cd04018c 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -677,9 +677,8 @@ func Test_popup_and_window_resize() endif let g:buf = term_start([$NVIM_PRG, '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3}) call term_sendkeys(g:buf, (h / 3 - 1)."o\G") - call term_wait(g:buf, 100) call term_sendkeys(g:buf, "i\") - call term_wait(g:buf, 100) + call term_wait(g:buf, 200) call term_sendkeys(g:buf, "\") call term_wait(g:buf, 100) " popup first entry "!" must be at the top -- cgit From bebd1f9f7629c6150e7eadcf0d33e9c90c81add2 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 20 Nov 2018 20:15:30 -0500 Subject: vim-patch:8.0.1731: characters deleted on completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Characters deleted on completion. (Adrià Farrés) Solution: Also check the last item for the ORIGINAL_TEXT flag. (Christian Brabandt, closes vim/vim#1645) https://github.com/vim/vim/commit/e87edf3b85f607632e5431640071fdbc36b685b2 --- src/nvim/testdir/test_popup.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index c9cd04018c..09dc3ba43f 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -571,6 +571,15 @@ func Test_completion_clear_candidate_list() bw! endfunc +func Test_popup_complete_backwards() + new + call setline(1, ['Post', 'Port', 'Po']) + let expected=['Post', 'Port', 'Port'] + call cursor(3,2) + call feedkeys("A\". repeat("\", 3). "rt\", 'tx') + call assert_equal(expected, getline(1,'$')) + bwipe! +endfunc func Test_popup_and_preview_autocommand() " This used to crash Vim -- cgit From 5d22d100f2a848b692c37dc5d413939c8ef7681f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 20 Nov 2018 21:13:28 -0500 Subject: vim-patch:8.1.0038: popup test causes Vim to exit Problem: Popup test causes Vim to exit. Solution: Disable the broken part of the test for now. https://github.com/vim/vim/commit/680c99b2efc7e2a9e6b3d611133f43fb7f8c6811 --- src/nvim/testdir/test_popup.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index 09dc3ba43f..6c43cbc1dc 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -246,6 +246,10 @@ func! Test_popup_completion_insertmode() iunmap endfunc +" TODO: Fix what breaks after this line. +" - Do not use "q!", it may exit Vim if there is an error +finish + func Test_noinsert_complete() function! s:complTest1() abort call complete(1, ['source', 'soundfold']) -- cgit From 5a752c97d5294f4a69613db71adf9beb6a8f8790 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 29 Nov 2018 01:51:26 +0100 Subject: vim-patch:8.1.0098: segfault when pattern with \z() is very slow (#9283) Problem: Segfault when pattern with \z() is very slow. Solution: Check for NULL regprog. Add "nfa_fail" to test_override() to be able to test this. Fix that 'searchhl' resets called_emsg. https://github.com/vim/vim/commit/bcf9442307075bac40d44328c8bf7ea21857b138 closes #8788 --- src/nvim/testdir/test_syntax.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index e35c0f1105..e70d9b7c66 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -482,3 +482,15 @@ fun Test_synstack_synIDtrans() syn clear bw! endfunc + +" Using \z() in a region with NFA failing should not crash. +func Test_syn_wrong_z_one() + new + call setline(1, ['just some text', 'with foo and bar to match with']) + syn region FooBar start="foo\z(.*\)bar" end="\z1" + " call test_override("nfa_fail", 1) + redraw! + redraw! + " call test_override("ALL", 0) + bwipe! +endfunc -- cgit From b0ebf61d37ccae3c480834d2ac1b5559e7e3d20d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 30 Nov 2018 05:25:20 +0100 Subject: test: adjust time-sensitive tests From test_alot.vim: Found errors in Test_lambda_with_timer(): First run: function RunTheTest[35]..Test_lambda_with_timer line 19: Expected True but got 0 Second run: function RunTheTest[35]..Test_lambda_with_timer line 19: Expected True but got 0 previously: #9220 - Timer tests are less reliable on Travis CI macOS 10.12/10.13. ref #6829 ref e39dade80b02 ref de13113dc16e ref https://github.com/neovim/neovim/pull/9095#issuecomment-429603452 > We don't guarantee that a X ms timer is triggered during Y ms sleep > for any X to happen with X=10ms, Y=40ms. - Call test_garbagecollect_now(), as Vim does. --- src/nvim/testdir/test_lambda.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_lambda.vim b/src/nvim/testdir/test_lambda.vim index 2ac84c2213..6e07c874b4 100644 --- a/src/nvim/testdir/test_lambda.vim +++ b/src/nvim/testdir/test_lambda.vim @@ -33,9 +33,9 @@ function! Test_lambda_with_timer() call s:Foo() sleep 210ms " do not collect lambda - call garbagecollect() + call test_garbagecollect_now() let m = s:n - sleep 210ms + sleep 230ms call timer_stop(s:timer_id) call assert_true(m > 1) call assert_true(s:n > m + 1) -- cgit From 0ce880083d1faeebaecd393fc28e443b19862540 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 30 Nov 2018 22:21:26 +0100 Subject: test/macOS: adjust time-sensitive tests From test_timers.vim: Found errors in Test_paused(): First run: function RunTheTest[35]..Test_paused line 20: Expected range 0 - 100, but got 123 Second run: function RunTheTest[35]..Test_paused line 20: Expected range 0 - 100, but got 106 previously: #9220 - Timer tests are less reliable on Travis CI macOS 10.12/10.13. ref #6829 ref e39dade80b02 ref de13113dc16e ref https://github.com/neovim/neovim/pull/9095#issuecomment-429603452 > We don't guarantee that a X ms timer is triggered during Y ms sleep > for any X to happen with X=10ms, Y=40ms. --- src/nvim/testdir/test_timers.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 8a3e57bb02..cdfdd473b9 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -121,7 +121,7 @@ func Test_paused() let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) if has('reltime') - call assert_inrange(0, 100, slept) + call assert_inrange(0, 140, slept) else call assert_inrange(0, 10, slept) endif -- cgit From a9e368a7050c86dff36d80dc1cced21de14dd3ac Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 30 Nov 2018 22:43:08 -0500 Subject: vim-patch:8.1.0553: it is not easy to edit a script that was sourced (#9298) Problem: It is not easy to edit a script that was sourced. Solution: Add a count to ":scriptnames", so that ":script 40" edits the script with script ID 40. https://github.com/vim/vim/commit/07dc18ffa4e7ed202f219fe2fd3d6f58246f71f9 --- src/nvim/testdir/test_scriptnames.vim | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/nvim/testdir/test_scriptnames.vim (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_scriptnames.vim b/src/nvim/testdir/test_scriptnames.vim new file mode 100644 index 0000000000..fc6c910bfa --- /dev/null +++ b/src/nvim/testdir/test_scriptnames.vim @@ -0,0 +1,26 @@ +" Test for :scriptnames + +func Test_scriptnames() + call writefile(['let did_load_script = 123'], 'Xscripting') + source Xscripting + call assert_equal(123, g:did_load_script) + + let scripts = split(execute('scriptnames'), "\n") + let last = scripts[-1] + call assert_match('\', last) + let lastnr = substitute(last, '\D*\(\d\+\):.*', '\1', '') + exe 'script ' . lastnr + call assert_equal('Xscripting', expand('%:t')) + + call assert_fails('script ' . (lastnr + 1), 'E474:') + call assert_fails('script 0', 'E939:') + + new + call setline(1, 'nothing') + call assert_fails('script ' . lastnr, 'E37:') + exe 'script! ' . lastnr + call assert_equal('Xscripting', expand('%:t')) + + bwipe + call delete('Xscripting') +endfunc -- cgit From abd32c1bb8c01725291a8de2a691b89ee7050012 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 3 Dec 2018 22:46:11 -0500 Subject: vim-patch:8.1.0559: command line completion not sufficiently tested Problem: Command line completion not sufficiently tested. Solution: Add more tests. (Dominique Pelle, closes vim/vim#3622) https://github.com/vim/vim/commit/b513d3079bbe3f59a1f1a3d6931939a76cd7e54a --- src/nvim/testdir/test_arglist.vim | 12 ++++++++++++ src/nvim/testdir/test_filetype.vim | 4 ++++ src/nvim/testdir/test_history.vim | 5 +++++ src/nvim/testdir/test_messages.vim | 5 +++++ src/nvim/testdir/test_syntax.vim | 9 +++++++++ 5 files changed, 35 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 19d0cee47a..20171bb599 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -297,6 +297,18 @@ func Test_argdelete() %argd endfunc +func Test_argdelete_completion() + args foo bar + + call feedkeys(":argdelete \\\"\", 'tx') + call assert_equal('"argdelete bar foo', @:) + + call feedkeys(":argdelete x \\\"\", 'tx') + call assert_equal('"argdelete x bar foo', @:) + + %argd +endfunc + " Tests for the :next, :prev, :first, :last, :rewind commands func Test_argpos() call Reset_arglist() diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index b0a1ea0225..5d4a0ff3cb 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -596,3 +596,7 @@ func Test_script_detection() filetype off endfunc +func Test_setfiletype_completion() + call feedkeys(":setfiletype java\\\"\", 'tx') + call assert_equal('"setfiletype java javacc javascript', @:) +endfunc diff --git a/src/nvim/testdir/test_history.vim b/src/nvim/testdir/test_history.vim index ca31e3f06c..16aad9889e 100644 --- a/src/nvim/testdir/test_history.vim +++ b/src/nvim/testdir/test_history.vim @@ -104,3 +104,8 @@ function Test_Search_history_window() call assert_equal('a', @/) bwipe! endfunc + +function Test_history_completion() + call feedkeys(":history \\\"\", 'tx') + call assert_equal('"history / : = > ? @ all cmd debug expr input search', @:) +endfunc diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim index 188406e440..12101ec1f8 100644 --- a/src/nvim/testdir/test_messages.vim +++ b/src/nvim/testdir/test_messages.vim @@ -38,3 +38,8 @@ function Test_messages() let &more = oldmore endtry endfunction + +func Test_message_completion() + call feedkeys(":message \\\"\", 'tx') + call assert_equal('"message clear', @:) +endfunc diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index e70d9b7c66..6978faeb7b 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -114,6 +114,15 @@ func Test_syntime() bd endfunc +func Test_syntime_completion() + if !has('profile') + return + endif + + call feedkeys(":syntime \\\"\", 'tx') + call assert_equal('"syntime clear off on report', @:) +endfunc + func Test_syntax_list() syntax on let a = execute('syntax list') -- cgit From 769762834533292e1d6a34b3846213d3896dc386 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 5 Dec 2018 19:14:19 -0500 Subject: vim-patch:8.0.1425: execute() does not work in completion of user command (#9317) Problem: execute() does not work in completion of user command. (thinca) Solution: Switch off redir_off and restore it. (Ozaki Kiichi, closes vim/vim#2492) https://github.com/vim/vim/commit/2095148277cf1c4e7b3bbaf4e34812b7cfe3011b --- src/nvim/testdir/test_usercommands.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_usercommands.vim b/src/nvim/testdir/test_usercommands.vim index db603610da..1520c2f32a 100644 --- a/src/nvim/testdir/test_usercommands.vim +++ b/src/nvim/testdir/test_usercommands.vim @@ -206,3 +206,15 @@ func Test_CmdCompletion() com! -complete=customlist,CustomComp DoCmd : call assert_fails("call feedkeys(':DoCmd \', 'tx')", 'E117:') endfunc + +func CallExecute(A, L, P) + " Drop first '\n' + return execute('echo "hi"')[1:] +endfunc + +func Test_use_execute_in_completion() + command! -nargs=* -complete=custom,CallExecute DoExec : + call feedkeys(":DoExec \\\"\", 'tx') + call assert_equal('"DoExec hi', @:) + delcommand DoExec +endfunc -- cgit From f17700544707160fb9588f37d1f3daef4f7bc483 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 6 Dec 2018 23:21:56 -0500 Subject: vim-patch:8.1.0564: setting v:errors to wrong type still possible Problem: Setting v:errors to wrong type still possible. Solution: Return after giving an error message. (Christian Brabandt) https://github.com/vim/vim/commit/88b53fd0521d1e62df17a8a1f2181425e9d4854c --- src/nvim/testdir/test_eval_stuff.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_eval_stuff.vim b/src/nvim/testdir/test_eval_stuff.vim index 92e1ec5335..111c85bb95 100644 --- a/src/nvim/testdir/test_eval_stuff.vim +++ b/src/nvim/testdir/test_eval_stuff.vim @@ -11,3 +11,13 @@ endfunction func Test_catch_return_with_error() call assert_equal(1, s:foo()) endfunc + +func Test_E963() + " These commands used to cause an internal error prior to vim 8.1.0563 + let v_e = v:errors + let v_o = v:oldfiles + call assert_fails("let v:errors=''", 'E963:') + call assert_equal(v_e, v:errors) + call assert_fails("let v:oldfiles=''", 'E963:') + call assert_equal(v_o, v:oldfiles) +endfunc -- cgit From f1eb25f0c45d7612d495f2cbd43a29da294d5325 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 8 Dec 2018 08:21:49 -0500 Subject: vim-patch:8.1.0570: 'commentstring' not used when adding fold marker (#9331) Problem: 'commentstring' not used when adding fold marker. (Maxim Kim) Solution: Only use empty 'comments' middle when leader is empty. (Christian Brabandt, closes vim/vim#3670) https://github.com/vim/vim/commit/539328197c51c1586cbbb6b6be3db3c412249b49 --- src/nvim/testdir/test_fold.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim index b6a545f959..85f58ada7e 100644 --- a/src/nvim/testdir/test_fold.vim +++ b/src/nvim/testdir/test_fold.vim @@ -674,3 +674,20 @@ func Test_fold_last_line_with_pagedown() set fdm& enew! endfunc + +func Test_folds_marker_in_comment2() + new + call setline(1, ['Lorem ipsum dolor sit', 'Lorem ipsum dolor sit', 'Lorem ipsum dolor sit']) + setl fen fdm=marker + setl commentstring= + setl comments=s: + norm! zf2j + setl nofen + :1y + call assert_equal(['Lorem ipsum dolor sit'], getreg(0,1,1)) + :+2y + call assert_equal(['Lorem ipsum dolor sit'], getreg(0,1,1)) + + set foldmethod& + bwipe! +endfunc -- cgit From cf1ffa91667a482c6355f5999b9e97ccc0b4126a Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 2 Dec 2018 22:58:07 +0200 Subject: vim-patch:8.1.0360: using an external diff program is slow and inflexible Problem: Using an external diff program is slow and inflexible. Solution: Include the xdiff library. (Christian Brabandt) Use it by default. https://github.com/vim/vim/commit/e828b7621cf9065a3582be0c4dd1e0e846e335bf vim-patch:8.1.0360 vim-patch:8.1.0364 vim-patch:8.1.0366 vim-patch:8.1.0370 vim-patch:8.1.0377 vim-patch:8.1.0378 vim-patch:8.1.0381 vim-patch:8.1.0396 vim-patch:8.1.0432 --- src/nvim/testdir/test_diffmode.vim | 105 +++++++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 16 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index afe289b262..3e47b02fc8 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -33,6 +33,18 @@ func Test_diff_fold_sync() endfunc func Test_vert_split() + set diffopt=filler + call Common_vert_split() + set diffopt& +endfunc + +func Test_vert_split_internal() + set diffopt=internal,filler + call Common_vert_split() + set diffopt& +endfunc + +func Common_vert_split() " Disable the title to avoid xterm keeping the wrong one. set notitle noicon new @@ -275,10 +287,8 @@ func Test_diffoff() bwipe! endfunc -func Test_diffopt_icase() - set diffopt=icase,foldcolumn:0 - - e one +func Common_icase_test() + edit one call setline(1, ['One', 'Two', 'Three', 'Four', 'Fi#ve']) redraw let normattr = screenattr(1, 1) @@ -300,32 +310,54 @@ func Test_diffopt_icase() diffoff! %bwipe! +endfunc + +func Test_diffopt_icase() + set diffopt=icase,foldcolumn:0 + call Common_icase_test() set diffopt& endfunc -func Test_diffopt_iwhite() - set diffopt=iwhite,foldcolumn:0 +func Test_diffopt_icase_internal() + set diffopt=icase,foldcolumn:0,internal + call Common_icase_test() + set diffopt& +endfunc - e one - " Difference in trailing spaces should be ignored, +func Common_iwhite_test() + edit one + " Difference in trailing spaces and amount of spaces should be ignored, " but not other space differences. - call setline(1, ["One \t", 'Two', 'Three', 'Four']) + call setline(1, ["One \t", 'Two', 'Three', 'one two', 'one two', 'Four']) redraw let normattr = screenattr(1, 1) diffthis botright vert new two - call setline(1, ["One\t ", "Two\t ", 'Three', ' Four']) + call setline(1, ["One\t ", "Two\t ", 'Three', 'one two', 'onetwo', ' Four']) diffthis redraw call assert_equal(normattr, screenattr(1, 1)) call assert_equal(normattr, screenattr(2, 1)) call assert_equal(normattr, screenattr(3, 1)) - call assert_notequal(normattr, screenattr(4, 1)) + call assert_equal(normattr, screenattr(4, 1)) + call assert_notequal(normattr, screenattr(5, 1)) + call assert_notequal(normattr, screenattr(6, 1)) diffoff! %bwipe! +endfunc + +func Test_diffopt_iwhite() + set diffopt=iwhite,foldcolumn:0 + call Common_iwhite_test() + set diffopt& +endfunc + +func Test_diffopt_iwhite_internal() + set diffopt=internal,iwhite,foldcolumn:0 + call Common_iwhite_test() set diffopt& endfunc @@ -339,8 +371,13 @@ func Test_diffopt_context() set diffopt=context:2 call assert_equal('+-- 2 lines: 1', foldtextresult(1)) + set diffopt=internal,context:2 + call assert_equal('+-- 2 lines: 1', foldtextresult(1)) + set diffopt=context:1 call assert_equal('+-- 3 lines: 1', foldtextresult(1)) + set diffopt=internal,context:1 + call assert_equal('+-- 3 lines: 1', foldtextresult(1)) diffoff! %bwipe! @@ -348,7 +385,7 @@ func Test_diffopt_context() endfunc func Test_diffopt_horizontal() - set diffopt=horizontal + set diffopt=internal,horizontal diffsplit call assert_equal(&columns, winwidth(1)) @@ -362,7 +399,7 @@ func Test_diffopt_horizontal() endfunc func Test_diffopt_vertical() - set diffopt=vertical + set diffopt=internal,vertical diffsplit call assert_equal(&lines - 2, winheight(1)) @@ -376,7 +413,7 @@ func Test_diffopt_vertical() endfunc func Test_diffopt_hiddenoff() - set diffopt=filler,foldcolumn:0,hiddenoff + set diffopt=internal,filler,foldcolumn:0,hiddenoff e! one call setline(1, ['Two', 'Three']) redraw @@ -399,7 +436,7 @@ func Test_diffopt_hiddenoff() endfunc func Test_diffoff_hidden() - set diffopt=filler,foldcolumn:0 + set diffopt=internal,filler,foldcolumn:0 e! one call setline(1, ['Two', 'Three']) redraw @@ -523,7 +560,7 @@ func Test_diffpatch() 3 + 4 . - saveas Xpatch + saveas! Xpatch bwipe! new call assert_fails('diffpatch Xpatch', 'E816:') @@ -569,6 +606,22 @@ func Test_diff_nomodifiable() %bwipe! endfunc +func Test_diff_filler() + new + call setline(1, [1, 2, 3, 'x', 4]) + diffthis + vnew + call setline(1, [1, 2, 'y', 'y', 3, 4]) + diffthis + redraw + + call assert_equal([0, 0, 0, 0, 0, 0, 0, 1, 0], map(range(-1, 7), 'diff_filler(v:val)')) + wincmd w + call assert_equal([0, 0, 0, 0, 2, 0, 0, 0], map(range(-1, 6), 'diff_filler(v:val)')) + + %bwipe! +endfunc + func Test_diff_lastline() enew! only! @@ -615,3 +668,23 @@ func Test_diff_with_cursorline() call StopVimInTerminal(buf) call delete('Xtest_diff_cursorline') endfunc + +func Test_diff_of_diff() + if !CanRunVimInTerminal() + return + endif + + call writefile([ + \ 'call setline(1, ["aa","bb","cc","@@ -3,2 +5,7 @@","dd","ee","ff"])', + \ 'vnew', + \ 'call setline(1, ["aa","bb","cc"])', + \ 'windo diffthis', + \ ], 'Xtest_diff_diff') + let buf = RunVimInTerminal('-S Xtest_diff_diff', {}) + + call VerifyScreenDump(buf, 'Test_diff_of_diff_01', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('Xtest_diff_diff') +endfunc -- cgit From 72c5a9db70f263eaac12aee140da03190e2fa605 Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 9 Dec 2018 13:50:14 +0200 Subject: vim-patch:8.1.0375: cannot use diff mode with Cygwin diff.exe Problem: Cannot use diff mode with Cygwin diff.exe. (Igor Forca) Solution: Skip over unrecognized lines in the diff output. https://github.com/vim/vim/commit/3b8defd0a52fc1276816608e7bb24b628ab14c2e --- src/nvim/testdir/test_diffmode.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 3e47b02fc8..645a87848b 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -517,7 +517,9 @@ func Test_diffexpr() endif func DiffExpr() - silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>' . v:fname_out + " Prepend some text to check diff type detection + call writefile(['warning', ' message'], v:fname_out) + silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>>' . v:fname_out endfunc set diffexpr=DiffExpr() set diffopt=foldcolumn:0 -- cgit From 2c92a4d0c8a398c8a7dfd1666fdcfd2ab89cc887 Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 9 Dec 2018 19:26:12 +0200 Subject: vim-patch:8.1.0397: no event triggered after updating diffs Problem: No event triggered after updating diffs. Solution: Add the DiffUpdated event. https://github.com/vim/vim/commit/e8fa05b5bc2d6d76bf5af50176a63655d00d1110 --- src/nvim/testdir/test_diffmode.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 645a87848b..6f25179ab1 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -2,6 +2,9 @@ func Test_diff_fold_sync() enew! + let g:update_count = 0 + au DiffUpdated * let g:update_count += 1 + let l = range(50) call setline(1, l) diffthis @@ -27,6 +30,9 @@ func Test_diff_fold_sync() call win_gotoid(winone) call assert_equal(23, getcurpos()[1]) + call assert_equal(1, g:update_count) + au! DiffUpdated + windo diffoff close! set nomodified -- cgit From e104228b1c89022f0b284753ff92deb2e9374c5b Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 9 Dec 2018 19:55:08 +0200 Subject: vim-patch:8.1.0458: ml_get error and crash when using "do" Problem: Ml_get error and crash when using "do". Solution: Adjust cursor position also when diffupdate is not needed. (Hirohito Higashi) https://github.com/vim/vim/commit/df77cef92ec034796723ffa3adb12e8b46daa98e --- src/nvim/testdir/test_diffmode.vim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 6f25179ab1..f34c2fd26d 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -275,6 +275,28 @@ func Test_dp_do_buffer() %bwipe! endfunc +func Test_do_lastline() + e! one + call setline(1, ['1','2','3','4','5','6']) + diffthis + + new two + call setline(1, ['2','4','5']) + diffthis + + 1 + norm dp]c + norm dp]c + wincmd w + call assert_equal(4, line('$')) + norm G + norm do + call assert_equal(3, line('$')) + + windo diffoff + %bwipe! +endfunc + func Test_diffoff() enew! call setline(1, ['Two', 'Three']) -- cgit From 8f20c22e10c35075afd97bf6af50fb6d9a2dc710 Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 9 Dec 2018 20:05:53 +0200 Subject: vim-patch:8.1.0497: :%diffput changes order of lines Problem: :%diffput changes order of lines. (Markus Braun) Solution: Do adjust marks when using internal diff. https://github.com/vim/vim/commit/5f57bdcab77bc417ae0357fe8ad6c7259b6d25df --- src/nvim/testdir/test_diffmode.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index f34c2fd26d..ad3eec3274 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -219,6 +219,26 @@ func Test_diffget_diffput() %bwipe! endfunc +" Test putting two changes from one buffer to another +func Test_diffput_two() + new a + let win_a = win_getid() + call setline(1, range(1, 10)) + diffthis + new b + let win_b = win_getid() + call setline(1, range(1, 10)) + 8del + 5del + diffthis + call win_gotoid(win_a) + %diffput + call win_gotoid(win_b) + call assert_equal(map(range(1, 10), 'string(v:val)'), getline(1, '$')) + bwipe! a + bwipe! b +endfunc + func Test_dp_do_buffer() e! one let bn1=bufnr('%') -- cgit From 55c5185884d707e6c59d1900a4d921038f360807 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 9 Dec 2018 21:11:56 -0500 Subject: vim-patch:8.1.0574: 'commentstring', fold marker in C (#9339) Problem: 'commentstring' not used when adding fold marker in C. Solution: Require white space before middle comment part. (mostly by Hirohito Higashi) https://github.com/vim/vim/commit/4af7259b2b35e85c590d54908fcd248d2c733be8 --- src/nvim/testdir/test_fold.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim index 85f58ada7e..0b4b5d1922 100644 --- a/src/nvim/testdir/test_fold.vim +++ b/src/nvim/testdir/test_fold.vim @@ -514,6 +514,35 @@ func Test_fold_marker() enew! endfunc +" test create fold markers with C filetype +func Test_fold_create_marker_in_C() + enew! + set fdm=marker fdl=9 + set filetype=c + + let content = [ + \ '/*', + \ ' * comment', + \ ' * ', + \ ' *', + \ ' */', + \ 'int f(int* p) {', + \ ' *p = 3;', + \ ' return 0;', + \ '}' + \] + for c in range(len(content) - 1) + bw! + call append(0, content) + call cursor(c + 1, 1) + norm! zfG + call assert_equal(content[c] . (c < 4 ? '{{{' : '/*{{{*/'), getline(c + 1)) + endfor + + set fdm& fdl& + enew! +endfunc + " test folding with indent func Test_fold_indent() enew! -- cgit From 6c602be33a5176fd1101e8cff45dd2a85b0e512e Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Wed, 31 Jan 2018 16:17:05 +0100 Subject: vim-patch:8.0.1445: cannot act on edits in the command line Problem: Cannot act on edits in the command line. Solution: Add the CmdlineChanged autocommand event. (xtal8, closes vim/vim#2603, closes vim/vim#2524) https://github.com/vim/vim/commit/153b704e20f9c269450a7d3ea8cafcf942579ab7 --- src/nvim/testdir/test_autocmd.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 9e8d2081c8..5deb789f48 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -818,6 +818,18 @@ func Test_QuitPre() endfunc func Test_Cmdline() + au! CmdlineChanged : let g:text = getcmdline() + let g:text = 0 + call feedkeys(":echom 'hello'\", 'xt') + call assert_equal("echom 'hello'", g:text) + au! CmdlineChanged + + au! CmdlineChanged : let g:entered = expand('') + let g:entered = 0 + call feedkeys(":echom 'hello'\", 'xt') + call assert_equal(':', g:entered) + au! CmdlineChanged + au! CmdlineEnter : let g:entered = expand('') au! CmdlineLeave : let g:left = expand('') let g:entered = 0 -- cgit From 0930435fc30d1e7e6be05ed1cd1d072e3616b6f4 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 10 Dec 2018 22:41:37 -0500 Subject: vim-patch:8.0.1748: CmdlineEnter command uses backslash instead of slash Problem: CmdlineEnter command uses backslash instead of slash. Solution: Don't treat the character as a file name. (closes vim/vim#2837) https://github.com/vim/vim/commit/a4baf5b32519855bb176a7aa0e9397c137ca890a --- src/nvim/testdir/test_autocmd.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 5deb789f48..253d6750ed 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -840,6 +840,8 @@ func Test_Cmdline() au! CmdlineEnter au! CmdlineLeave + let save_shellslash = &shellslash + set noshellslash au! CmdlineEnter / let g:entered = expand('') au! CmdlineLeave / let g:left = expand('') let g:entered = 0 @@ -852,6 +854,7 @@ func Test_Cmdline() bwipe! au! CmdlineEnter au! CmdlineLeave + let &shellslash = save_shellslash endfunc " Test for BufWritePre autocommand that deletes or unloads the buffer. -- cgit From bcc9b9335ceddf1f3ff11ae7bb2821c4f55c301b Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 14 Dec 2018 22:41:42 -0500 Subject: vim-patch:8.1.0585: undo test may fail on MS-Windows Problem: Undo test may fail on MS-Windows. Solution: Also handle lower case drive letters. https://github.com/vim/vim/commit/56242f2b08737677812513c447955579a19aa620 --- src/nvim/testdir/test_undo.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim index 83ede1dc37..9729ca9f57 100644 --- a/src/nvim/testdir/test_undo.vim +++ b/src/nvim/testdir/test_undo.vim @@ -373,7 +373,7 @@ funct Test_undofile() let cwd = getcwd() if has('win32') " Replace windows drive such as C:... into C%... - let cwd = substitute(cwd, '^\([A-Z]\):', '\1%', 'g') + let cwd = substitute(cwd, '^\([a-zA-Z]\):', '\1%', 'g') endif let pathsep = has('win32') ? '\' : '/' let cwd = substitute(cwd . pathsep . 'Xundofoo', pathsep, '%', 'g') -- cgit From 845973c9fed0da7a0d471f5b57ab361961a3de93 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 14 Dec 2018 22:46:22 -0500 Subject: vim-patch:8.1.0588: cannot define a sign with space in the text Problem: Cannot define a sign with space in the text. Solution: Allow for escaping characters. (Ben Jackson, closes vim/vim#2967) https://github.com/vim/vim/commit/06b056e110005ce0dd97b8c6333405afd06c36fc --- src/nvim/testdir/test_signs.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index d3c6d05f4f..3960177acd 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -104,6 +104,33 @@ func Test_sign() exe 'sign jump 43 file=' . fn call assert_equal('B', getline('.')) + " can't define a sign with a non-printable character as text + call assert_fails("sign define Sign4 text=\e linehl=Comment", 'E239:') + call assert_fails("sign define Sign4 text=a\e linehl=Comment", 'E239:') + call assert_fails("sign define Sign4 text=\ea linehl=Comment", 'E239:') + + " Only 1 or 2 character text is allowed + call assert_fails("sign define Sign4 text=abc linehl=Comment", 'E239:') + call assert_fails("sign define Sign4 text= linehl=Comment", 'E239:') + call assert_fails("sign define Sign4 text=\ ab linehl=Comment", 'E239:') + + " define sign with whitespace + sign define Sign4 text=\ X linehl=Comment + sign undefine Sign4 + sign define Sign4 linehl=Comment text=\ X + sign undefine Sign4 + + sign define Sign5 text=X\ linehl=Comment + sign undefine Sign5 + sign define Sign5 linehl=Comment text=X\ + sign undefine Sign5 + + " define sign with backslash + sign define Sign4 text=\\\\ linehl=Comment + sign undefine Sign4 + sign define Sign4 text=\\ linehl=Comment + sign undefine Sign4 + " After undefining the sign, we should no longer be able to place it. sign undefine Sign1 sign undefine Sign2 -- cgit From ae6848cd1296a3a86f0cc6e7623dc0a79521886d Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 15 Dec 2018 14:06:12 -0500 Subject: vim-patch:8.1.0596: not all parts of printf() are tested Problem: Not all parts of printf() are tested. Solution: Add a few more test cases. (Dominique Pelle, closes vim/vim#3691) https://github.com/vim/vim/commit/21e551cce26ea6ff389b6c90f1945facf1a8a066 --- src/nvim/testdir/test_expr.vim | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim index aaf32dff04..4f99625e73 100644 --- a/src/nvim/testdir/test_expr.vim +++ b/src/nvim/testdir/test_expr.vim @@ -177,6 +177,22 @@ function Test_printf_misc() call assert_equal('173', printf('%O', 123)) call assert_equal('7b', printf('%x', 123)) call assert_equal('7B', printf('%X', 123)) + + call assert_equal('123', printf('%hd', 123)) + call assert_equal('-123', printf('%hd', -123)) + call assert_equal('-1', printf('%hd', 0xFFFF)) + call assert_equal('-1', printf('%hd', 0x1FFFFF)) + + call assert_equal('123', printf('%hu', 123)) + call assert_equal('65413', printf('%hu', -123)) + call assert_equal('65535', printf('%hu', 0xFFFF)) + call assert_equal('65535', printf('%hu', 0x1FFFFF)) + + call assert_equal('123', printf('%ld', 123)) + call assert_equal('-123', printf('%ld', -123)) + call assert_equal('65535', printf('%ld', 0xFFFF)) + call assert_equal('131071', printf('%ld', 0x1FFFF)) + call assert_equal('{', printf('%c', 123)) call assert_equal('abc', printf('%s', 'abc')) call assert_equal('abc', printf('%S', 'abc')) @@ -216,6 +232,11 @@ function Test_printf_misc() call assert_equal(' 123', printf('% *d', 5, 123)) call assert_equal(' +123', printf('%+ *d', 5, 123)) + call assert_equal('foobar', printf('%.*s', 9, 'foobar')) + call assert_equal('foo', printf('%.*s', 3, 'foobar')) + call assert_equal('', printf('%.*s', 0, 'foobar')) + call assert_equal('foobar', printf('%.*s', -1, 'foobar')) + " Simple quote (thousand grouping char) is ignored. call assert_equal('+00123456', printf("%+'09d", 123456)) @@ -238,6 +259,11 @@ function Test_printf_misc() call assert_equal(' 00123', printf('%6.5d', 123)) call assert_equal(' 0007b', printf('%6.5x', 123)) + call assert_equal('123', printf('%.2d', 123)) + call assert_equal('0123', printf('%.4d', 123)) + call assert_equal('0000000123', printf('%.10d', 123)) + call assert_equal('123', printf('%.0d', 123)) + call assert_equal('abc', printf('%2s', 'abc')) call assert_equal('abc', printf('%2S', 'abc')) call assert_equal('abc', printf('%.4s', 'abc')) @@ -335,6 +361,11 @@ function Test_printf_float() call assert_equal("str2float('inf')", printf('%s', 1.0/0.0)) call assert_equal("-str2float('inf')", printf('%s', -1.0/0.0)) + " Test special case where max precision is truncated at 340. + call assert_equal('1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.330f', 1.0)) + call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.340f', 1.0)) + call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.350f', 1.0)) + " Float nan (not a number) has no sign. call assert_equal('nan', printf('%f', sqrt(-1.0))) call assert_equal('nan', printf('%f', 0.0/0.0)) -- cgit From e9685d9f70f26daa6a252baf8f5a2d411cf4b38f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 23 Dec 2018 07:12:59 -0500 Subject: vim-patch:8.1.0627: Python cannot handle function name of script-local function (#9392) Problem: Python cannot handle function name of script-local function. Solution: Use instead of the special byte code. (Ozaki Kiichi, closes vim/vim#3681) https://github.com/vim/vim/commit/9123c0b31a283f460ed2b6af95080120cf528118 --- src/nvim/testdir/test_python2.vim | 27 +++++++++++++++++++++++++++ src/nvim/testdir/test_python3.vim | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_python2.vim b/src/nvim/testdir/test_python2.vim index 63c38cd5d1..5ba9fd68cf 100644 --- a/src/nvim/testdir/test_python2.vim +++ b/src/nvim/testdir/test_python2.vim @@ -25,3 +25,30 @@ func Test_pydo() bwipe! endif endfunc + +func Test_vim_function() + " Check creating vim.Function object + py import vim + + func s:foo() + return matchstr(expand(''), '\zs\d\+_foo$') + endfunc + let name = '' . s:foo() + + try + py f = vim.bindeval('function("s:foo")') + call assert_equal(name, pyeval('f.name')) + catch + call assert_false(v:exception) + endtry + + try + py f = vim.Function('\x80\xfdR' + vim.eval('s:foo()')) + call assert_equal(name, pyeval('f.name')) + catch + call assert_false(v:exception) + endtry + + py del f + delfunc s:foo +endfunc diff --git a/src/nvim/testdir/test_python3.vim b/src/nvim/testdir/test_python3.vim index f5b2c89853..2e3fc93674 100644 --- a/src/nvim/testdir/test_python3.vim +++ b/src/nvim/testdir/test_python3.vim @@ -25,3 +25,30 @@ func Test_py3do() bwipe! endif endfunc + +func Test_vim_function() + " Check creating vim.Function object + py3 import vim + + func s:foo() + return matchstr(expand(''), '\zs\d\+_foo$') + endfunc + let name = '' . s:foo() + + try + py3 f = vim.bindeval('function("s:foo")') + call assert_equal(name, py3eval('f.name')) + catch + call assert_false(v:exception) + endtry + + try + py3 f = vim.Function(b'\x80\xfdR' + vim.eval('s:foo()').encode()) + call assert_equal(name, py3eval('f.name')) + catch + call assert_false(v:exception) + endtry + + py3 del f + delfunc s:foo +endfunc -- cgit