summaryrefslogtreecommitdiff
path: root/src/testdir/test_vim9_script.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-29 19:18:00 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-29 19:18:00 +0200
commit33afa2447bdb0bdd15253c69a2cf6f9903685815 (patch)
treece6c8c150686419faa6fb762f8ae22a2054a6d7b /src/testdir/test_vim9_script.vim
parentac7bf8c4bfcbb157a2db6b939927bf11edb6ba7b (diff)
downloadvim-git-33afa2447bdb0bdd15253c69a2cf6f9903685815.tar.gz
patch 8.2.1320: Vim9: cannot declare some single letter variablesv8.2.1320
Problem: Vim9: cannot declare some single letter variables. Solution: Do not recognize a colon for a namespace for single letter variables. (closes #6547)
Diffstat (limited to 'src/testdir/test_vim9_script.vim')
-rw-r--r--src/testdir/test_vim9_script.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index b491fa21a..0166072f1 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -109,6 +109,9 @@ def Test_assignment()
call CheckDefFailure(['&ts = 3', 'let asdf'], 'E1022:')
&ts = 8
+ call CheckDefFailure(['let s:var = 123'], 'E1101:')
+ call CheckDefFailure(['let s:var: number'], 'E1101:')
+
g:inc_counter += 1
assert_equal(2, g:inc_counter)
@@ -136,6 +139,28 @@ def Test_assignment()
assert_equal('noneagain', v:errmsg)
call CheckDefFailure(['v:errmsg += "more"'], 'E1013:')
call CheckDefFailure(['v:errmsg += 123'], 'E1013:')
+
+ # single letter variables
+ a = 123
+ assert_equal(123, a)
+ let b: number
+ b = 123
+ assert_equal(123, b)
+ let g: number
+ g = 123
+ assert_equal(123, g)
+ let s: number
+ s = 123
+ assert_equal(123, s)
+ let t: number
+ t = 123
+ assert_equal(123, t)
+ let v: number
+ v = 123
+ assert_equal(123, v)
+ let w: number
+ w = 123
+ assert_equal(123, w)
enddef
def Test_vim9_single_char_vars()