From 3a7503c34c65ed15cc08deb5b54aaf2ea51525b4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 7 Jun 2021 18:29:17 +0200 Subject: patch 8.2.2957: using getchar() in Vim9 script is problematic Problem: Using getchar() in Vim9 script is problematic. Solution: Add getcharstr(). (closes #8343) --- src/testdir/test_functions.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/testdir/test_functions.vim') diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 023da66ba..130955439 100644 --- 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) -- cgit v1.2.1