Mercurial > vim
annotate src/testdir/test_let.vim @ 19689:da98d2ed8dc5 v8.2.0401
patch 8.2.0401: not enough test coverage for evalvars.c
Commit: https://github.com/vim/vim/commit/8dfcce3a78ccb520cc9d09081f998091494c50bf
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 18 19:32:26 2020 +0100
patch 8.2.0401: not enough test coverage for evalvars.c
Problem: Not enough test coverage for evalvars.c.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5804)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 18 Mar 2020 19:45:04 +0100 |
parents | baf890fa1621 |
children | b3e93a05c3ca |
rev | line source |
---|---|
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for the :let command. |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_let() |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " Test to not autoload when assigning. It causes internal error. |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 set runtimepath+=./sautest |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 let Test104#numvar = function('tr') |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call assert_equal("function('tr')", string(Test104#numvar)) |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 let a = 1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 let b = 2 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 let out = execute('let a b') |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 let s = "\na #1\nb #2" |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 call assert_equal(s, out) |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 let out = execute('let {0 == 1 ? "a" : "b"}') |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 let s = "\nb #2" |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal(s, out) |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 let out = execute('let {0 == 1 ? "a" : "b"} a') |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 let s = "\nb #2\na #1" |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal(s, out) |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 let out = execute('let a {0 == 1 ? "a" : "b"}') |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 let s = "\na #1\nb #2" |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call assert_equal(s, out) |
18713
baf890fa1621
patch 8.1.2348: :const cannot be followed by "| endif"
Bram Moolenaar <Bram@vim.org>
parents:
18540
diff
changeset
|
27 |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
28 " Test for displaying a string variable |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
29 let s = 'vim' |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
30 let out = execute('let s') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
31 let s = "\ns vim" |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
32 call assert_equal(s, out) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
33 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
34 " Test for displaying a list variable |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
35 let l = [1, 2] |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
36 let out = execute('let l') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
37 let s = "\nl [1, 2]" |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
38 call assert_equal(s, out) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
39 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
40 " Test for displaying a dict variable |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
41 let d = {'k' : 'v'} |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
42 let out = execute('let d') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
43 let s = "\nd {'k': 'v'}" |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
44 call assert_equal(s, out) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
45 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
46 " Test for displaying a function reference variable |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
47 let F = function('min') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
48 let out = execute('let F') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
49 let s = "\nF *min()" |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
50 call assert_equal(s, out) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
51 |
18713
baf890fa1621
patch 8.1.2348: :const cannot be followed by "| endif"
Bram Moolenaar <Bram@vim.org>
parents:
18540
diff
changeset
|
52 let x = 0 |
baf890fa1621
patch 8.1.2348: :const cannot be followed by "| endif"
Bram Moolenaar <Bram@vim.org>
parents:
18540
diff
changeset
|
53 if 0 | let x = 1 | endif |
baf890fa1621
patch 8.1.2348: :const cannot be followed by "| endif"
Bram Moolenaar <Bram@vim.org>
parents:
18540
diff
changeset
|
54 call assert_equal(0, x) |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
55 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
56 " Display a list item using an out of range index |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
57 let l = [10] |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
58 call assert_fails('let l[1]', 'E684:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
59 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
60 " List special variable dictionaries |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
61 let g:Test_Global_Var = 5 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
62 call assert_match("\nTest_Global_Var #5", execute('let g:')) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
63 unlet g:Test_Global_Var |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
64 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
65 let b:Test_Buf_Var = 8 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
66 call assert_match("\nb:Test_Buf_Var #8", execute('let b:')) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
67 unlet b:Test_Buf_Var |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
68 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
69 let w:Test_Win_Var = 'foo' |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
70 call assert_equal("\nw:Test_Win_Var foo", execute('let w:')) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
71 unlet w:Test_Win_Var |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
72 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
73 let t:Test_Tab_Var = 'bar' |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
74 call assert_equal("\nt:Test_Tab_Var bar", execute('let t:')) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
75 unlet t:Test_Tab_Var |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
76 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
77 let s:Test_Script_Var = [7] |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
78 call assert_match("\ns:Test_Script_Var \\[7]", execute('let s:')) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
79 unlet s:Test_Script_Var |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
80 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
81 let l:Test_Local_Var = {'k' : 5} |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
82 call assert_match("\nl:Test_Local_Var {'k': 5}", execute('let l:')) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
83 call assert_match("v:errors []", execute('let v:')) |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 endfunc |
15762
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
85 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
86 func s:set_arg1(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
87 let a:a = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
88 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
89 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
90 func s:set_arg2(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
91 let a:b = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
92 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
93 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
94 func s:set_arg3(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
95 let b = a: |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
96 let b['a'] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
97 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
98 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
99 func s:set_arg4(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
100 let b = a: |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
101 let b['a'] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
102 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
103 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
104 func s:set_arg5(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
105 let b = a: |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
106 let b['a'][0] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
107 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
108 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
109 func s:set_arg6(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
110 let a:a[0] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
111 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
112 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
113 func s:set_arg7(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
114 call extend(a:, {'a': 1}) |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
115 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
116 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
117 func s:set_arg8(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
118 call extend(a:, {'b': 1}) |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
119 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
120 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
121 func s:set_arg9(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
122 let a:['b'] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
123 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
124 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
125 func s:set_arg10(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
126 let b = a: |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
127 call extend(b, {'a': 1}) |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
128 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
129 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
130 func s:set_arg11(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
131 let b = a: |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
132 call extend(b, {'b': 1}) |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
133 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
134 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
135 func s:set_arg12(a) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
136 let b = a: |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
137 let b['b'] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
138 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
139 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
140 func Test_let_arg_fail() |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
141 call assert_fails('call s:set_arg1(1)', 'E46:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
142 call assert_fails('call s:set_arg2(1)', 'E461:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
143 call assert_fails('call s:set_arg3(1)', 'E46:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
144 call assert_fails('call s:set_arg4(1)', 'E46:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
145 call assert_fails('call s:set_arg5(1)', 'E46:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
146 call s:set_arg6([0]) |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
147 call assert_fails('call s:set_arg7(1)', 'E742:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
148 call assert_fails('call s:set_arg8(1)', 'E742:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
149 call assert_fails('call s:set_arg9(1)', 'E461:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
150 call assert_fails('call s:set_arg10(1)', 'E742:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
151 call assert_fails('call s:set_arg11(1)', 'E742:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
152 call assert_fails('call s:set_arg12(1)', 'E461:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
153 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
154 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
155 func s:set_varg1(...) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
156 let a:000 = [] |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
157 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
158 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
159 func s:set_varg2(...) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
160 let a:000[0] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
161 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
162 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
163 func s:set_varg3(...) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
164 let a:000 += [1] |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
165 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
166 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
167 func s:set_varg4(...) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
168 call add(a:000, 1) |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
169 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
170 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
171 func s:set_varg5(...) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
172 let a:000[0][0] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
173 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
174 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
175 func s:set_varg6(...) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
176 let b = a:000 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
177 let b[0] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
178 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
179 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
180 func s:set_varg7(...) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
181 let b = a:000 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
182 let b += [1] |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
183 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
184 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
185 func s:set_varg8(...) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
186 let b = a:000 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
187 call add(b, 1) |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
188 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
189 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
190 func s:set_varg9(...) abort |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
191 let b = a:000 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
192 let b[0][0] = 1 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
193 endfunction |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
194 |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
195 func Test_let_varg_fail() |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
196 call assert_fails('call s:set_varg1(1)', 'E46:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
197 call assert_fails('call s:set_varg2(1)', 'E742:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
198 call assert_fails('call s:set_varg3(1)', 'E46:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
199 call assert_fails('call s:set_varg4(1)', 'E742:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
200 call s:set_varg5([0]) |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
201 call assert_fails('call s:set_varg6(1)', 'E742:') |
15780
5b6c3c7feba8
patch 8.1.0897: can modify a:000 when using a reference
Bram Moolenaar <Bram@vim.org>
parents:
15762
diff
changeset
|
202 call assert_fails('call s:set_varg7(1)', 'E742:') |
15762
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
203 call assert_fails('call s:set_varg8(1)', 'E742:') |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
204 call s:set_varg9([0]) |
dff66c4670b1
patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents:
11961
diff
changeset
|
205 endfunction |
16172
6b0836727cf3
patch 8.1.1091: MS-Windows: cannot use multi-byte chars in environment var
Bram Moolenaar <Bram@vim.org>
parents:
15780
diff
changeset
|
206 |
6b0836727cf3
patch 8.1.1091: MS-Windows: cannot use multi-byte chars in environment var
Bram Moolenaar <Bram@vim.org>
parents:
15780
diff
changeset
|
207 func Test_let_utf8_environment() |
6b0836727cf3
patch 8.1.1091: MS-Windows: cannot use multi-byte chars in environment var
Bram Moolenaar <Bram@vim.org>
parents:
15780
diff
changeset
|
208 let $a = 'ĀĒĪŌŪあいうえお' |
6b0836727cf3
patch 8.1.1091: MS-Windows: cannot use multi-byte chars in environment var
Bram Moolenaar <Bram@vim.org>
parents:
15780
diff
changeset
|
209 call assert_equal('ĀĒĪŌŪあいうえお', $a) |
6b0836727cf3
patch 8.1.1091: MS-Windows: cannot use multi-byte chars in environment var
Bram Moolenaar <Bram@vim.org>
parents:
15780
diff
changeset
|
210 endfunc |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
211 |
18540
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
212 func Test_let_no_type_checking() |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
213 let v = 1 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
214 let v = [1,2,3] |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
215 let v = {'a': 1, 'b': 2} |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
216 let v = 3.4 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
217 let v = 'hello' |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
218 endfunc |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
219 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
220 func Test_let_termcap() |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
221 " Terminal code |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
222 let old_t_te = &t_te |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
223 let &t_te = "\<Esc>[yes;" |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
224 call assert_match('t_te.*^[[yes;', execute("set termcap")) |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
225 let &t_te = old_t_te |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
226 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
227 if exists("+t_k1") |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
228 " Key code |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
229 let old_t_k1 = &t_k1 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
230 let &t_k1 = "that" |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
231 call assert_match('t_k1.*that', execute("set termcap")) |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
232 let &t_k1 = old_t_k1 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
233 endif |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
234 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
235 call assert_fails('let x = &t_xx', 'E113') |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
236 let &t_xx = "yes" |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
237 call assert_equal("yes", &t_xx) |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
238 let &t_xx = "" |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
239 call assert_fails('let x = &t_xx', 'E113') |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
240 endfunc |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
241 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
242 func Test_let_option_error() |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
243 let _w = &tw |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
244 let &tw = 80 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
245 call assert_fails('let &tw .= 1', 'E734') |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
246 call assert_equal(80, &tw) |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
247 let &tw = _w |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
248 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
249 let _w = &fillchars |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
250 let &fillchars = "vert:|" |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
251 call assert_fails('let &fillchars += "diff:-"', 'E734') |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
252 call assert_equal("vert:|", &fillchars) |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
253 let &fillchars = _w |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
254 endfunc |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
255 |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
256 " Errors with the :let statement |
18540
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
257 func Test_let_errors() |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
258 let s = 'abcd' |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
259 call assert_fails('let s[1] = 5', 'E689:') |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
260 |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
261 let l = [1, 2, 3] |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
262 call assert_fails('let l[:] = 5', 'E709:') |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
263 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
264 call assert_fails('let x:lnum=5', 'E488:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
265 call assert_fails('let v:=5', 'E461:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
266 call assert_fails('let [a]', 'E474:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
267 call assert_fails('let [a, b] = [', 'E697:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
268 call assert_fails('let [a, b] = [10, 20', 'E696:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
269 call assert_fails('let [a, b] = 10', 'E714:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
270 call assert_fails('let [a, , b] = [10, 20]', 'E475:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
271 call assert_fails('let [a, b&] = [10, 20]', 'E475:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
272 call assert_fails('let $ = 10', 'E475:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
273 call assert_fails('let $FOO[1] = "abc"', 'E18:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
274 call assert_fails('let &buftype[1] = "nofile"', 'E18:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
275 let s = "var" |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
276 let var = 1 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
277 call assert_fails('let {s}.1 = 2', 'E18:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
278 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
279 " This test works only when the language is English |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
280 if v:lang == "C" || v:lang =~ '^[Ee]n' |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
281 call assert_fails('let [a ; b;] = [10, 20]', |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
282 \ 'Double ; in list of variables') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
283 endif |
18540
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
284 endfunc |
f7bb0e413fe1
patch 8.1.2264: there are two test files for :let
Bram Moolenaar <Bram@vim.org>
parents:
18536
diff
changeset
|
285 |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
286 func Test_let_heredoc_fails() |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
287 call assert_fails('let v =<< marker', 'E991:') |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
288 try |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
289 exe "let v =<< TEXT | abc | TEXT" |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
290 call assert_report('No exception thrown') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
291 catch /E488:/ |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
292 catch |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
293 call assert_report("Caught exception: " .. v:exception) |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
294 endtry |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
295 |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
296 let text =<< trim END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
297 func WrongSyntax() |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
298 let v =<< that there |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
299 endfunc |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
300 END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
301 call writefile(text, 'XheredocFail') |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
302 call assert_fails('source XheredocFail', 'E126:') |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
303 call delete('XheredocFail') |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
304 |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
305 let text =<< trim CodeEnd |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
306 func MissingEnd() |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
307 let v =<< END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
308 endfunc |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
309 CodeEnd |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
310 call writefile(text, 'XheredocWrong') |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
311 call assert_fails('source XheredocWrong', 'E126:') |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
312 call delete('XheredocWrong') |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
313 |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
314 let text =<< trim TEXTend |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
315 let v =<< " comment |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
316 TEXTend |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
317 call writefile(text, 'XheredocNoMarker') |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
318 call assert_fails('source XheredocNoMarker', 'E172:') |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
319 call delete('XheredocNoMarker') |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
320 |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
321 let text =<< trim TEXTend |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
322 let v =<< text |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
323 TEXTend |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
324 call writefile(text, 'XheredocBadMarker') |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
325 call assert_fails('source XheredocBadMarker', 'E221:') |
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
326 call delete('XheredocBadMarker') |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
327 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
328 call writefile(['let v =<< TEXT', 'abc'], 'XheredocMissingMarker') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
329 call assert_fails('source XheredocMissingMarker', 'E990:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
330 call delete('XheredocMissingMarker') |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
331 endfunc |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
332 |
17462
9088fafff9b3
patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents:
17450
diff
changeset
|
333 func Test_let_heredoc_trim_no_indent_marker() |
9088fafff9b3
patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents:
17450
diff
changeset
|
334 let text =<< trim END |
9088fafff9b3
patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents:
17450
diff
changeset
|
335 Text |
9088fafff9b3
patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents:
17450
diff
changeset
|
336 with |
9088fafff9b3
patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents:
17450
diff
changeset
|
337 indent |
9088fafff9b3
patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents:
17450
diff
changeset
|
338 END |
9088fafff9b3
patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents:
17450
diff
changeset
|
339 call assert_equal(['Text', 'with', 'indent'], text) |
9088fafff9b3
patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents:
17450
diff
changeset
|
340 endfunc |
9088fafff9b3
patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents:
17450
diff
changeset
|
341 |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
342 " Test for the setting a variable using the heredoc syntax |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
343 func Test_let_heredoc() |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
344 let var1 =<< END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
345 Some sample text |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
346 Text with indent |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
347 !@#$%^&*()-+_={}|[]\~`:";'<>?,./ |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
348 END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
349 |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
350 call assert_equal(["Some sample text", "\tText with indent", " !@#$%^&*()-+_={}|[]\\~`:\";'<>?,./"], var1) |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
351 |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
352 let var2 =<< XXX |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
353 Editor |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
354 XXX |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
355 call assert_equal(['Editor'], var2) |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
356 |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
357 let var3 =<<END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
358 END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
359 call assert_equal([], var3) |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
360 |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
361 let var3 =<<END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
362 vim |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
363 |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
364 end |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
365 END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
366 END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
367 END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
368 call assert_equal(['vim', '', 'end', ' END', 'END '], var3) |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
369 |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
370 let var1 =<< trim END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
371 Line1 |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
372 Line2 |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
373 Line3 |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
374 END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
375 END |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
376 call assert_equal(['Line1', ' Line2', "\tLine3", ' END'], var1) |
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
377 |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16708
diff
changeset
|
378 let var1 =<< trim !!! |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16708
diff
changeset
|
379 Line1 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16708
diff
changeset
|
380 line2 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16708
diff
changeset
|
381 Line3 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16708
diff
changeset
|
382 !!! |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16708
diff
changeset
|
383 !!! |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16708
diff
changeset
|
384 call assert_equal(['Line1', ' line2', "\tLine3", '!!!',], var1) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16708
diff
changeset
|
385 |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
386 let var1 =<< trim XX |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
387 Line1 |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
388 XX |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16708
diff
changeset
|
389 call assert_equal(['Line1'], var1) |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
390 |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
391 " ignore "endfunc" |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
392 let var1 =<< END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
393 something |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
394 endfunc |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
395 END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
396 call assert_equal(['something', 'endfunc'], var1) |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
397 |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
398 " ignore "endfunc" with trim |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
399 let var1 =<< trim END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
400 something |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
401 endfunc |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
402 END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
403 call assert_equal(['something', 'endfunc'], var1) |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
404 |
17178
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
405 " not concatenate lines |
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
406 let var1 =<< END |
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
407 some |
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
408 \thing |
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
409 \ else |
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
410 END |
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
411 call assert_equal(['some', ' \thing', ' \ else'], var1) |
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
412 |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
413 " ignore "python << xx" |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
414 let var1 =<<END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
415 something |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
416 python << xx |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
417 END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
418 call assert_equal(['something', 'python << xx'], var1) |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
419 |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
420 " ignore "python << xx" with trim |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
421 let var1 =<< trim END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
422 something |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
423 python << xx |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
424 END |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
425 call assert_equal(['something', 'python << xx'], var1) |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
426 |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
427 " ignore "append" |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
428 let var1 =<< E |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
429 something |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
430 app |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
431 E |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
432 call assert_equal(['something', 'app'], var1) |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
433 |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
434 " ignore "append" with trim |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
435 let var1 =<< trim END |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
436 something |
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
437 app |
17450
509542f1fffb
patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
438 END |
16708
98393772bddd
patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents:
16704
diff
changeset
|
439 call assert_equal(['something', 'app'], var1) |
18348
9ea364ccf216
patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents:
17462
diff
changeset
|
440 |
9ea364ccf216
patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents:
17462
diff
changeset
|
441 let check = [] |
9ea364ccf216
patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents:
17462
diff
changeset
|
442 if 0 |
9ea364ccf216
patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents:
17462
diff
changeset
|
443 let check =<< trim END |
9ea364ccf216
patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents:
17462
diff
changeset
|
444 from heredoc |
9ea364ccf216
patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents:
17462
diff
changeset
|
445 END |
9ea364ccf216
patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents:
17462
diff
changeset
|
446 endif |
9ea364ccf216
patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents:
17462
diff
changeset
|
447 call assert_equal([], check) |
18536
c0cd979000f9
patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents:
18348
diff
changeset
|
448 |
c0cd979000f9
patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents:
18348
diff
changeset
|
449 " unpack assignment |
c0cd979000f9
patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents:
18348
diff
changeset
|
450 let [a, b, c] =<< END |
c0cd979000f9
patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents:
18348
diff
changeset
|
451 x |
c0cd979000f9
patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents:
18348
diff
changeset
|
452 \y |
c0cd979000f9
patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents:
18348
diff
changeset
|
453 z |
c0cd979000f9
patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents:
18348
diff
changeset
|
454 END |
c0cd979000f9
patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents:
18348
diff
changeset
|
455 call assert_equal([' x', ' \y', ' z'], [a, b, c]) |
16704
a927fdf9a4b0
patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
16172
diff
changeset
|
456 endfunc |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
457 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
18713
diff
changeset
|
458 " vim: shiftwidth=2 sts=2 expandtab |