Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
17108:1bf755ebbd7a | 17109:cc5d4b4bae83 |
---|---|
18 const n = v:null | 18 const n = v:null |
19 const bl = 0zC0FFEE | 19 const bl = 0zC0FFEE |
20 const here =<< trim EOS | 20 const here =<< trim EOS |
21 hello | 21 hello |
22 EOS | 22 EOS |
23 | |
24 call assert_true(exists('i')) | |
25 call assert_true(exists('f')) | |
26 call assert_true(exists('s')) | |
27 call assert_true(exists('F')) | |
28 call assert_true(exists('l')) | |
29 call assert_true(exists('d')) | |
30 if has('channel') | |
31 call assert_true(exists('j')) | |
32 call assert_true(exists('c')) | |
33 endif | |
34 call assert_true(exists('b')) | |
35 call assert_true(exists('n')) | |
36 call assert_true(exists('bl')) | |
37 call assert_true(exists('here')) | |
23 | 38 |
24 call assert_fails('let i = 1', 'E741:') | 39 call assert_fails('let i = 1', 'E741:') |
25 call assert_fails('let f = 1.1', 'E741:') | 40 call assert_fails('let f = 1.1', 'E741:') |
26 call assert_fails('let s = "vim"', 'E741:') | 41 call assert_fails('let s = "vim"', 'E741:') |
27 call assert_fails('let F = funcref("s:noop")', 'E741:') | 42 call assert_fails('let F = funcref("s:noop")', 'E741:') |
216 call assert_fails('const &filetype = "vim"', 'E996:') | 231 call assert_fails('const &filetype = "vim"', 'E996:') |
217 call assert_fails('const &l:filetype = "vim"', 'E996:') | 232 call assert_fails('const &l:filetype = "vim"', 'E996:') |
218 call assert_fails('const &g:encoding = "utf-8"', 'E996:') | 233 call assert_fails('const &g:encoding = "utf-8"', 'E996:') |
219 endfunc | 234 endfunc |
220 | 235 |
236 func Test_const_with_eval_name() | |
237 let s = 'foo' | |
238 | |
239 " eval name with :const should work | |
240 const abc_{s} = 1 | |
241 const {s}{s} = 1 | |
242 | |
243 let s2 = 'abc_foo' | |
244 call assert_fails('const {s2} = "bar"', 'E995:') | |
245 endfunc | |
246 | |
221 func Test_lock_depth_is_1() | 247 func Test_lock_depth_is_1() |
222 const l = [1, 2, 3] | 248 const l = [1, 2, 3] |
223 const d = {'foo': 10} | 249 const d = {'foo': 10} |
224 | 250 |
225 " Modify list | 251 " Modify list |