2014-12-08 18:31:45 -07:00
|
|
|
local helpers = require('test.functional.helpers')
|
|
|
|
local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim
|
|
|
|
local feed, next_message, eq = helpers.feed, helpers.next_message, helpers.eq
|
2015-02-18 09:16:30 -07:00
|
|
|
local expect = helpers.expect
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
describe('mappings', function()
|
|
|
|
local cid
|
|
|
|
|
|
|
|
local add_mapping = function(mapping, send)
|
|
|
|
local str = 'mapped '..mapping
|
|
|
|
local cmd = "nnoremap "..mapping.." :call rpcnotify("..cid..", 'mapped', '"
|
|
|
|
..send:gsub('<', '<lt>').."')<cr>"
|
|
|
|
execute(cmd)
|
|
|
|
end
|
|
|
|
|
|
|
|
local check_mapping = function(mapping, expected)
|
|
|
|
feed(mapping)
|
|
|
|
eq({'notification', 'mapped', {expected}}, next_message())
|
|
|
|
end
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
cid = nvim('get_api_info')[1]
|
|
|
|
add_mapping('<s-up>', '<s-up>')
|
|
|
|
add_mapping('<s-up>', '<s-up>')
|
|
|
|
add_mapping('<c-s-up>', '<c-s-up>')
|
|
|
|
add_mapping('<c-s-a-up>', '<c-s-a-up>')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('ok', function()
|
|
|
|
check_mapping('<s-up>', '<s-up>')
|
|
|
|
check_mapping('<c-s-up>', '<c-s-up>')
|
|
|
|
check_mapping('<s-c-up>', '<c-s-up>')
|
|
|
|
check_mapping('<c-s-a-up>', '<c-s-a-up>')
|
|
|
|
check_mapping('<s-c-a-up>', '<c-s-a-up>')
|
|
|
|
check_mapping('<c-a-s-up>', '<c-s-a-up>')
|
|
|
|
check_mapping('<s-a-c-up>', '<c-s-a-up>')
|
|
|
|
check_mapping('<a-c-s-up>', '<c-s-a-up>')
|
|
|
|
check_mapping('<a-s-c-up>', '<c-s-a-up>')
|
|
|
|
end)
|
|
|
|
end)
|
2015-02-18 09:16:30 -07:00
|
|
|
|
|
|
|
describe('input utf sequences that contain CSI/K_SPECIAL', function()
|
|
|
|
it('ok', function()
|
|
|
|
feed('i…<esc>')
|
|
|
|
expect('…')
|
|
|
|
end)
|
|
|
|
end)
|