diff src/testdir/test_termcodes.vim @ 20313:244eb8d8d100 v8.2.0712

patch 8.2.0712: various code not fully tested Commit: https://github.com/vim/vim/commit/0ff5dedf0f69e56320199db7a2aad46be2a1f9b7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 7 18:43:44 2020 +0200 patch 8.2.0712: various code not fully tested Problem: Various code not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6049)
author Bram Moolenaar <Bram@vim.org>
date Thu, 07 May 2020 18:45:04 +0200
parents 0927df746554
children 5ffe112b1afd
line wrap: on
line diff
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -1371,4 +1371,30 @@ func Test_cmdline_literal()
   set timeoutlen&
 endfunc
 
+" Test for translation of special key codes (<xF1>, <xF2>, etc.)
+func Test_Keycode_Tranlsation()
+  let keycodes = [
+        \ ["<xUp>", "<Up>"],
+        \ ["<xDown>", "<Down>"],
+        \ ["<xLeft>", "<Left>"],
+        \ ["<xRight>", "<Right>"],
+        \ ["<xHome>", "<Home>"],
+        \ ["<xEnd>", "<End>"],
+        \ ["<zHome>", "<Home>"],
+        \ ["<zEnd>", "<End>"],
+        \ ["<xF1>", "<F1>"],
+        \ ["<xF2>", "<F2>"],
+        \ ["<xF3>", "<F3>"],
+        \ ["<xF4>", "<F4>"],
+        \ ["<S-xF1>", "<S-F1>"],
+        \ ["<S-xF2>", "<S-F2>"],
+        \ ["<S-xF3>", "<S-F3>"],
+        \ ["<S-xF4>", "<S-F4>"]]
+  for [k1, k2] in keycodes
+    exe "nnoremap " .. k1 .. " 2wx"
+    call assert_true(maparg(k1, 'n', 0, 1).lhs == k2)
+    exe "nunmap " .. k1
+  endfor
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab