comparison src/testdir/test_maparg.vim @ 21695:f27187782dc6 v8.2.1397

patch 8.2.1397: Vim9: return type of maparg() not adjusted for fourth arg Commit: https://github.com/vim/vim/commit/4a6d1b660fcea67931202527ad2852da55d26d49 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 8 17:55:49 2020 +0200 patch 8.2.1397: Vim9: return type of maparg() not adjusted for fourth arg Problem: Vim9: return type of maparg() not adjusted for fourth argument. Solution: Check if fourth argument is present. (closes https://github.com/vim/vim/issues/6645)
author Bram Moolenaar <Bram@vim.org>
date Sat, 08 Aug 2020 18:00:04 +0200
parents 729853a754ea
children d55008685870
comparison
equal deleted inserted replaced
21694:48d2a443fb3d 21695:f27187782dc6
79 let d = maparg('esc', 'i', 1, 1) 79 let d = maparg('esc', 'i', 1, 1)
80 call assert_equal(['esc', "\<C-V>\<C-V>\<Esc>", '!'], [d.lhs, d.rhs, d.mode]) 80 call assert_equal(['esc', "\<C-V>\<C-V>\<Esc>", '!'], [d.lhs, d.rhs, d.mode])
81 abclear 81 abclear
82 endfunc 82 endfunc
83 83
84 def Test_vim9_maparg()
85 nmap { w
86 let one: string = maparg('{')
87 assert_equal('w', one)
88 let two: string = maparg('{', 'n')
89 assert_equal('w', two)
90 let three: string = maparg('{', 'n', 0)
91 assert_equal('w', three)
92 let four: dict<any> = maparg('{', 'n', 0, 1)
93 call assert_equal(['{', 'w', 'n'], [four.lhs, four.rhs, four.mode])
94 nunmap {
95 enddef
96
84 func Test_mapcheck() 97 func Test_mapcheck()
85 call assert_equal('', mapcheck('a')) 98 call assert_equal('', mapcheck('a'))
86 call assert_equal('', mapcheck('abc')) 99 call assert_equal('', mapcheck('abc'))
87 call assert_equal('', mapcheck('ax')) 100 call assert_equal('', mapcheck('ax'))
88 call assert_equal('', mapcheck('b')) 101 call assert_equal('', mapcheck('b'))