1
0
forked from aniani/vim

patch 8.2.0148: mapping related function in wrong source file

Problem:    Mapping related function in wrong source file.
Solution:   Move the function.  Add a few more test cases. (Yegappan
            Lakshmanan, closes #5528)
This commit is contained in:
Bram Moolenaar
2020-01-24 20:21:19 +01:00
parent 03c3bd9fd0
commit 7f51bbe0d1
5 changed files with 118 additions and 76 deletions

View File

@@ -476,6 +476,15 @@ func Test_list_mappings()
call assert_equal(['n ,n <Nop>'],
\ execute('nmap ,n')->trim()->split("\n"))
" verbose map
call assert_match("\tLast set from .*/test_mapping.vim line \\d\\+$",
\ execute('verbose map ,n')->trim()->split("\n")[1])
" map to CTRL-V
exe "nmap ,k \<C-V>"
call assert_equal(['n ,k <Nop>'],
\ execute('nmap ,k')->trim()->split("\n"))
nmapclear
endfunc
@@ -812,4 +821,36 @@ func Test_abbr_remove()
call assert_equal({}, maparg('foo', 'i', 1, 1))
endfunc
" Trigger an abbreviation using a special key
func Test_abbr_trigger_special()
new
iabbr teh the
call feedkeys("iteh\<F2>\<Esc>", 'xt')
call assert_equal('the<F2>', getline(1))
iunab teh
close!
endfunc
" Test for '<' in 'cpoptions'
func Test_map_cpo_special_keycode()
set cpo-=<
imap x<Bslash>k Test
let d = maparg('x<Bslash>k', 'i', 0, 1)
call assert_equal(['x\k', 'Test', 'i'], [d.lhs, d.rhs, d.mode])
call feedkeys(":imap x\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"imap x\k', @:)
iunmap x<Bslash>k
set cpo+=<
imap x<Bslash>k Test
let d = maparg('x<Bslash>k', 'i', 0, 1)
call assert_equal(['x<Bslash>k', 'Test', 'i'], [d.lhs, d.rhs, d.mode])
call feedkeys(":imap x\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"imap x<Bslash>k', @:)
iunmap x<Bslash>k
set cpo-=<
" Modifying 'cpo' above adds some default mappings, remove them
mapclear
mapclear!
endfunc
" vim: shiftwidth=2 sts=2 expandtab