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.vim34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index f63ecfc71..2f82b8dd3 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -193,21 +193,21 @@ def Test_wrong_type()
enddef
def Test_const()
- CheckDefFailure(['const var = 234', 'var = 99'], 'E1018:')
- CheckDefFailure(['const one = 234', 'let one = 99'], 'E1017:')
- CheckDefFailure(['const list = [1, 2]', 'let list = [3, 4]'], 'E1017:')
- CheckDefFailure(['const two'], 'E1021:')
- CheckDefFailure(['const &option'], 'E996:')
+ CheckDefFailure(['final var = 234', 'var = 99'], 'E1018:')
+ CheckDefFailure(['final one = 234', 'let one = 99'], 'E1017:')
+ CheckDefFailure(['final list = [1, 2]', 'let list = [3, 4]'], 'E1017:')
+ CheckDefFailure(['final two'], 'E1125:')
+ CheckDefFailure(['final &option'], 'E996:')
let lines =<< trim END
- const list = [1, 2, 3]
+ final list = [1, 2, 3]
list[0] = 4
list->assert_equal([4, 2, 3])
- const! other = [5, 6, 7]
+ const other = [5, 6, 7]
other->assert_equal([5, 6, 7])
let varlist = [7, 8]
- const! constlist = [1, varlist, 3]
+ const constlist = [1, varlist, 3]
varlist[0] = 77
# TODO: does not work yet
# constlist[1][1] = 88
@@ -216,7 +216,7 @@ def Test_const()
constlist->assert_equal([1, [77, 88], 3])
let vardict = #{five: 5, six: 6}
- const! constdict = #{one: 1, two: vardict, three: 3}
+ const constdict = #{one: 1, two: vardict, three: 3}
vardict['five'] = 55
# TODO: does not work yet
# constdict['two']['six'] = 66
@@ -229,35 +229,35 @@ enddef
def Test_const_bang()
let lines =<< trim END
- const! var = 234
+ const var = 234
var = 99
END
CheckDefExecFailure(lines, 'E1018:', 2)
CheckScriptFailure(['vim9script'] + lines, 'E46:', 3)
lines =<< trim END
- const! ll = [2, 3, 4]
+ const ll = [2, 3, 4]
ll[0] = 99
END
CheckDefExecFailure(lines, 'E1119:', 2)
CheckScriptFailure(['vim9script'] + lines, 'E741:', 3)
lines =<< trim END
- const! ll = [2, 3, 4]
+ const ll = [2, 3, 4]
ll[3] = 99
END
CheckDefExecFailure(lines, 'E1118:', 2)
CheckScriptFailure(['vim9script'] + lines, 'E684:', 3)
lines =<< trim END
- const! dd = #{one: 1, two: 2}
+ const dd = #{one: 1, two: 2}
dd["one"] = 99
END
CheckDefExecFailure(lines, 'E1121:', 2)
CheckScriptFailure(['vim9script'] + lines, 'E741:', 3)
lines =<< trim END
- const! dd = #{one: 1, two: 2}
+ const dd = #{one: 1, two: 2}
dd["three"] = 99
END
CheckDefExecFailure(lines, 'E1120:')
@@ -2532,6 +2532,12 @@ enddef
def Test_let_declaration_fails()
let lines =<< trim END
vim9script
+ final var: string
+ END
+ CheckScriptFailure(lines, 'E1125:')
+
+ lines =<< trim END
+ vim9script
const var: string
END
CheckScriptFailure(lines, 'E1021:')