patch 8.2.1011: Vim9: some code not tested
Problem: Vim9: some code not tested.
Solution: Add a few more test cases. Reorder checks for clearer error.
Remove unreachable code.
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index e0776b5..224f4fd 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -524,6 +524,7 @@
g:anint)
assert_equal(9, g:alsoint + 5)
assert_equal(14, g:alsoint + g:anint)
+ assert_equal([1, 2, 3, 4], [1] + g:alist)
assert_equal(54, 60 - 6)
assert_equal(50, 60 -
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 25fed4a..3cfacbb 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -140,6 +140,9 @@
let dict4: dict<any> = #{one: 1, two: '2'}
let dict5: dict<blob> = #{one: 0z01, two: 0z02}
+ " overwrite
+ dict3['key'] = 'another'
+
call CheckDefExecFailure(['let dd = {}', 'dd[""] = 6'], 'E713:')
# type becomes dict<any>
@@ -219,6 +222,13 @@
let thechannel: channel
assert_equal(test_null_channel(), thechannel)
+
+ if has('unix') && executable('cat')
+ " check with non-null job and channel, types must match
+ thejob = job_start("cat ", #{})
+ thechannel = job_getchannel(thejob)
+ job_stop(thejob, 'kill')
+ endif
endif
let nr = 1234 | nr = 5678
@@ -775,6 +785,9 @@
CheckScriptFailure(['vim9script', 'export let g:some'], 'E1044:')
CheckScriptFailure(['vim9script', 'export echo 134'], 'E1043:')
+ CheckScriptFailure(['vim9script', 'let str: string', 'str = 1234'], 'E1013:')
+ CheckScriptFailure(['vim9script', 'const str = "asdf"', 'str = "xxx"'], 'E46:')
+
assert_fails('vim9script', 'E1038')
assert_fails('export something', 'E1043')
enddef