aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir/test_mapping.vim
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:15:05 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:27:38 +0000
commitc5d770d311841ea5230426cc4c868e8db27300a8 (patch)
treedd21f70127b4b8b5f109baefc8ecc5016f507c91 /test/old/testdir/test_mapping.vim
parent9be89f131f87608f224f0ee06d199fcd09d32176 (diff)
parent081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff)
downloadrneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/old/testdir/test_mapping.vim')
-rw-r--r--test/old/testdir/test_mapping.vim77
1 files changed, 56 insertions, 21 deletions
diff --git a/test/old/testdir/test_mapping.vim b/test/old/testdir/test_mapping.vim
index e4e446c55c..96fa0304dc 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'))
+ 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\nc fooc foobarc\nc foo foobar", execute('abbrev'))
- abbrev foo foobar
- iabbrev fooi foobari
+ 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\ni fooi foobari\ni foo foobar", execute('abbrev'))
- abbrev foo foobar
- cabbrev fooc foobarc
+ 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:')
+ abclear
+ call assert_equal("\n\nNo abbreviation found", execute('abbrev'))
+ call assert_fails('%abclear', 'E481:')
endfunc
func Test_abclear_buffer()
@@ -42,18 +71,24 @@ 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'))
+ call assert_equal("\n\nNo abbreviation found", execute('abbrev'))
%bwipe
endfunc