summaryrefslogtreecommitdiff
path: root/src/testdir/test_functions.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-07 18:29:17 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-07 18:29:17 +0200
commit3a7503c34c65ed15cc08deb5b54aaf2ea51525b4 (patch)
treedaa9ac7e436c54459ab4971578929dc0b30779be /src/testdir/test_functions.vim
parentf05d2fc539c389c3b8142d9fb06fb0443de14902 (diff)
downloadvim-git-3a7503c34c65ed15cc08deb5b54aaf2ea51525b4.tar.gz
patch 8.2.2957: using getchar() in Vim9 script is problematicv8.2.2957
Problem: Using getchar() in Vim9 script is problematic. Solution: Add getcharstr(). (closes #8343)
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r--src/testdir/test_functions.vim7
1 files changed, 7 insertions, 0 deletions
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)