annotate src/testdir/test_let.vim @ 18536:c0cd979000f9 v8.1.2262

patch 8.1.2262: unpack assignment in function not recognized Commit: https://github.com/vim/vim/commit/1e673b9eb686459bd0e7fc3f2199dd077546a18e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Nov 6 15:02:50 2019 +0100 patch 8.1.2262: unpack assignment in function not recognized Problem: Unpack assignment in function not recognized. Solution: Skip over "[a, b]". (closes https://github.com/vim/vim/issues/5051)
author Bram Moolenaar <Bram@vim.org>
date Wed, 06 Nov 2019 15:15:03 +0100
parents 9ea364ccf216
children f7bb0e413fe1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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)
0240e7e3d736 patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 endfunc
15762
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
28
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
29 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
30 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
31 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
32
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
33 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
34 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
35 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
36
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
37 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
38 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
39 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
40 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
41
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
42 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
43 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
44 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
45 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
46
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
47 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
48 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
49 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
50 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
51
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
52 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
53 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
54 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
55
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
56 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
57 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
58 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
59
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
60 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
61 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
62 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
63
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
64 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
65 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
66 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
67
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
68 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
69 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
70 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
71 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
72
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
73 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
74 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
75 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
76 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
77
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
78 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
79 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
80 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
81 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
82
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
83 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
84 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
85 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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93 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
94 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
95 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
96 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
97
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
98 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
99 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
100 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
101
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
102 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
103 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
104 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
105
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
106 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
107 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
108 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
109
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
110 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
111 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
112 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
113
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
114 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
115 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
116 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
117
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
118 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
119 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
120 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
121 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
122
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
123 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
124 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
125 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
126 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
127
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
128 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
129 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
130 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
131 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
132
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
133 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
134 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
135 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
136 endfunction
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
137
dff66c4670b1 patch 8.1.0888: the a: dict is not immutable as documented
Bram Moolenaar <Bram@vim.org>
parents: 11961
diff changeset
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149
6b0836727cf3 patch 8.1.1091: MS-Windows: cannot use multi-byte chars in environment var
Bram Moolenaar <Bram@vim.org>
parents: 15780
diff changeset
150 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
151 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
152 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
153 endfunc
16704
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
154
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
155 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
156 call assert_fails('let v =<< marker', 'E991:')
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
157
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
158 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
159 func WrongSyntax()
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
160 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
161 endfunc
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
162 END
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
163 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
164 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
165 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
166
17450
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
167 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
168 func MissingEnd()
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
169 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
170 endfunc
17450
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
171 CodeEnd
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
172 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
173 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
174 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
175
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
176 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
177 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
178 TEXTend
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
179 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
180 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
181 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
182
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
183 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
184 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
185 TEXTend
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
186 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
187 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
188 call delete('XheredocBadMarker')
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
189 endfunc
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
190
17462
9088fafff9b3 patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents: 17450
diff changeset
191 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
192 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
193 Text
9088fafff9b3 patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents: 17450
diff changeset
194 with
9088fafff9b3 patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents: 17450
diff changeset
195 indent
9088fafff9b3 patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents: 17450
diff changeset
196 END
9088fafff9b3 patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents: 17450
diff changeset
197 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
198 endfunc
9088fafff9b3 patch 8.1.1729: heredoc with trim not properly handled in function
Bram Moolenaar <Bram@vim.org>
parents: 17450
diff changeset
199
16704
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
200 " 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
201 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
202 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
203 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
204 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
205 !@#$%^&*()-+_={}|[]\~`:";'<>?,./
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
206 END
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
207
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
208 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
209
17450
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
210 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
211 Editor
17450
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
212 XXX
16704
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
213 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
214
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
215 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
216 END
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
217 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
218
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
219 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
220 vim
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
221
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
222 end
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
223 END
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
224 END
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
225 END
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
226 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
227
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
228 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
229 Line1
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
230 Line2
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
231 Line3
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
232 END
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
233 END
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
234 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
235
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16708
diff changeset
236 let var1 =<< trim !!!
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16708
diff changeset
237 Line1
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16708
diff changeset
238 line2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16708
diff changeset
239 Line3
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16708
diff changeset
240 !!!
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16708
diff changeset
241 !!!
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16708
diff changeset
242 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
243
17450
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
244 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
245 Line1
17450
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
246 XX
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16708
diff changeset
247 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
248
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
249 " ignore "endfunc"
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
250 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
251 something
16704
a927fdf9a4b0 patch 8.1.1354: getting a list of text lines is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 16172
diff changeset
252 endfunc
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
253 END
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
254 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
255
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
256 " 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
257 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
258 something
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
259 endfunc
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
260 END
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
261 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
262
17178
40c4cb095d53 patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
263 " not concatenate lines
40c4cb095d53 patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
264 let var1 =<< END
40c4cb095d53 patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
265 some
40c4cb095d53 patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
266 \thing
40c4cb095d53 patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
267 \ else
40c4cb095d53 patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
268 END
40c4cb095d53 patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
269 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
270
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
271 " 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
272 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
273 something
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
274 python << xx
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
275 END
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
276 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
277
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
278 " 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
279 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
280 something
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
281 python << xx
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
282 END
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
283 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
284
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
285 " 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
286 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
287 something
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
288 app
17450
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
289 E
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
290 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
291
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
292 " 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
293 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
294 something
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
295 app
17450
509542f1fffb patch 8.1.1723: heredoc assignment has no room for new features
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
296 END
16708
98393772bddd patch 8.1.1356: some text in heredoc assignment ends the text
Bram Moolenaar <Bram@vim.org>
parents: 16704
diff changeset
297 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
298
9ea364ccf216 patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents: 17462
diff changeset
299 let check = []
9ea364ccf216 patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents: 17462
diff changeset
300 if 0
9ea364ccf216 patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents: 17462
diff changeset
301 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
302 from heredoc
9ea364ccf216 patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents: 17462
diff changeset
303 END
9ea364ccf216 patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents: 17462
diff changeset
304 endif
9ea364ccf216 patch 8.1.2168: heredoc assignment not skipped in if block
Bram Moolenaar <Bram@vim.org>
parents: 17462
diff changeset
305 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
306
c0cd979000f9 patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents: 18348
diff changeset
307 " unpack assignment
c0cd979000f9 patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents: 18348
diff changeset
308 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
309 x
c0cd979000f9 patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents: 18348
diff changeset
310 \y
c0cd979000f9 patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents: 18348
diff changeset
311 z
c0cd979000f9 patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents: 18348
diff changeset
312 END
c0cd979000f9 patch 8.1.2262: unpack assignment in function not recognized
Bram Moolenaar <Bram@vim.org>
parents: 18348
diff changeset
313 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
314 endfunc