From dd935e147344d90d42710c144822259a6af6f090 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 5 May 2021 21:53:10 -0400 Subject: vim-patch:8.2.2819: finishing an abbreviation with multi-byte char may not work Problem: Finishing an abbreviation with a multi-byte char may not work. Solution: Escape K_SPECIAL in the typed character. (closes vim/vim#8160) https://github.com/vim/vim/commit/4934ed34c3e2090d1963c89c629cd3ce81d3ecd1 --- src/nvim/testdir/test_mapping.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 0191dbf33e..f88e8cf843 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -559,4 +559,13 @@ func Test_map_cmdkey_redo() ounmap i- endfunc +func Test_abbreviate_multi_byte() + new + iabbrev foo bar + call feedkeys("ifoo…\", 'xt') + call assert_equal("bar…", getline(1)) + iunabbrev foo + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 44a331c36b5af25e51b072e8e77c478c2540ff43 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 5 May 2021 22:08:18 -0400 Subject: vim-patch:8.2.2820: session file may divide by zero Problem: Session file may divide by zero. Solution: Avoid writing difide by zero. (closes vim/vim#8162) https://github.com/vim/vim/commit/b6c2e9a010ebd7db586081957e634903d4972fa1 Avoid typecasts if possible. Use PRIdLINENR, PRId64, to format line numbers. --- src/nvim/testdir/test_mksession.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index 7bb76ad9eb..d7cb4e743c 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -149,6 +149,21 @@ func Test_mksession_large_winheight() call delete('Xtest_mks_winheight.out') endfunc +func Test_mksession_zero_winheight() + set winminheight=0 + edit SomeFile + split + wincmd _ + mksession! Xtest_mks_zero + set winminheight& + " let text = readfile('Xtest_mks_zero')->join() + let text = join(readfile('Xtest_mks_zero')) + "call delete('Xtest_mks_zero') + close + " check there is no devide by zero + call assert_notmatch('/ 0[^0-9]', text) +endfunc + func Test_mksession_rtp() if has('win32') " TODO: fix problem with backslashes -- cgit From 7d2e76e3330ce341f8f5a2873477bd62a6131525 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 5 May 2021 22:53:02 -0400 Subject: vim-patch:8.2.2825: code in checkreadonly() not fully tested MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Code in checkreadonly() not fully tested. Solution: Add more tests. (Dominique Pellé, closes vim/vim#8169) https://github.com/vim/vim/commit/2bf6034e5caf36b319148f46ba9a12e36c3bd41d --- src/nvim/testdir/test_excmd.vim | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim index 15557056ee..4c7452fe69 100644 --- a/src/nvim/testdir/test_excmd.vim +++ b/src/nvim/testdir/test_excmd.vim @@ -132,6 +132,61 @@ func Test_confirm_cmd_cancel() call StopVimInTerminal(buf) endfunc +func Test_confirm_write_ro() + CheckNotGui + CheckRunVimInTerminal + + call writefile(['foo'], 'Xconfirm_write_ro') + let lines =<< trim END + set nobackup ff=unix cmdheight=2 + edit Xconfirm_write_ro + norm Abar + END + call writefile(lines, 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) + + " Try to write with 'ro' option. + call term_sendkeys(buf, ":set ro | confirm w\n") + call WaitForAssert({-> assert_match("^'readonly' option is set for \"Xconfirm_write_ro\"\. *$", + \ term_getline(buf, 18))}, 1000) + call WaitForAssert({-> assert_match('^Do you wish to write anyway? *$', + \ term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, 'N') + call WaitForAssert({-> assert_match('^ *$', term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('.* All$', term_getline(buf, 20))}, 1000) + call assert_equal(['foo'], readfile('Xconfirm_write_ro')) + + call term_sendkeys(buf, ":confirm w\n") + call WaitForAssert({-> assert_match("^'readonly' option is set for \"Xconfirm_write_ro\"\. *$", + \ term_getline(buf, 18))}, 1000) + call WaitForAssert({-> assert_match('^Do you wish to write anyway? *$', + \ term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, 'Y') + call WaitForAssert({-> assert_match('^"Xconfirm_write_ro" 1L, 7B written$', + \ term_getline(buf, 19))}, 1000) + call assert_equal(['foobar'], readfile('Xconfirm_write_ro')) + + " Try to write with read-only file permissions. + call setfperm('Xconfirm_write_ro', 'r--r--r--') + call term_sendkeys(buf, ":set noro | undo | confirm w\n") + call WaitForAssert({-> assert_match("^File permissions of \"Xconfirm_write_ro\" are read-only\. *$", + \ term_getline(buf, 17))}, 1000) + call WaitForAssert({-> assert_match('^It may still be possible to write it\. *$', + \ term_getline(buf, 18))}, 1000) + call WaitForAssert({-> assert_match('^Do you wish to try? *$', term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, 'Y') + call WaitForAssert({-> assert_match('^"Xconfirm_write_ro" 1L, 4B written$', + \ term_getline(buf, 19))}, 1000) + call assert_equal(['foo'], readfile('Xconfirm_write_ro')) + + call StopVimInTerminal(buf) + call delete('Xscript') + call delete('Xconfirm_write_ro') +endfunc + " Test for the :winsize command func Test_winsize_cmd() call assert_fails('winsize 1', 'E465:') -- cgit From 5c6018ba2f6b447a2433a336aacfe75e57e307bc Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 5 May 2021 22:56:57 -0400 Subject: vim-patch:8.2.2827: test file was not deleted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Test file was not deleted. Solution: Uncomment the delete() call. (Dominique Pellé, closes vim/vim#8172) https://github.com/vim/vim/commit/5f8ed7408aaf477215bcfde3e487e24b9e6ad870 --- src/nvim/testdir/test_mksession.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index d7cb4e743c..4e46dbac16 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -158,9 +158,9 @@ func Test_mksession_zero_winheight() set winminheight& " let text = readfile('Xtest_mks_zero')->join() let text = join(readfile('Xtest_mks_zero')) - "call delete('Xtest_mks_zero') + call delete('Xtest_mks_zero') close - " check there is no devide by zero + " check there is no divide by zero call assert_notmatch('/ 0[^0-9]', text) endfunc -- cgit From 296711cfad7bb8d80f2e2c363b3708764156444f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 6 May 2021 00:52:35 -0400 Subject: vim-patch:8.2.2829: some comments are not correct or clear Problem: Some comments are not correct or clear. Solution: Adjust the comments. Add test for cursor position. https://github.com/vim/vim/commit/df36514a6455342e178af693553ef9df9fcf8c83 --- src/nvim/testdir/test_exec_while_if.vim | 8 +++++--- src/nvim/testdir/test_substitute.vim | 9 +++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_exec_while_if.vim b/src/nvim/testdir/test_exec_while_if.vim index d6afabff45..3da2784d77 100644 --- a/src/nvim/testdir/test_exec_while_if.vim +++ b/src/nvim/testdir/test_exec_while_if.vim @@ -1,6 +1,6 @@ -" Test for :execute, :while and :if +" Test for :execute, :while, :for and :if -function Test_exec_while_if() +func Test_exec_while_if() new let i = 0 @@ -50,4 +50,6 @@ function Test_exec_while_if() \ "7x999999999888888887777777666666555554444333221", \ "8", \ "9x"], getline(1, 10)) -endfunction +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index cc3bfe9f7f..32167a45ba 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -754,4 +754,13 @@ func Test_submatch_list_concatenate() call assert_equal(substitute('A1', pat, Rep, ''), "[['A1'], ['1']]") endfunc +func Test_substitute_skipped_range() + new + if 0 + /1/5/2/2/\n + endif + call assert_equal([0, 1, 1, 0, 1], getcurpos()) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit