summaryrefslogtreecommitdiff
path: root/src/testdir/test_vim9_script.vim
diff options
context:
space:
mode:
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 379245f39..427e91238 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -61,6 +61,14 @@ def Test_assignment()
assert_equal('foobar', $ENVVAR)
$ENVVAR = ''
+ let lines =<< trim END
+ vim9script
+ $ENVVAR = 'barfoo'
+ assert_equal('barfoo', $ENVVAR)
+ $ENVVAR = ''
+ END
+ call CheckScriptSuccess(lines)
+
s:appendToMe ..= 'yyy'
assert_equal('xxxyyy', s:appendToMe)
s:addToMe += 222
@@ -80,6 +88,15 @@ def Test_assignment()
set ts=10
&ts %= 4
assert_equal(2, &ts)
+
+ lines =<< trim END
+ vim9script
+ &ts = 6
+ &ts += 3
+ assert_equal(9, &ts)
+ END
+ call CheckScriptSuccess(lines)
+
call CheckDefFailure(['&notex += 3'], 'E113:')
call CheckDefFailure(['&ts ..= "xxx"'], 'E1019:')
call CheckDefFailure(['&ts = [7]'], 'E1013:')
@@ -106,6 +123,14 @@ def Test_assignment()
call CheckDefFailure(['@a += "more"'], 'E1013:')
call CheckDefFailure(['@a += 123'], 'E1013:')
+ lines =<< trim END
+ vim9script
+ @c = 'areg'
+ @c ..= 'add'
+ assert_equal('aregadd', @c)
+ END
+ call CheckScriptSuccess(lines)
+
v:errmsg = 'none'
v:errmsg ..= 'again'
assert_equal('noneagain', v:errmsg)