0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces

Problem:    Vim9: cannot use the g:, b:, t: and w: namespaces.
Solution:   Add instructions to push a dict for the namespaces. (closes #6480)
This commit is contained in:
Bram Moolenaar
2020-07-19 19:47:35 +02:00
parent 747f11ad6e
commit 2f8ce0ae8a
6 changed files with 147 additions and 40 deletions

View File

@@ -1345,6 +1345,32 @@ def Test_expr7_register()
assert_equal('register a', @a)
enddef
def Test_expr7_namespace()
g:some_var = 'some'
assert_equal('some', get(g:, 'some_var'))
assert_equal('some', get(g:, 'some_var', 'xxx'))
assert_equal('xxx', get(g:, 'no_var', 'xxx'))
unlet g:some_var
b:some_var = 'some'
assert_equal('some', get(b:, 'some_var'))
assert_equal('some', get(b:, 'some_var', 'xxx'))
assert_equal('xxx', get(b:, 'no_var', 'xxx'))
unlet b:some_var
w:some_var = 'some'
assert_equal('some', get(w:, 'some_var'))
assert_equal('some', get(w:, 'some_var', 'xxx'))
assert_equal('xxx', get(w:, 'no_var', 'xxx'))
unlet w:some_var
t:some_var = 'some'
assert_equal('some', get(t:, 'some_var'))
assert_equal('some', get(t:, 'some_var', 'xxx'))
assert_equal('xxx', get(t:, 'no_var', 'xxx'))
unlet t:some_var
enddef
def Test_expr7_parens()
# (expr)
assert_equal(4, (6 * 4) / 6)