Mercurial > vim
diff src/testdir/test_const.vim @ 17109:cc5d4b4bae83 v8.1.1554
patch 8.1.1554: docs and tests for :const can be improved
commit https://github.com/vim/vim/commit/1c196e7b1742c1a50ce0d74190721acaad087f81
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 16 15:41:58 2019 +0200
patch 8.1.1554: docs and tests for :const can be improved
Problem: Docs and tests for :const can be improved.
Solution: Improve documentation, add a few more tests. (Ryuichi Hayashida,
closes #4551)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 16 Jun 2019 15:45:06 +0200 |
parents | bc730bb54a7c |
children | 6990c1160ea5 |
line wrap: on
line diff
--- a/src/testdir/test_const.vim +++ b/src/testdir/test_const.vim @@ -21,6 +21,21 @@ func Test_define_var_with_lock() hello EOS + call assert_true(exists('i')) + call assert_true(exists('f')) + call assert_true(exists('s')) + call assert_true(exists('F')) + call assert_true(exists('l')) + call assert_true(exists('d')) + if has('channel') + call assert_true(exists('j')) + call assert_true(exists('c')) + endif + call assert_true(exists('b')) + call assert_true(exists('n')) + call assert_true(exists('bl')) + call assert_true(exists('here')) + call assert_fails('let i = 1', 'E741:') call assert_fails('let f = 1.1', 'E741:') call assert_fails('let s = "vim"', 'E741:') @@ -218,6 +233,17 @@ func Test_const_with_special_variables() call assert_fails('const &g:encoding = "utf-8"', 'E996:') endfunc +func Test_const_with_eval_name() + let s = 'foo' + + " eval name with :const should work + const abc_{s} = 1 + const {s}{s} = 1 + + let s2 = 'abc_foo' + call assert_fails('const {s2} = "bar"', 'E995:') +endfunc + func Test_lock_depth_is_1() const l = [1, 2, 3] const d = {'foo': 10}