0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.2071: Vim9: list assign doesn't except empty remainder list

Problem:    Vim9: list assign doesn't except empty remainder list.
Solution:   Recognize list assignment with ";".
This commit is contained in:
Bram Moolenaar
2020-11-30 21:12:19 +01:00
parent f0068c5154
commit da7c20c953
3 changed files with 33 additions and 21 deletions

View File

@@ -632,30 +632,33 @@ def Test_assignment_default()
enddef
def Test_assignment_var_list()
var v1: string
var v2: string
var vrem: list<string>
[v1] = ['aaa']
assert_equal('aaa', v1)
var lines =<< trim END
var v1: string
var v2: string
var vrem: list<string>
[v1] = ['aaa']
assert_equal('aaa', v1)
[v1, v2] = ['one', 'two']
assert_equal('one', v1)
assert_equal('two', v2)
[v1, v2] = ['one', 'two']
assert_equal('one', v1)
assert_equal('two', v2)
[v1, v2; vrem] = ['one', 'two']
assert_equal('one', v1)
assert_equal('two', v2)
assert_equal([], vrem)
[v1, v2; vrem] = ['one', 'two']
assert_equal('one', v1)
assert_equal('two', v2)
assert_equal([], vrem)
[v1, v2; vrem] = ['one', 'two', 'three']
assert_equal('one', v1)
assert_equal('two', v2)
assert_equal(['three'], vrem)
[v1, v2; vrem] = ['one', 'two', 'three']
assert_equal('one', v1)
assert_equal('two', v2)
assert_equal(['three'], vrem)
[&ts, &sw] = [3, 4]
assert_equal(3, &ts)
assert_equal(4, &sw)
set ts=8 sw=4
[&ts, &sw] = [3, 4]
assert_equal(3, &ts)
assert_equal(4, &sw)
set ts=8 sw=4
END
CheckDefAndScriptSuccess(lines)
enddef
def Test_assignment_vim9script()