annotate src/testdir/test_eval.in @ 19769:6679844938dc

Added tag v8.2.0440 for changeset 0d1088e3c53f80907c3065722cdd91b01c92acf1
author Bram Moolenaar <Bram@vim.org>
date Tue, 24 Mar 2020 10:45:04 +0100
parents 30f9a62f5f51
children 0da696bd7352
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
1 Test for various eval features. vim: set ft=vim :
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
2
13096
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents: 7611
diff changeset
3 NOTE: Do not add more here, use new style test test_eval_stuff.vim
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents: 7611
diff changeset
4
6543
b01ca71f93b2 updated for version 7.4.598
Bram Moolenaar <bram@vim.org>
parents: 5944
diff changeset
5 Note: system clipboard is saved, changed and restored.
5796
f084024c0ddb updated for version 7.4.242
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6
6563
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
7 clipboard contents
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
8 something else
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
9
5796
f084024c0ddb updated for version 7.4.242
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 STARTTEST
f084024c0ddb updated for version 7.4.242
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 :so small.vim
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
12 :set encoding=latin1
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
13 :set noswapfile
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
14 :lang C
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
15 :fun AppendRegContents(reg)
6563
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
16 call AppendRegParts(a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1)))
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
17 :endfun
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
18 :fun AppendRegParts(reg, type, cont, strcont, cont1, strcont1)
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
19 call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, a:type, a:cont, a:strcont, a:cont1, a:strcont1))
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
20 endfun
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
21 :command -nargs=? AR :call AppendRegContents(<q-args>)
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
22 :fun SetReg(...)
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
23 call call('setreg', a:000)
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
24 call append('$', printf('{{{2 setreg(%s)', string(a:000)[1:-2]))
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
25 call AppendRegContents(a:1)
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
26 if a:1 isnot# '='
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
27 execute "silent normal! Go==\n==\e\"".a:1."P"
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
28 endif
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
29 endfun
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
30 :fun ErrExe(str)
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
31 call append('$', 'Executing '.a:str)
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
32 try
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
33 execute a:str
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
34 catch
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
35 $put =v:exception
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
36 endtry
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
37 endfun
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
38 :fun Test()
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
39 $put ='{{{1 let tests'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
40 let @" = 'abc'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
41 AR "
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
42 let @" = "abc\n"
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
43 AR "
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
44 let @" = "abc\<C-m>"
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
45 AR "
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
46 let @= = '"abc"'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
47 AR =
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
48
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
49 $put ='{{{1 Basic setreg tests'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
50 call SetReg('a', 'abcA', 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
51 call SetReg('b', 'abcB', 'v')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
52 call SetReg('c', 'abcC', 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
53 call SetReg('d', 'abcD', 'V')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
54 call SetReg('e', 'abcE', 'b')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
55 call SetReg('f', 'abcF', "\<C-v>")
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
56 call SetReg('g', 'abcG', 'b10')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
57 call SetReg('h', 'abcH', "\<C-v>10")
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
58 call SetReg('I', 'abcI')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
59
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
60 $put ='{{{1 Appending single lines with setreg()'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
61 call SetReg('A', 'abcAc', 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
62 call SetReg('A', 'abcAl', 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
63 call SetReg('A', 'abcAc2','c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
64 call SetReg('b', 'abcBc', 'ca')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
65 call SetReg('b', 'abcBb', 'ba')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
66 call SetReg('b', 'abcBc2','ca')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
67 call SetReg('b', 'abcBb2','b50a')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
68
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
69 call SetReg('C', 'abcCl', 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
70 call SetReg('C', 'abcCc', 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
71 call SetReg('D', 'abcDb', 'b')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
72
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
73 call SetReg('E', 'abcEb', 'b')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
74 call SetReg('E', 'abcEl', 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
75 call SetReg('F', 'abcFc', 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
76
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
77 $put ='{{{1 Appending NL with setreg()'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
78 call setreg('a', 'abcA2', 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
79 call setreg('b', 'abcB2', 'v')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
80 call setreg('c', 'abcC2', 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
81 call setreg('d', 'abcD2', 'V')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
82 call setreg('e', 'abcE2', 'b')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
83 call setreg('f', 'abcF2', "\<C-v>")
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
84 call setreg('g', 'abcG2', 'b10')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
85 call setreg('h', 'abcH2', "\<C-v>10")
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
86 call setreg('I', 'abcI2')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
87
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
88 call SetReg('A', "\n")
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
89 call SetReg('B', "\n", 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
90 call SetReg('C', "\n")
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
91 call SetReg('D', "\n", 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
92 call SetReg('E', "\n")
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
93 call SetReg('F', "\n", 'b')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
94
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
95 $put ='{{{1 Setting lists with setreg()'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
96 call SetReg('a', ['abcA3'], 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
97 call SetReg('b', ['abcB3'], 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
98 call SetReg('c', ['abcC3'], 'b')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
99 call SetReg('d', ['abcD3'])
5810
0b9a66ea49f4 updated for version 7.4.249
Bram Moolenaar <bram@vim.org>
parents: 5798
diff changeset
100 call SetReg('e', [1, 2, 'abc', 3])
0b9a66ea49f4 updated for version 7.4.249
Bram Moolenaar <bram@vim.org>
parents: 5798
diff changeset
101 call SetReg('f', [1, 2, 3])
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
102
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
103 $put ='{{{1 Appending lists with setreg()'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
104 call SetReg('A', ['abcA3c'], 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
105 call SetReg('b', ['abcB3l'], 'la')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
106 call SetReg('C', ['abcC3b'], 'lb')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
107 call SetReg('D', ['abcD32'])
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
108
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
109 call SetReg('A', ['abcA32'])
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
110 call SetReg('B', ['abcB3c'], 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
111 call SetReg('C', ['abcC3l'], 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
112 call SetReg('D', ['abcD3b'], 'b')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
113
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
114 $put ='{{{1 Appending lists with NL with setreg()'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
115 call SetReg('A', ["\n", 'abcA3l2'], 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
116 call SetReg('B', ["\n", 'abcB3c2'], 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
117 call SetReg('C', ["\n", 'abcC3b2'], 'b')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
118 call SetReg('D', ["\n", 'abcD3b50'],'b50')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
119
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
120 $put ='{{{1 Setting lists with NLs with setreg()'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
121 call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"])
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
122 call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
123 call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
124 call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
125 call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
126
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
127 $put ='{{{1 Search and expressions'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
128 call SetReg('/', ['abc/'])
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
129 call SetReg('/', ["abc/\n"])
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
130 call SetReg('=', ['"abc/"'])
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
131 call SetReg('=', ["\"abc/\n\""])
6543
b01ca71f93b2 updated for version 7.4.598
Bram Moolenaar <bram@vim.org>
parents: 5944
diff changeset
132 $put ='{{{1 System clipboard'
6563
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
133 if has('clipboard')
6543
b01ca71f93b2 updated for version 7.4.598
Bram Moolenaar <bram@vim.org>
parents: 5944
diff changeset
134 " Save and restore system clipboard.
b01ca71f93b2 updated for version 7.4.598
Bram Moolenaar <bram@vim.org>
parents: 5944
diff changeset
135 " If no connection to X-Server is possible, test should succeed.
6571
75238dbe8543 updated for version 7.4.612
Bram Moolenaar <bram@vim.org>
parents: 6563
diff changeset
136 let _clipreg = ['*', getreg('*'), getregtype('*')]
6563
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
137 let _clipopt = &cb
6571
75238dbe8543 updated for version 7.4.612
Bram Moolenaar <bram@vim.org>
parents: 6563
diff changeset
138 let &cb='unnamed'
13096
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents: 7611
diff changeset
139 7y
6571
75238dbe8543 updated for version 7.4.612
Bram Moolenaar <bram@vim.org>
parents: 6563
diff changeset
140 AR *
6563
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
141 tabdo :windo :echo "hi"
13096
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents: 7611
diff changeset
142 8y
6571
75238dbe8543 updated for version 7.4.612
Bram Moolenaar <bram@vim.org>
parents: 6563
diff changeset
143 AR *
6563
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
144 let &cb=_clipopt
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
145 call call('setreg', _clipreg)
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
146 else
6571
75238dbe8543 updated for version 7.4.612
Bram Moolenaar <bram@vim.org>
parents: 6563
diff changeset
147 call AppendRegParts('*', 'V', "clipboard contents\n", "['clipboard contents']", "clipboard contents\n", "['clipboard contents']")
75238dbe8543 updated for version 7.4.612
Bram Moolenaar <bram@vim.org>
parents: 6563
diff changeset
148 call AppendRegParts('*', 'V', "something else\n", "['something else']", "something else\n", "['something else']")
6563
6b86d256fd33 updated for version 7.4.608
Bram Moolenaar <bram@vim.org>
parents: 6543
diff changeset
149 endif
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
150 $put ='{{{1 Errors'
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
151 call ErrExe('call setreg()')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
152 call ErrExe('call setreg(1)')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
153 call ErrExe('call setreg(1, 2, 3, 4)')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
154 call ErrExe('call setreg([], 2)')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
155 call ErrExe('call setreg(1, {})')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
156 call ErrExe('call setreg(1, 2, [])')
5810
0b9a66ea49f4 updated for version 7.4.249
Bram Moolenaar <bram@vim.org>
parents: 5798
diff changeset
157 call ErrExe('call setreg("/", ["1", "2"])')
0b9a66ea49f4 updated for version 7.4.249
Bram Moolenaar <bram@vim.org>
parents: 5798
diff changeset
158 call ErrExe('call setreg("=", ["1", "2"])')
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
159 call ErrExe('call setreg(1, ["", "", [], ""])')
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
160 endfun
5796
f084024c0ddb updated for version 7.4.242
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
161 :"
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
162 :call Test()
5796
f084024c0ddb updated for version 7.4.242
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
163 :"
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
164 :delfunction SetReg
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
165 :delfunction AppendRegContents
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
166 :delfunction ErrExe
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
167 :delfunction Test
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
168 :delcommand AR
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
169 :call garbagecollect(1)
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
170 :"
5842
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
171 :" function name not starting with capital
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
172 :try
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
173 :func! g:test()
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
174 :echo "test"
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
175 :endfunc
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
176 :catch
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
177 :$put =v:exception
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
178 :endtry
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
179 :"
5834
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
180 :" function name includes a colon
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
181 :try
5842
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
182 :func! b:test()
5834
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
183 :echo "test"
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
184 :endfunc
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
185 :catch
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
186 :$put =v:exception
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
187 :endtry
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
188 :"
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
189 :" function name folowed by #
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
190 :try
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
191 :func! test2() "#
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
192 :echo "test2"
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
193 :endfunc
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
194 :catch
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
195 :$put =v:exception
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
196 :endtry
6bc874e4789a updated for version 7.4.260
Bram Moolenaar <bram@vim.org>
parents: 5810
diff changeset
197 :"
5842
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
198 :" function name starting with/without "g:", buffer-local funcref.
5844
8ec9d2196bee updated for version 7.4.265
Bram Moolenaar <bram@vim.org>
parents: 5842
diff changeset
199 :function! g:Foo(n)
8ec9d2196bee updated for version 7.4.265
Bram Moolenaar <bram@vim.org>
parents: 5842
diff changeset
200 : $put ='called Foo(' . a:n . ')'
5842
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
201 :endfunction
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
202 :let b:my_func = function('Foo')
5844
8ec9d2196bee updated for version 7.4.265
Bram Moolenaar <bram@vim.org>
parents: 5842
diff changeset
203 :call b:my_func(1)
8ec9d2196bee updated for version 7.4.265
Bram Moolenaar <bram@vim.org>
parents: 5842
diff changeset
204 :echo g:Foo(2)
8ec9d2196bee updated for version 7.4.265
Bram Moolenaar <bram@vim.org>
parents: 5842
diff changeset
205 :echo Foo(3)
5842
00acac0af680 updated for version 7.4.264
Bram Moolenaar <bram@vim.org>
parents: 5834
diff changeset
206 :"
5850
1a5ed2626b26 updated for version 7.4.268
Bram Moolenaar <bram@vim.org>
parents: 5844
diff changeset
207 :" script-local function used in Funcref must exist.
1a5ed2626b26 updated for version 7.4.268
Bram Moolenaar <bram@vim.org>
parents: 5844
diff changeset
208 :so test_eval_func.vim
1a5ed2626b26 updated for version 7.4.268
Bram Moolenaar <bram@vim.org>
parents: 5844
diff changeset
209 :"
5858
00228400629e updated for version 7.4.272
Bram Moolenaar <bram@vim.org>
parents: 5850
diff changeset
210 :" Using $ instead of '$' must give an error
00228400629e updated for version 7.4.272
Bram Moolenaar <bram@vim.org>
parents: 5850
diff changeset
211 :try
00228400629e updated for version 7.4.272
Bram Moolenaar <bram@vim.org>
parents: 5850
diff changeset
212 : call append($, 'foobar')
00228400629e updated for version 7.4.272
Bram Moolenaar <bram@vim.org>
parents: 5850
diff changeset
213 :catch
00228400629e updated for version 7.4.272
Bram Moolenaar <bram@vim.org>
parents: 5850
diff changeset
214 :$put =v:exception
00228400629e updated for version 7.4.272
Bram Moolenaar <bram@vim.org>
parents: 5850
diff changeset
215 :endtry
00228400629e updated for version 7.4.272
Bram Moolenaar <bram@vim.org>
parents: 5850
diff changeset
216 :"
5944
332a5c2b2956 updated for version 7.4.313
Bram Moolenaar <bram@vim.org>
parents: 5938
diff changeset
217 :$put ='{{{1 getcurpos/setpos'
5938
ccac0aa34eea updated for version 7.4.310
Bram Moolenaar <bram@vim.org>
parents: 5858
diff changeset
218 /^012345678
5944
332a5c2b2956 updated for version 7.4.313
Bram Moolenaar <bram@vim.org>
parents: 5938
diff changeset
219 6l:let sp = getcurpos()
5938
ccac0aa34eea updated for version 7.4.310
Bram Moolenaar <bram@vim.org>
parents: 5858
diff changeset
220 0:call setpos('.', sp)
ccac0aa34eea updated for version 7.4.310
Bram Moolenaar <bram@vim.org>
parents: 5858
diff changeset
221 jyl:$put
ccac0aa34eea updated for version 7.4.310
Bram Moolenaar <bram@vim.org>
parents: 5858
diff changeset
222 :"
7611
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
223 :" substring and variable name
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
224 :let str = 'abcdef'
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
225 :let n = 3
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
226 :$put =str[n:]
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
227 :$put =str[:n]
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
228 :$put =str[n:n]
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
229 :unlet n
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
230 :let nn = 3
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
231 :$put =str[nn:]
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
232 :$put =str[:nn]
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
233 :$put =str[nn:nn]
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
234 :unlet nn
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
235 :let b:nn = 4
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
236 :$put =str[b:nn:]
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
237 :$put =str[:b:nn]
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
238 :$put =str[b:nn:b:nn]
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
239 :unlet b:nn
9c420b8db435 commit https://github.com/vim/vim/commit/9bbf63dbf8286fadc0cd6b3428010abb67b1b64d
Christian Brabandt <cb@256bit.org>
parents: 6571
diff changeset
240 :"
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
241 :/^start:/+1,$wq! test.out
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
242 :" vim: et ts=4 isk-=\: fmr=???,???
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
243 :call getchar()
5796
f084024c0ddb updated for version 7.4.242
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
244 ENDTEST
f084024c0ddb updated for version 7.4.242
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
245
5938
ccac0aa34eea updated for version 7.4.310
Bram Moolenaar <bram@vim.org>
parents: 5858
diff changeset
246 012345678
ccac0aa34eea updated for version 7.4.310
Bram Moolenaar <bram@vim.org>
parents: 5858
diff changeset
247 012345678
ccac0aa34eea updated for version 7.4.310
Bram Moolenaar <bram@vim.org>
parents: 5858
diff changeset
248
5798
9f8fa56f1906 updated for version 7.4.243
Bram Moolenaar <bram@vim.org>
parents: 5796
diff changeset
249 start: