aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-08 06:51:57 +0800
committerGitHub <noreply@github.com>2024-10-07 22:51:57 +0000
commit5805716ca4dac8f214ed5fd8c3f0a5905a394e8c (patch)
tree6ae65a1994bbeda5f72e16fc4a8d7ae18a9f6348
parent376de1483ee5380aaf5d2b6bb93d6ba245bfc329 (diff)
downloadrneovim-5805716ca4dac8f214ed5fd8c3f0a5905a394e8c.tar.gz
rneovim-5805716ca4dac8f214ed5fd8c3f0a5905a394e8c.tar.bz2
rneovim-5805716ca4dac8f214ed5fd8c3f0a5905a394e8c.zip
vim-patch:9.1.0765: No test for patches 6.2.418 and 7.3.489 (#30713)
Problem: No test for patches 6.2.418 and 7.3.489 Solution: Add a test. Fix some whitespace problems in test_mapping.vim. Document the behavior (zeertzjq). closes: vim/vim#15815 https://github.com/vim/vim/commit/5df3cb2898d8b4ad42ac367a436afc79bffecfb4
-rw-r--r--runtime/doc/map.txt2
-rw-r--r--test/old/testdir/test_cmdline.vim2
-rw-r--r--test/old/testdir/test_mapping.vim81
-rw-r--r--test/old/testdir/test_quickfix.vim4
4 files changed, 63 insertions, 26 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 7fd1f3bfbb..4a4e34661f 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -66,6 +66,8 @@ modes.
where the map command applies. Disallow mapping of
{rhs}, to avoid nested and recursive mappings. Often
used to redefine a command.
+ Note: Keys in {rhs} also won't trigger abbreviation,
+ with the exception of |i_CTRL-]| and |c_CTRL-]|.
Note: When <Plug> appears in the {rhs} this part is
always applied even if remapping is disallowed.
diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim
index 9f25a42c38..b3179686b1 100644
--- a/test/old/testdir/test_cmdline.vim
+++ b/test/old/testdir/test_cmdline.vim
@@ -4070,7 +4070,7 @@ func Test_term_option()
let &cpo = _cpo
endfunc
-func Test_cd_bslsh_completion_windows()
+func Test_cd_bslash_completion_windows()
CheckMSWindows
let save_shellslash = &shellslash
set noshellslash
diff --git a/test/old/testdir/test_mapping.vim b/test/old/testdir/test_mapping.vim
index e4e446c55c..3b7ede2e08 100644
--- a/test/old/testdir/test_mapping.vim
+++ b/test/old/testdir/test_mapping.vim
@@ -6,33 +6,62 @@ source screendump.vim
source term_util.vim
func Test_abbreviation()
+ new
" abbreviation with 0x80 should work
inoreab чкпр vim
call feedkeys("Goчкпр \<Esc>", "xt")
call assert_equal('vim ', getline('$'))
iunab чкпр
- set nomodified
+ bwipe!
+endfunc
+
+func Test_abbreviation_with_noremap()
+ nnoremap <F2> :echo "cheese"
+ cabbr cheese xxx
+ call feedkeys(":echo \"cheese\"\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"echo "xxx"', @:)
+ call feedkeys("\<F2>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"echo "cheese"', @:)
+ nnoremap <F2> :echo "cheese<C-]>"
+ call feedkeys("\<F2>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"echo "xxx"', @:)
+ nunmap <F2>
+ cunabbr cheese
+
+ new
+ inoremap <buffer> ( <C-]>()
+ iabbr <buffer> fnu fun
+ call feedkeys("ifnu(", 'tx')
+ call assert_equal('fun()', getline(1))
+ bwipe!
endfunc
func Test_abclear()
- abbrev foo foobar
- iabbrev fooi foobari
- cabbrev fooc foobarc
- call assert_equal("\n\nc fooc foobarc\ni fooi foobari\n! foo foobar", execute('abbrev'))
-
- iabclear
- call assert_equal("\n\nc fooc foobarc\nc foo foobar", execute('abbrev'))
- abbrev foo foobar
- iabbrev fooi foobari
-
- cabclear
- call assert_equal("\n\ni fooi foobari\ni foo foobar", execute('abbrev'))
- abbrev foo foobar
- cabbrev fooc foobarc
-
- abclear
- call assert_equal("\n\nNo abbreviation found", execute('abbrev'))
- call assert_fails('%abclear', 'E481:')
+ abbrev foo foobar
+ iabbrev fooi foobari
+ cabbrev fooc foobarc
+ call assert_equal("\n\n"
+ \ .. "c fooc foobarc\n"
+ \ .. "i fooi foobari\n"
+ \ .. "! foo foobar", execute('abbrev'))
+
+ iabclear
+ call assert_equal("\n\n"
+ \ .. "c fooc foobarc\n"
+ \ .. "c foo foobar", execute('abbrev'))
+ abbrev foo foobar
+ iabbrev fooi foobari
+
+ cabclear
+ call assert_equal("\n\n"
+ \ .. "i fooi foobari\n"
+ \ .. "i foo foobar", execute('abbrev'))
+ abbrev foo foobar
+ cabbrev fooc foobarc
+
+ abclear
+ call assert_equal("\n\nNo abbreviation found", execute('abbrev'))
+ call assert_fails('%abclear', 'E481:')
endfunc
func Test_abclear_buffer()
@@ -42,15 +71,21 @@ func Test_abclear_buffer()
new X2
abbrev <buffer> foo2 foobar2
- call assert_equal("\n\n! foo2 @foobar2\n! foo foobar", execute('abbrev'))
+ call assert_equal("\n\n"
+ \ .. "! foo2 @foobar2\n"
+ \ .. "! foo foobar", execute('abbrev'))
abclear <buffer>
- call assert_equal("\n\n! foo foobar", execute('abbrev'))
+ call assert_equal("\n\n"
+ \ .. "! foo foobar", execute('abbrev'))
b X1
- call assert_equal("\n\n! foo1 @foobar1\n! foo foobar", execute('abbrev'))
+ call assert_equal("\n\n"
+ \ .. "! foo1 @foobar1\n"
+ \ .. "! foo foobar", execute('abbrev'))
abclear <buffer>
- call assert_equal("\n\n! foo foobar", execute('abbrev'))
+ call assert_equal("\n\n"
+ \ .. "! foo foobar", execute('abbrev'))
abclear
call assert_equal("\n\nNo abbreviation found", execute('abbrev'))
diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim
index 753875963b..b4f8b2626a 100644
--- a/test/old/testdir/test_quickfix.vim
+++ b/test/old/testdir/test_quickfix.vim
@@ -6459,8 +6459,8 @@ func Test_cbuffer_range()
call XbufferTests_range('l')
endfunc
-" Test for displaying fname pass from setqflist when the name
-" are hard links to prevent seemly duplicate entries.
+" Test for displaying fname passed from setqflist() when the names include
+" hard links to prevent seemingly duplicate entries.
func Xtest_hardlink_fname(cchar)
call s:setup_commands(a:cchar)
%bwipe