diff src/testdir/test_functions.vim @ 24838:3f9053c21765 v8.2.2957

patch 8.2.2957: using getchar() in Vim9 script is problematic Commit: https://github.com/vim/vim/commit/3a7503c34c65ed15cc08deb5b54aaf2ea51525b4 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 7 18:29:17 2021 +0200 patch 8.2.2957: using getchar() in Vim9 script is problematic Problem: Using getchar() in Vim9 script is problematic. Solution: Add getcharstr(). (closes https://github.com/vim/vim/issues/8343)
author Bram Moolenaar <Bram@vim.org>
date Mon, 07 Jun 2021 18:30:04 +0200
parents 5f8dd7b3ae41
children f67773e26cfa
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1729,6 +1729,13 @@ endfunc
 func Test_getchar()
   call feedkeys('a', '')
   call assert_equal(char2nr('a'), getchar())
+  call assert_equal(0, getchar(0))
+  call assert_equal(0, getchar(1))
+
+  call feedkeys('a', '')
+  call assert_equal('a', getcharstr())
+  call assert_equal('', getcharstr(0))
+  call assert_equal('', getcharstr(1))
 
   call setline(1, 'xxxx')
   call test_setmouse(1, 3)