diff options
author | ckelsel <ckelsel@hotmail.com> | 2017-07-10 08:10:15 +0800 |
---|---|---|
committer | ckelsel <ckelsel@hotmail.com> | 2017-07-10 08:10:15 +0800 |
commit | 465bbee520d1b1b57477fd7d80fbdeaf5e1e1e77 (patch) | |
tree | edae38568202ba41dee4a49f78884da313fd114b /test/functional/eval/map_functions_spec.lua | |
parent | 1514cdc7d8863eeee6b04883b1c50aac40048b49 (diff) | |
parent | 6725667d31591e8025589c4c1df34469f3bfdb52 (diff) | |
download | rneovim-465bbee520d1b1b57477fd7d80fbdeaf5e1e1e77.tar.gz rneovim-465bbee520d1b1b57477fd7d80fbdeaf5e1e1e77.tar.bz2 rneovim-465bbee520d1b1b57477fd7d80fbdeaf5e1e1e77.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'test/functional/eval/map_functions_spec.lua')
-rw-r--r-- | test/functional/eval/map_functions_spec.lua | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/test/functional/eval/map_functions_spec.lua b/test/functional/eval/map_functions_spec.lua index a260522aa3..e914f674aa 100644 --- a/test/functional/eval/map_functions_spec.lua +++ b/test/functional/eval/map_functions_spec.lua @@ -1,11 +1,12 @@ - local helpers = require('test.functional.helpers')(after_each) + local clear = helpers.clear local eq = helpers.eq local eval = helpers.eval local funcs = helpers.funcs local nvim = helpers.nvim local source = helpers.source +local command = helpers.command describe('maparg()', function() before_each(clear) @@ -117,4 +118,42 @@ describe('maparg()', function() eq(1, map_dict['expr']) eq('i', map_dict['mode']) end) + + it('works with combining characters', function() + -- Using addacutes to make combining character better visible + local function ac(s) + local acute = '\204\129' -- U+0301 COMBINING ACUTE ACCENT + local ret = s:gsub('`', acute) + return ret + end + command(ac([[ + nnoremap a b` + nnoremap c` d + nnoremap e` f` + ]])) + eq(ac('b`'), funcs.maparg(ac('a'))) + eq(ac(''), funcs.maparg(ac('c'))) + eq(ac('d'), funcs.maparg(ac('c`'))) + eq(ac('f`'), funcs.maparg(ac('e`'))) + + local function acmap(lhs, rhs) + return { + lhs = ac(lhs), + rhs = ac(rhs), + + buffer = 0, + expr = 0, + mode = 'n', + noremap = 1, + nowait = 0, + sid = 0, + silent = 0, + } + end + + eq({}, funcs.maparg(ac('c'), 'n', 0, 1)) + eq(acmap('a', 'b`'), funcs.maparg(ac('a'), 'n', 0, 1)) + eq(acmap('c`', 'd'), funcs.maparg(ac('c`'), 'n', 0, 1)) + eq(acmap('e`', 'f`'), funcs.maparg(ac('e`'), 'n', 0, 1)) + end) end) |