forked from aniani/vim
patch 9.1.0765: No test for patches 6.2.418 and 7.3.489
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: #15815 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
4f51f3a573
commit
5df3cb2898
@@ -7,40 +7,62 @@ source term_util.vim
|
||||
import './vim9.vim' as v9
|
||||
|
||||
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\n"
|
||||
\ .. "c fooc foobarc\n"
|
||||
\ .. "i 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\n"
|
||||
\ .. "c fooc foobarc\n"
|
||||
\ .. "c 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\n"
|
||||
\ .. "i fooi foobari\n"
|
||||
\ .. "i 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()
|
||||
@@ -161,7 +183,7 @@ func Test_map_langmap()
|
||||
imap a c
|
||||
call feedkeys("Go\<C-R>a\<Esc>", "xt")
|
||||
call assert_equal('bbbb', getline('$'))
|
||||
|
||||
|
||||
" langmap should not apply in Command-line mode
|
||||
set langmap=+{ nolangremap
|
||||
call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
|
||||
|
Reference in New Issue
Block a user