Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 21399:5cb6e676defd v8.2.1250
patch 8.2.1250: Vim9: cannot use the g:, b:, t: and w: namespaces
Commit: https://github.com/vim/vim/commit/2f8ce0ae8a8247563be0a77a308130e767e0566e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 19 19:47:35 2020 +0200
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 https://github.com/vim/vim/issues/6480)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 19 Jul 2020 20:00:04 +0200 |
parents | 320581a133d9 |
children | e1aeb986712f |
comparison
equal
deleted
inserted
replaced
21398:5f89f2a27c66 | 21399:5cb6e676defd |
---|---|
1343 def Test_expr7_register() | 1343 def Test_expr7_register() |
1344 @a = 'register a' | 1344 @a = 'register a' |
1345 assert_equal('register a', @a) | 1345 assert_equal('register a', @a) |
1346 enddef | 1346 enddef |
1347 | 1347 |
1348 def Test_expr7_namespace() | |
1349 g:some_var = 'some' | |
1350 assert_equal('some', get(g:, 'some_var')) | |
1351 assert_equal('some', get(g:, 'some_var', 'xxx')) | |
1352 assert_equal('xxx', get(g:, 'no_var', 'xxx')) | |
1353 unlet g:some_var | |
1354 | |
1355 b:some_var = 'some' | |
1356 assert_equal('some', get(b:, 'some_var')) | |
1357 assert_equal('some', get(b:, 'some_var', 'xxx')) | |
1358 assert_equal('xxx', get(b:, 'no_var', 'xxx')) | |
1359 unlet b:some_var | |
1360 | |
1361 w:some_var = 'some' | |
1362 assert_equal('some', get(w:, 'some_var')) | |
1363 assert_equal('some', get(w:, 'some_var', 'xxx')) | |
1364 assert_equal('xxx', get(w:, 'no_var', 'xxx')) | |
1365 unlet w:some_var | |
1366 | |
1367 t:some_var = 'some' | |
1368 assert_equal('some', get(t:, 'some_var')) | |
1369 assert_equal('some', get(t:, 'some_var', 'xxx')) | |
1370 assert_equal('xxx', get(t:, 'no_var', 'xxx')) | |
1371 unlet t:some_var | |
1372 enddef | |
1373 | |
1348 def Test_expr7_parens() | 1374 def Test_expr7_parens() |
1349 # (expr) | 1375 # (expr) |
1350 assert_equal(4, (6 * 4) / 6) | 1376 assert_equal(4, (6 * 4) / 6) |
1351 assert_equal(0, 6 * ( 4 / 6 )) | 1377 assert_equal(0, 6 * ( 4 / 6 )) |
1352 | 1378 |