annotate src/testdir/test_eval_stuff.vim @ 28668:53c608c7ea9e v8.2.4858

patch 8.2.4858: K_SPECIAL may be escaped twice Commit: https://github.com/vim/vim/commit/db08887f24d20be11d184ce321bc0890613e42bd Author: zeertzjq <zeertzjq@outlook.com> Date: Mon May 2 22:53:45 2022 +0100 patch 8.2.4858: K_SPECIAL may be escaped twice Problem: K_SPECIAL may be escaped twice. Solution: Avoid double escaping. (closes https://github.com/vim/vim/issues/10340)
author Bram Moolenaar <Bram@vim.org>
date Tue, 03 May 2022 00:00:04 +0200
parents 84682ad16c31
children 5063dfe96a59
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13096
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for various eval things.
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
21267
7833afe1c66e patch 8.2.1184: some tests fail
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
3 source view_util.vim
7833afe1c66e patch 8.2.1184: some tests fail
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
4
13096
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 function s:foo() abort
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 try
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 return [] == 0
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 catch
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 return 1
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endtry
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 endfunction
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 func Test_catch_return_with_error()
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal(1, s:foo())
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 endfunc
13288
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
16
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
17 func Test_nocatch_restore_silent_emsg()
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
18 silent! try
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
19 throw 1
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
20 catch
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
21 endtry
21267
7833afe1c66e patch 8.2.1184: some tests fail
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
22 echoerr 'wrong again'
7833afe1c66e patch 8.2.1184: some tests fail
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
23 call assert_equal('wrong again', ScreenLine(&lines))
13288
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
24 endfunc
13672
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
25
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
26 func Test_mkdir_p()
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
27 call mkdir('Xmkdir/nested', 'p')
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
28 call assert_true(isdirectory('Xmkdir/nested'))
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
29 try
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
30 " Trying to make existing directories doesn't error
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
31 call mkdir('Xmkdir', 'p')
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
32 call mkdir('Xmkdir/nested', 'p')
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
33 catch /E739:/
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
34 call assert_report('mkdir(..., "p") failed for an existing directory')
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
35 endtry
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
36 " 'p' doesn't suppress real errors
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
37 call writefile([], 'Xfile')
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21949
diff changeset
38 call assert_fails('call mkdir("Xfile", "p")', 'E739:')
13672
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
39 call delete('Xfile')
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
40 call delete('Xmkdir', 'rf')
20158
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20156
diff changeset
41 call assert_equal(0, mkdir(test_null_string()))
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21949
diff changeset
42 call assert_fails('call mkdir([])', 'E730:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21949
diff changeset
43 call assert_fails('call mkdir("abc", [], [])', 'E745:')
13672
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
44 endfunc
14714
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
45
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
46 func Test_line_continuation()
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
47 let array = [5,
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
48 "\ ignore this
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
49 \ 6,
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
50 "\ more to ignore
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
51 "\ more moreto ignore
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
52 \ ]
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
53 "\ and some more
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
54 call assert_equal([5, 6], array)
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
55 endfunc
15107
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
56
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
57 func Test_E963()
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
58 " These commands used to cause an internal error prior to vim 8.1.0563
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
59 let v_e = v:errors
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
60 let v_o = v:oldfiles
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
61 call assert_fails("let v:errors=''", 'E963:')
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
62 call assert_equal(v_e, v:errors)
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
63 call assert_fails("let v:oldfiles=''", 'E963:')
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
64 call assert_equal(v_o, v:oldfiles)
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
65 endfunc
15456
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
66
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
67 func Test_for_invalid()
25495
7144d2ffc86b patch 8.2.3284: no error for insert() or remove() changing a locked blob
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
68 call assert_fails("for x in 99", 'E1098:')
7144d2ffc86b patch 8.2.3284: no error for insert() or remove() changing a locked blob
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
69 call assert_fails("for x in function('winnr')", 'E1098:')
7144d2ffc86b patch 8.2.3284: no error for insert() or remove() changing a locked blob
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
70 call assert_fails("for x in {'a': 9}", 'E1098:')
23768
1a53383f08e5 patch 8.2.2425: cursor on invalid line with range and :substitute
Bram Moolenaar <Bram@vim.org>
parents: 23693
diff changeset
71
1a53383f08e5 patch 8.2.2425: cursor on invalid line with range and :substitute
Bram Moolenaar <Bram@vim.org>
parents: 23693
diff changeset
72 if 0
1a53383f08e5 patch 8.2.2425: cursor on invalid line with range and :substitute
Bram Moolenaar <Bram@vim.org>
parents: 23693
diff changeset
73 /1/5/2/s/\n
1a53383f08e5 patch 8.2.2425: cursor on invalid line with range and :substitute
Bram Moolenaar <Bram@vim.org>
parents: 23693
diff changeset
74 endif
1a53383f08e5 patch 8.2.2425: cursor on invalid line with range and :substitute
Bram Moolenaar <Bram@vim.org>
parents: 23693
diff changeset
75 redraw
15456
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
76 endfunc
15468
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
77
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
78 func Test_readfile_binary()
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
79 new
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
80 call setline(1, ['one', 'two', 'three'])
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
81 setlocal ff=dos
21911
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
82 silent write XReadfile_bin
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
83 let lines = 'XReadfile_bin'->readfile()
15468
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
84 call assert_equal(['one', 'two', 'three'], lines)
21911
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
85 let lines = readfile('XReadfile_bin', '', 2)
15468
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
86 call assert_equal(['one', 'two'], lines)
21911
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
87 let lines = readfile('XReadfile_bin', 'b')
15468
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
88 call assert_equal(["one\r", "two\r", "three\r", ""], lines)
21911
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
89 let lines = readfile('XReadfile_bin', 'b', 2)
15468
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
90 call assert_equal(["one\r", "two\r"], lines)
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
91
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
92 bwipe!
21911
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
93 call delete('XReadfile_bin')
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
94 endfunc
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
95
27082
360a6a1ca9dd patch 8.2.4070: using uninitialized memory when reading empty file
Bram Moolenaar <Bram@vim.org>
parents: 25495
diff changeset
96 func Test_readfile_binary_empty()
360a6a1ca9dd patch 8.2.4070: using uninitialized memory when reading empty file
Bram Moolenaar <Bram@vim.org>
parents: 25495
diff changeset
97 call writefile([], 'Xempty-file')
360a6a1ca9dd patch 8.2.4070: using uninitialized memory when reading empty file
Bram Moolenaar <Bram@vim.org>
parents: 25495
diff changeset
98 " This used to compare uninitialized memory in Vim <= 8.2.4065
360a6a1ca9dd patch 8.2.4070: using uninitialized memory when reading empty file
Bram Moolenaar <Bram@vim.org>
parents: 25495
diff changeset
99 call assert_equal([''], readfile('Xempty-file', 'b'))
360a6a1ca9dd patch 8.2.4070: using uninitialized memory when reading empty file
Bram Moolenaar <Bram@vim.org>
parents: 25495
diff changeset
100 call delete('Xempty-file')
360a6a1ca9dd patch 8.2.4070: using uninitialized memory when reading empty file
Bram Moolenaar <Bram@vim.org>
parents: 25495
diff changeset
101 endfunc
360a6a1ca9dd patch 8.2.4070: using uninitialized memory when reading empty file
Bram Moolenaar <Bram@vim.org>
parents: 25495
diff changeset
102
21911
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
103 func Test_readfile_bom()
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
104 call writefile(["\ufeffFOO", "FOO\ufeffBAR"], 'XReadfile_bom')
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
105 call assert_equal(['FOO', 'FOOBAR'], readfile('XReadfile_bom'))
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
106 call delete('XReadfile_bom')
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
107 endfunc
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
108
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
109 func Test_readfile_max()
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
110 call writefile(range(1, 4), 'XReadfile_max')
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
111 call assert_equal(['1', '2'], readfile('XReadfile_max', '', 2))
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
112 call assert_equal(['3', '4'], readfile('XReadfile_max', '', -2))
0c0e8cd8c177 patch 8.2.1505: not all file read and writecode is tested
Bram Moolenaar <Bram@vim.org>
parents: 21658
diff changeset
113 call delete('XReadfile_max')
15468
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
114 endfunc
15593
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
115
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
116 func Test_let_errmsg()
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
117 call assert_fails('let v:errmsg = []', 'E730:')
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
118 let v:errmsg = ''
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
119 call assert_fails('let v:errmsg = []', 'E730:')
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
120 let v:errmsg = ''
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
121 endfunc
16219
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
122
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
123 func Test_string_concatenation()
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
124 call assert_equal('ab', 'a'.'b')
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
125 call assert_equal('ab', 'a' .'b')
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
126 call assert_equal('ab', 'a'. 'b')
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
127 call assert_equal('ab', 'a' . 'b')
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
128
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
129 call assert_equal('ab', 'a'..'b')
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
130 call assert_equal('ab', 'a' ..'b')
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
131 call assert_equal('ab', 'a'.. 'b')
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
132 call assert_equal('ab', 'a' .. 'b')
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
133
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
134 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
135 let b = 'b'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
136 let a .= b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
137 call assert_equal('ab', a)
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
138
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
139 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
140 let a.=b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
141 call assert_equal('ab', a)
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
142
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
143 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
144 let a ..= b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
145 call assert_equal('ab', a)
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
146
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
147 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
148 let a..=b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
149 call assert_equal('ab', a)
21949
e6608764248a patch 8.2.1524: no longer get an error for string concatenation with float
Bram Moolenaar <Bram@vim.org>
parents: 21911
diff changeset
150
e6608764248a patch 8.2.1524: no longer get an error for string concatenation with float
Bram Moolenaar <Bram@vim.org>
parents: 21911
diff changeset
151 if has('float')
e6608764248a patch 8.2.1524: no longer get an error for string concatenation with float
Bram Moolenaar <Bram@vim.org>
parents: 21911
diff changeset
152 let a = 'A'
e6608764248a patch 8.2.1524: no longer get an error for string concatenation with float
Bram Moolenaar <Bram@vim.org>
parents: 21911
diff changeset
153 let b = 1.234
24822
5f8dd7b3ae41 patch 8.2.2949: tests failing because no error for float to string conversion
Bram Moolenaar <Bram@vim.org>
parents: 24236
diff changeset
154 call assert_equal('A1.234', a .. b)
21949
e6608764248a patch 8.2.1524: no longer get an error for string concatenation with float
Bram Moolenaar <Bram@vim.org>
parents: 21911
diff changeset
155 endif
16219
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
156 endfunc
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
157
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
158 " Test fix for issue #4507
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
159 func Test_skip_after_throw()
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
160 try
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
161 throw 'something'
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
162 let x = wincol() || &ts
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
163 catch /something/
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
164 endtry
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
165 endfunc
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
166
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
167 scriptversion 2
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
168 func Test_string_concat_scriptversion2()
16370
235a2b941498 patch 8.1.1190: has('vimscript-3') does not work
Bram Moolenaar <Bram@vim.org>
parents: 16366
diff changeset
169 call assert_true(has('vimscript-2'))
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
170 let a = 'a'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
171 let b = 'b'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
172
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
173 call assert_fails('echo a . b', 'E15:')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
174 call assert_fails('let a .= b', 'E985:')
24958
21ec48d542a8 patch 8.2.3016: confusing error when expression is followed by comma
Bram Moolenaar <Bram@vim.org>
parents: 24822
diff changeset
175 call assert_fails('let vers = 1.2.3', 'E488:')
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
176
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
177 if has('float')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
178 let f = .5
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
179 call assert_equal(0.5, f)
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
180 endif
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
181 endfunc
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
182
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
183 scriptversion 1
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
184 func Test_string_concat_scriptversion1()
16370
235a2b941498 patch 8.1.1190: has('vimscript-3') does not work
Bram Moolenaar <Bram@vim.org>
parents: 16366
diff changeset
185 call assert_true(has('vimscript-1'))
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
186 let a = 'a'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
187 let b = 'b'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
188
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
189 echo a . b
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
190 let a .= b
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
191 let vers = 1.2.3
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
192 call assert_equal('123', vers)
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
193
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
194 if has('float')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
195 call assert_fails('let f = .5', 'E15:')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
196 endif
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
197 endfunc
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
198
16366
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
199 scriptversion 3
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
200 func Test_vvar_scriptversion3()
16370
235a2b941498 patch 8.1.1190: has('vimscript-3') does not work
Bram Moolenaar <Bram@vim.org>
parents: 16366
diff changeset
201 call assert_true(has('vimscript-3'))
16366
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
202 call assert_fails('echo version', 'E121:')
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
203 call assert_false(exists('version'))
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
204 let version = 1
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
205 call assert_equal(1, version)
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
206 endfunc
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
207
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
208 scriptversion 2
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
209 func Test_vvar_scriptversion2()
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
210 call assert_true(exists('version'))
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
211 echo version
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
212 call assert_fails('let version = 1', 'E46:')
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
213 call assert_equal(v:version, version)
17053
d5fa04016df0 patch 8.1.1526: no numerical value for the patchlevel
Bram Moolenaar <Bram@vim.org>
parents: 16982
diff changeset
214
d5fa04016df0 patch 8.1.1526: no numerical value for the patchlevel
Bram Moolenaar <Bram@vim.org>
parents: 16982
diff changeset
215 call assert_equal(v:version, v:versionlong / 10000)
d5fa04016df0 patch 8.1.1526: no numerical value for the patchlevel
Bram Moolenaar <Bram@vim.org>
parents: 16982
diff changeset
216 call assert_true(v:versionlong > 8011525)
16366
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
217 endfunc
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
218
17448
f8cd16838434 patch 8.1.1722: error when scriptversion is 2 a making a dictionary access
Bram Moolenaar <Bram@vim.org>
parents: 17053
diff changeset
219 func Test_dict_access_scriptversion2()
f8cd16838434 patch 8.1.1722: error when scriptversion is 2 a making a dictionary access
Bram Moolenaar <Bram@vim.org>
parents: 17053
diff changeset
220 let l:x = {'foo': 1}
f8cd16838434 patch 8.1.1722: error when scriptversion is 2 a making a dictionary access
Bram Moolenaar <Bram@vim.org>
parents: 17053
diff changeset
221
f8cd16838434 patch 8.1.1722: error when scriptversion is 2 a making a dictionary access
Bram Moolenaar <Bram@vim.org>
parents: 17053
diff changeset
222 call assert_false(0 && l:x.foo)
f8cd16838434 patch 8.1.1722: error when scriptversion is 2 a making a dictionary access
Bram Moolenaar <Bram@vim.org>
parents: 17053
diff changeset
223 call assert_true(1 && l:x.foo)
f8cd16838434 patch 8.1.1722: error when scriptversion is 2 a making a dictionary access
Bram Moolenaar <Bram@vim.org>
parents: 17053
diff changeset
224 endfunc
f8cd16838434 patch 8.1.1722: error when scriptversion is 2 a making a dictionary access
Bram Moolenaar <Bram@vim.org>
parents: 17053
diff changeset
225
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
226 scriptversion 4
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
227 func Test_vvar_scriptversion4()
18086
9d6832a5426f patch 8.1.2038: has('vimscript-4') is always 0
Bram Moolenaar <Bram@vim.org>
parents: 18080
diff changeset
228 call assert_true(has('vimscript-4'))
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
229 call assert_equal(17, 017)
20665
6ff992bf4c82 patch 8.2.0886: cannot use octal numbers in scriptversion 4
Bram Moolenaar <Bram@vim.org>
parents: 20211
diff changeset
230 call assert_equal(15, 0o17)
6ff992bf4c82 patch 8.2.0886: cannot use octal numbers in scriptversion 4
Bram Moolenaar <Bram@vim.org>
parents: 20211
diff changeset
231 call assert_equal(15, 0O17)
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
232 call assert_equal(18, 018)
23533
ee43d943c3bb patch 8.2.2309: 0o777 not recognized as octal
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
233 call assert_equal(511, 0o777)
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
234 call assert_equal(64, 0b1'00'00'00)
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
235 call assert_equal(1048576, 0x10'00'00)
20665
6ff992bf4c82 patch 8.2.0886: cannot use octal numbers in scriptversion 4
Bram Moolenaar <Bram@vim.org>
parents: 20211
diff changeset
236 call assert_equal(32768, 0o10'00'00)
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
237 call assert_equal(1000000, 1'000'000)
18096
609b351cb58f patch 8.1.2043: not sufficient testing for quoted numbers
Bram Moolenaar <Bram@vim.org>
parents: 18086
diff changeset
238 call assert_equal("1234", execute("echo 1'234")->trim())
609b351cb58f patch 8.1.2043: not sufficient testing for quoted numbers
Bram Moolenaar <Bram@vim.org>
parents: 18086
diff changeset
239 call assert_equal('1 234', execute("echo 1''234")->trim())
609b351cb58f patch 8.1.2043: not sufficient testing for quoted numbers
Bram Moolenaar <Bram@vim.org>
parents: 18086
diff changeset
240 call assert_fails("echo 1'''234", 'E115:')
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
241 endfunc
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
242
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
243 scriptversion 1
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
244 func Test_vvar_scriptversion1()
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
245 call assert_equal(15, 017)
20665
6ff992bf4c82 patch 8.2.0886: cannot use octal numbers in scriptversion 4
Bram Moolenaar <Bram@vim.org>
parents: 20211
diff changeset
246 call assert_equal(15, 0o17)
6ff992bf4c82 patch 8.2.0886: cannot use octal numbers in scriptversion 4
Bram Moolenaar <Bram@vim.org>
parents: 20211
diff changeset
247 call assert_equal(15, 0O17)
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
248 call assert_equal(18, 018)
23533
ee43d943c3bb patch 8.2.2309: 0o777 not recognized as octal
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
249 call assert_equal(511, 0o777)
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
250 endfunc
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
251
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
252 func Test_scriptversion_fail()
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
253 call writefile(['scriptversion 9'], 'Xversionscript')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
254 call assert_fails('source Xversionscript', 'E999:')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
255 call delete('Xversionscript')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
256 endfunc
19087
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
257
20156
49694eceaa55 patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents: 20109
diff changeset
258 func Test_execute_cmd_with_null()
19087
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
259 call assert_fails('execute test_null_list()', 'E730:')
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
260 call assert_fails('execute test_null_dict()', 'E731:')
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
261 call assert_fails('execute test_null_blob()', 'E976:')
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
262 execute test_null_string()
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
263 call assert_fails('execute test_null_partial()', 'E729:')
20158
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20156
diff changeset
264 call assert_fails('execute test_unknown()', 'E908:')
19087
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
265 if has('job')
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
266 call assert_fails('execute test_null_job()', 'E908:')
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
267 call assert_fails('execute test_null_channel()', 'E908:')
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
268 endif
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
269 endfunc
19477
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
270
23693
cd06cc37f53f patch 8.2.2388: no easy way to get the maximum or mininum number value
Bram Moolenaar <Bram@vim.org>
parents: 23533
diff changeset
271 func Test_number_max_min_size()
cd06cc37f53f patch 8.2.2388: no easy way to get the maximum or mininum number value
Bram Moolenaar <Bram@vim.org>
parents: 23533
diff changeset
272 " This will fail on systems without 64 bit number support or when not
cd06cc37f53f patch 8.2.2388: no easy way to get the maximum or mininum number value
Bram Moolenaar <Bram@vim.org>
parents: 23533
diff changeset
273 " configured correctly.
19477
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
274 call assert_equal(64, v:numbersize)
23693
cd06cc37f53f patch 8.2.2388: no easy way to get the maximum or mininum number value
Bram Moolenaar <Bram@vim.org>
parents: 23533
diff changeset
275
cd06cc37f53f patch 8.2.2388: no easy way to get the maximum or mininum number value
Bram Moolenaar <Bram@vim.org>
parents: 23533
diff changeset
276 call assert_true(v:numbermin < -9999999)
cd06cc37f53f patch 8.2.2388: no easy way to get the maximum or mininum number value
Bram Moolenaar <Bram@vim.org>
parents: 23533
diff changeset
277 call assert_true(v:numbermax > 9999999)
19477
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
278 endfunc
19724
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19477
diff changeset
279
20083
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
280 func Assert_reg(name, type, value, valuestr, expr, exprstr)
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
281 call assert_equal(a:type, getregtype(a:name))
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
282 call assert_equal(a:value, getreg(a:name))
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
283 call assert_equal(a:valuestr, string(getreg(a:name, 0, 1)))
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
284 call assert_equal(a:expr, getreg(a:name, 1))
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
285 call assert_equal(a:exprstr, string(getreg(a:name, 1, 1)))
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
286 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
287
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
288 func Test_let_register()
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
289 let @" = 'abc'
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
290 call Assert_reg('"', 'v', "abc", "['abc']", "abc", "['abc']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
291 let @" = "abc\n"
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
292 call Assert_reg('"', 'V', "abc\n", "['abc']", "abc\n", "['abc']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
293 let @" = "abc\<C-m>"
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
294 call Assert_reg('"', 'V', "abc\r\n", "['abc\r']", "abc\r\n", "['abc\r']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
295 let @= = '"abc"'
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
296 call Assert_reg('=', 'v', "abc", "['abc']", '"abc"', "['\"abc\"']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
297 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
298
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
299 func Assert_regput(name, result)
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
300 new
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
301 execute "silent normal! o==\n==\e\"" . a:name . "P"
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
302 call assert_equal(a:result, getline(2, line('$')))
20085
f5274405ae64 patch 8.2.0598: test_eval_stuff fails in normal terminal
Bram Moolenaar <Bram@vim.org>
parents: 20083
diff changeset
303 bwipe!
20083
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
304 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
305
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
306 func Test_setreg_basic()
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
307 call setreg('a', 'abcA', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
308 call Assert_reg('a', 'v', "abcA", "['abcA']", "abcA", "['abcA']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
309 call Assert_regput('a', ['==', '=abcA='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
310
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
311 call setreg('A', 'abcAc', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
312 call Assert_reg('A', 'v', "abcAabcAc", "['abcAabcAc']", "abcAabcAc", "['abcAabcAc']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
313 call Assert_regput('a', ['==', '=abcAabcAc='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
314
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
315 call setreg('A', 'abcAl', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
316 call Assert_reg('A', 'V', "abcAabcAcabcAl\n", "['abcAabcAcabcAl']", "abcAabcAcabcAl\n", "['abcAabcAcabcAl']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
317 call Assert_regput('a', ['==', 'abcAabcAcabcAl', '=='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
318
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
319 call setreg('A', 'abcAc2','c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
320 call Assert_reg('A', 'v', "abcAabcAcabcAl\nabcAc2", "['abcAabcAcabcAl', 'abcAc2']", "abcAabcAcabcAl\nabcAc2", "['abcAabcAcabcAl', 'abcAc2']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
321 call Assert_regput('a', ['==', '=abcAabcAcabcAl', 'abcAc2='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
322
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
323 call setreg('b', 'abcB', 'v')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
324 call Assert_reg('b', 'v', "abcB", "['abcB']", "abcB", "['abcB']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
325 call Assert_regput('b', ['==', '=abcB='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
326
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
327 call setreg('b', 'abcBc', 'ca')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
328 call Assert_reg('b', 'v', "abcBabcBc", "['abcBabcBc']", "abcBabcBc", "['abcBabcBc']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
329 call Assert_regput('b', ['==', '=abcBabcBc='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
330
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
331 call setreg('b', 'abcBb', 'ba')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
332 call Assert_reg('b', "\<C-V>5", "abcBabcBcabcBb", "['abcBabcBcabcBb']", "abcBabcBcabcBb", "['abcBabcBcabcBb']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
333 call Assert_regput('b', ['==', '=abcBabcBcabcBb='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
334
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
335 call setreg('b', 'abcBc2','ca')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
336 call Assert_reg('b', "v", "abcBabcBcabcBb\nabcBc2", "['abcBabcBcabcBb', 'abcBc2']", "abcBabcBcabcBb\nabcBc2", "['abcBabcBcabcBb', 'abcBc2']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
337 call Assert_regput('b', ['==', '=abcBabcBcabcBb', 'abcBc2='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
338
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
339 call setreg('b', 'abcBb2','b50a')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
340 call Assert_reg('b', "\<C-V>50", "abcBabcBcabcBb\nabcBc2abcBb2", "['abcBabcBcabcBb', 'abcBc2abcBb2']", "abcBabcBcabcBb\nabcBc2abcBb2", "['abcBabcBcabcBb', 'abcBc2abcBb2']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
341 call Assert_regput('b', ['==', '=abcBabcBcabcBb =', ' abcBc2abcBb2'])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
342
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
343 call setreg('c', 'abcC', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
344 call Assert_reg('c', 'V', "abcC\n", "['abcC']", "abcC\n", "['abcC']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
345 call Assert_regput('c', ['==', 'abcC', '=='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
346
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
347 call setreg('C', 'abcCl', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
348 call Assert_reg('C', 'V', "abcC\nabcCl\n", "['abcC', 'abcCl']", "abcC\nabcCl\n", "['abcC', 'abcCl']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
349 call Assert_regput('c', ['==', 'abcC', 'abcCl', '=='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
350
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
351 call setreg('C', 'abcCc', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
352 call Assert_reg('C', 'v', "abcC\nabcCl\nabcCc", "['abcC', 'abcCl', 'abcCc']", "abcC\nabcCl\nabcCc", "['abcC', 'abcCl', 'abcCc']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
353 call Assert_regput('c', ['==', '=abcC', 'abcCl', 'abcCc='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
354
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
355 call setreg('d', 'abcD', 'V')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
356 call Assert_reg('d', 'V', "abcD\n", "['abcD']", "abcD\n", "['abcD']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
357 call Assert_regput('d', ['==', 'abcD', '=='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
358
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
359 call setreg('D', 'abcDb', 'b')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
360 call Assert_reg('d', "\<C-V>5", "abcD\nabcDb", "['abcD', 'abcDb']", "abcD\nabcDb", "['abcD', 'abcDb']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
361 call Assert_regput('d', ['==', '=abcD =', ' abcDb'])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
362
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
363 call setreg('e', 'abcE', 'b')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
364 call Assert_reg('e', "\<C-V>4", "abcE", "['abcE']", "abcE", "['abcE']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
365 call Assert_regput('e', ['==', '=abcE='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
366
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
367 call setreg('E', 'abcEb', 'b')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
368 call Assert_reg('E', "\<C-V>5", "abcE\nabcEb", "['abcE', 'abcEb']", "abcE\nabcEb", "['abcE', 'abcEb']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
369 call Assert_regput('e', ['==', '=abcE =', ' abcEb'])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
370
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
371 call setreg('E', 'abcEl', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
372 call Assert_reg('E', "V", "abcE\nabcEb\nabcEl\n", "['abcE', 'abcEb', 'abcEl']", "abcE\nabcEb\nabcEl\n", "['abcE', 'abcEb', 'abcEl']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
373 call Assert_regput('e', ['==', 'abcE', 'abcEb', 'abcEl', '=='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
374
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
375 call setreg('f', 'abcF', "\<C-v>")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
376 call Assert_reg('f', "\<C-V>4", "abcF", "['abcF']", "abcF", "['abcF']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
377 call Assert_regput('f', ['==', '=abcF='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
378
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
379 call setreg('F', 'abcFc', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
380 call Assert_reg('F', "v", "abcF\nabcFc", "['abcF', 'abcFc']", "abcF\nabcFc", "['abcF', 'abcFc']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
381 call Assert_regput('f', ['==', '=abcF', 'abcFc='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
382
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
383 call setreg('g', 'abcG', 'b10')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
384 call Assert_reg('g', "\<C-V>10", "abcG", "['abcG']", "abcG", "['abcG']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
385 call Assert_regput('g', ['==', '=abcG ='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
386
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
387 call setreg('h', 'abcH', "\<C-v>10")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
388 call Assert_reg('h', "\<C-V>10", "abcH", "['abcH']", "abcH", "['abcH']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
389 call Assert_regput('h', ['==', '=abcH ='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
390
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
391 call setreg('I', 'abcI')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
392 call Assert_reg('I', "v", "abcI", "['abcI']", "abcI", "['abcI']")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
393 call Assert_regput('I', ['==', '=abcI='])
20109
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
394
20211
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
395 " Appending NL with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
396 call setreg('a', 'abcA2', 'c')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
397 call setreg('b', 'abcB2', 'v')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
398 call setreg('c', 'abcC2', 'l')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
399 call setreg('d', 'abcD2', 'V')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
400 call setreg('e', 'abcE2', 'b')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
401 call setreg('f', 'abcF2', "\<C-v>")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
402 call setreg('g', 'abcG2', 'b10')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
403 call setreg('h', 'abcH2', "\<C-v>10")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
404 call setreg('I', 'abcI2')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
405
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
406 call setreg('A', "\n")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
407 call Assert_reg('A', 'V', "abcA2\n", "['abcA2']", "abcA2\n", "['abcA2']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
408 call Assert_regput('A', ['==', 'abcA2', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
409
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
410 call setreg('B', "\n", 'c')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
411 call Assert_reg('B', 'v', "abcB2\n", "['abcB2', '']", "abcB2\n", "['abcB2', '']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
412 call Assert_regput('B', ['==', '=abcB2', '='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
413
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
414 call setreg('C', "\n")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
415 call Assert_reg('C', 'V', "abcC2\n\n", "['abcC2', '']", "abcC2\n\n", "['abcC2', '']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
416 call Assert_regput('C', ['==', 'abcC2', '', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
417
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
418 call setreg('D', "\n", 'l')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
419 call Assert_reg('D', 'V', "abcD2\n\n", "['abcD2', '']", "abcD2\n\n", "['abcD2', '']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
420 call Assert_regput('D', ['==', 'abcD2', '', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
421
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
422 call setreg('E', "\n")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
423 call Assert_reg('E', 'V', "abcE2\n\n", "['abcE2', '']", "abcE2\n\n", "['abcE2', '']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
424 call Assert_regput('E', ['==', 'abcE2', '', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
425
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
426 call setreg('F', "\n", 'b')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
427 call Assert_reg('F', "\<C-V>0", "abcF2\n", "['abcF2', '']", "abcF2\n", "['abcF2', '']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
428 call Assert_regput('F', ['==', '=abcF2=', ' '])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
429
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
430 " Setting lists with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
431 call setreg('a', ['abcA3'], 'c')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
432 call Assert_reg('a', 'v', "abcA3", "['abcA3']", "abcA3", "['abcA3']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
433 call Assert_regput('a', ['==', '=abcA3='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
434
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
435 call setreg('b', ['abcB3'], 'l')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
436 call Assert_reg('b', 'V', "abcB3\n", "['abcB3']", "abcB3\n", "['abcB3']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
437 call Assert_regput('b', ['==', 'abcB3', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
438
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
439 call setreg('c', ['abcC3'], 'b')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
440 call Assert_reg('c', "\<C-V>5", "abcC3", "['abcC3']", "abcC3", "['abcC3']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
441 call Assert_regput('c', ['==', '=abcC3='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
442
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
443 call setreg('d', ['abcD3'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
444 call Assert_reg('d', 'V', "abcD3\n", "['abcD3']", "abcD3\n", "['abcD3']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
445 call Assert_regput('d', ['==', 'abcD3', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
446
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
447 call setreg('e', [1, 2, 'abc', 3])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
448 call Assert_reg('e', 'V', "1\n2\nabc\n3\n", "['1', '2', 'abc', '3']", "1\n2\nabc\n3\n", "['1', '2', 'abc', '3']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
449 call Assert_regput('e', ['==', '1', '2', 'abc', '3', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
450
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
451 call setreg('f', [1, 2, 3])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
452 call Assert_reg('f', 'V', "1\n2\n3\n", "['1', '2', '3']", "1\n2\n3\n", "['1', '2', '3']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
453 call Assert_regput('f', ['==', '1', '2', '3', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
454
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
455 " Appending lists with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
456 call setreg('A', ['abcA3c'], 'c')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
457 call Assert_reg('A', 'v', "abcA3\nabcA3c", "['abcA3', 'abcA3c']", "abcA3\nabcA3c", "['abcA3', 'abcA3c']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
458 call Assert_regput('A', ['==', '=abcA3', 'abcA3c='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
459
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
460 call setreg('b', ['abcB3l'], 'la')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
461 call Assert_reg('b', 'V', "abcB3\nabcB3l\n", "['abcB3', 'abcB3l']", "abcB3\nabcB3l\n", "['abcB3', 'abcB3l']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
462 call Assert_regput('b', ['==', 'abcB3', 'abcB3l', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
463
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
464 call setreg('C', ['abcC3b'], 'lb')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
465 call Assert_reg('C', "\<C-V>6", "abcC3\nabcC3b", "['abcC3', 'abcC3b']", "abcC3\nabcC3b", "['abcC3', 'abcC3b']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
466 call Assert_regput('C', ['==', '=abcC3 =', ' abcC3b'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
467
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
468 call setreg('D', ['abcD32'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
469 call Assert_reg('D', 'V', "abcD3\nabcD32\n", "['abcD3', 'abcD32']", "abcD3\nabcD32\n", "['abcD3', 'abcD32']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
470 call Assert_regput('D', ['==', 'abcD3', 'abcD32', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
471
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
472 call setreg('A', ['abcA32'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
473 call Assert_reg('A', 'V', "abcA3\nabcA3c\nabcA32\n", "['abcA3', 'abcA3c', 'abcA32']", "abcA3\nabcA3c\nabcA32\n", "['abcA3', 'abcA3c', 'abcA32']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
474 call Assert_regput('A', ['==', 'abcA3', 'abcA3c', 'abcA32', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
475
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
476 call setreg('B', ['abcB3c'], 'c')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
477 call Assert_reg('B', 'v', "abcB3\nabcB3l\nabcB3c", "['abcB3', 'abcB3l', 'abcB3c']", "abcB3\nabcB3l\nabcB3c", "['abcB3', 'abcB3l', 'abcB3c']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
478 call Assert_regput('B', ['==', '=abcB3', 'abcB3l', 'abcB3c='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
479
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
480 call setreg('C', ['abcC3l'], 'l')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
481 call Assert_reg('C', 'V', "abcC3\nabcC3b\nabcC3l\n", "['abcC3', 'abcC3b', 'abcC3l']", "abcC3\nabcC3b\nabcC3l\n", "['abcC3', 'abcC3b', 'abcC3l']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
482 call Assert_regput('C', ['==', 'abcC3', 'abcC3b', 'abcC3l', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
483
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
484 call setreg('D', ['abcD3b'], 'b')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
485 call Assert_reg('D', "\<C-V>6", "abcD3\nabcD32\nabcD3b", "['abcD3', 'abcD32', 'abcD3b']", "abcD3\nabcD32\nabcD3b", "['abcD3', 'abcD32', 'abcD3b']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
486 call Assert_regput('D', ['==', '=abcD3 =', ' abcD32', ' abcD3b'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
487
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
488 " Appending lists with NL with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
489 call setreg('A', ["\n", 'abcA3l2'], 'l')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
490 call Assert_reg('A', "V", "abcA3\nabcA3c\nabcA32\n\n\nabcA3l2\n", "['abcA3', 'abcA3c', 'abcA32', '\n', 'abcA3l2']", "abcA3\nabcA3c\nabcA32\n\n\nabcA3l2\n", "['abcA3', 'abcA3c', 'abcA32', '\n', 'abcA3l2']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
491 call Assert_regput('A', ['==', 'abcA3', 'abcA3c', 'abcA32', "\n", 'abcA3l2', '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
492
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
493 call setreg('B', ["\n", 'abcB3c2'], 'c')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
494 call Assert_reg('B', "v", "abcB3\nabcB3l\nabcB3c\n\n\nabcB3c2", "['abcB3', 'abcB3l', 'abcB3c', '\n', 'abcB3c2']", "abcB3\nabcB3l\nabcB3c\n\n\nabcB3c2", "['abcB3', 'abcB3l', 'abcB3c', '\n', 'abcB3c2']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
495 call Assert_regput('B', ['==', '=abcB3', 'abcB3l', 'abcB3c', "\n", 'abcB3c2='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
496
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
497 call setreg('C', ["\n", 'abcC3b2'], 'b')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
498 call Assert_reg('C', "7", "abcC3\nabcC3b\nabcC3l\n\n\nabcC3b2", "['abcC3', 'abcC3b', 'abcC3l', '\n', 'abcC3b2']", "abcC3\nabcC3b\nabcC3l\n\n\nabcC3b2", "['abcC3', 'abcC3b', 'abcC3l', '\n', 'abcC3b2']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
499 call Assert_regput('C', ['==', '=abcC3 =', ' abcC3b', ' abcC3l', " \n", ' abcC3b2'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
500
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
501 call setreg('D', ["\n", 'abcD3b50'],'b50')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
502 call Assert_reg('D', "50", "abcD3\nabcD32\nabcD3b\n\n\nabcD3b50", "['abcD3', 'abcD32', 'abcD3b', '\n', 'abcD3b50']", "abcD3\nabcD32\nabcD3b\n\n\nabcD3b50", "['abcD3', 'abcD32', 'abcD3b', '\n', 'abcD3b50']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
503 call Assert_regput('D', ['==', '=abcD3 =', ' abcD32', ' abcD3b', " \n", ' abcD3b50'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
504
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
505 " Setting lists with NLs with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
506 call setreg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
507 call Assert_reg('a', "V", "abcA4-0\n\n\nabcA4-2\n\n\nabcA4-3\nabcA4-4\nabcA4-4-2\n", "['abcA4-0', '\n', 'abcA4-2\n', '\nabcA4-3', 'abcA4-4\nabcA4-4-2']", "abcA4-0\n\n\nabcA4-2\n\n\nabcA4-3\nabcA4-4\nabcA4-4-2\n", "['abcA4-0', '\n', 'abcA4-2\n', '\nabcA4-3', 'abcA4-4\nabcA4-4-2']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
508 call Assert_regput('a', ['==', 'abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2", '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
509
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
510 call setreg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
511 call Assert_reg('b', "v", "abcB4c-0\n\n\nabcB4c-2\n\n\nabcB4c-3\nabcB4c-4\nabcB4c-4-2", "['abcB4c-0', '\n', 'abcB4c-2\n', '\nabcB4c-3', 'abcB4c-4\nabcB4c-4-2']", "abcB4c-0\n\n\nabcB4c-2\n\n\nabcB4c-3\nabcB4c-4\nabcB4c-4-2", "['abcB4c-0', '\n', 'abcB4c-2\n', '\nabcB4c-3', 'abcB4c-4\nabcB4c-4-2']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
512 call Assert_regput('b', ['==', '=abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2="])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
513
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
514 call setreg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
515 call Assert_reg('c', "V", "abcC4l-0\n\n\nabcC4l-2\n\n\nabcC4l-3\nabcC4l-4\nabcC4l-4-2\n", "['abcC4l-0', '\n', 'abcC4l-2\n', '\nabcC4l-3', 'abcC4l-4\nabcC4l-4-2']", "abcC4l-0\n\n\nabcC4l-2\n\n\nabcC4l-3\nabcC4l-4\nabcC4l-4-2\n", "['abcC4l-0', '\n', 'abcC4l-2\n', '\nabcC4l-3', 'abcC4l-4\nabcC4l-4-2']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
516 call Assert_regput('c', ['==', 'abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2", '=='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
517
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
518 call setreg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
519 call Assert_reg('d', "19", "abcD4b-0\n\n\nabcD4b-2\n\n\nabcD4b-3\nabcD4b-4\nabcD4b-4-2", "['abcD4b-0', '\n', 'abcD4b-2\n', '\nabcD4b-3', 'abcD4b-4\nabcD4b-4-2']", "abcD4b-0\n\n\nabcD4b-2\n\n\nabcD4b-3\nabcD4b-4\nabcD4b-4-2", "['abcD4b-0', '\n', 'abcD4b-2\n', '\nabcD4b-3', 'abcD4b-4\nabcD4b-4-2']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
520 call Assert_regput('d', ['==', '=abcD4b-0 =', " \n", " abcD4b-2\n", " \nabcD4b-3", " abcD4b-4\nabcD4b-4-2"])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
521
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
522 call setreg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
523 call Assert_reg('e', "10", "abcE4b10-0\n\n\nabcE4b10-2\n\n\nabcE4b10-3\nabcE4b10-4\nabcE4b10-4-2", "['abcE4b10-0', '\n', 'abcE4b10-2\n', '\nabcE4b10-3', 'abcE4b10-4\nabcE4b10-4-2']", "abcE4b10-0\n\n\nabcE4b10-2\n\n\nabcE4b10-3\nabcE4b10-4\nabcE4b10-4-2", "['abcE4b10-0', '\n', 'abcE4b10-2\n', '\nabcE4b10-3', 'abcE4b10-4\nabcE4b10-4-2']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
524 call Assert_regput('e', ['==', '=abcE4b10-0=', " \n", " abcE4b10-2\n", " \nabcE4b10-3", " abcE4b10-4\nabcE4b10-4-2"])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
525
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
526 " Search and expressions
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
527 call setreg('/', ['abc/'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
528 call Assert_reg('/', 'v', "abc/", "['abc/']", "abc/", "['abc/']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
529 call Assert_regput('/', ['==', '=abc/='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
530
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
531 call setreg('/', ["abc/\n"])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
532 call Assert_reg('/', 'v', "abc/\n", "['abc/\n']", "abc/\n", "['abc/\n']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
533 call Assert_regput('/', ['==', "=abc/\n="])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
534
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
535 call setreg('=', ['"abc/"'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
536 call Assert_reg('=', 'v', "abc/", "['abc/']", '"abc/"', "['\"abc/\"']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
537
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
538 call setreg('=', ["\"abc/\n\""])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
539 call Assert_reg('=', 'v', "abc/\n", "['abc/\n']", "\"abc/\n\"", "['\"abc/\n\"']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
540
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
541 " System clipboard
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
542 if has('clipboard')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
543 new | only!
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
544 call setline(1, ['clipboard contents', 'something else'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
545 " Save and restore system clipboard.
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
546 " If no connection to X-Server is possible, test should succeed.
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
547 let _clipreg = ['*', getreg('*'), getregtype('*')]
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
548 let _clipopt = &cb
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
549 let &cb='unnamed'
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
550 1y
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
551 call Assert_reg('*', 'V', "clipboard contents\n", "['clipboard contents']", "clipboard contents\n", "['clipboard contents']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
552 tabdo :windo :echo "hi"
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
553 2y
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
554 call Assert_reg('*', 'V', "something else\n", "['something else']", "something else\n", "['something else']")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
555 let &cb=_clipopt
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
556 call call('setreg', _clipreg)
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
557 enew!
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
558 endif
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
559
20109
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
560 " Error cases
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
561 call assert_fails('call setreg()', 'E119:')
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
562 call assert_fails('call setreg(1)', 'E119:')
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
563 call assert_fails('call setreg(1, 2, 3, 4)', 'E118:')
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
564 call assert_fails('call setreg([], 2)', 'E730:')
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
565 call assert_fails('call setreg(1, 2, [])', 'E730:')
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
566 call assert_fails('call setreg("/", ["1", "2"])', 'E883:')
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
567 call assert_fails('call setreg("=", ["1", "2"])', 'E883:')
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
568 call assert_fails('call setreg(1, ["", "", [], ""])', 'E730:')
20083
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
569 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
570
21658
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
571 func Test_curly_assignment()
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
572 let s:svar = 'svar'
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
573 let g:gvar = 'gvar'
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
574 let lname = 'gvar'
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
575 let gname = 'gvar'
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
576 let {'s:'.lname} = {'g:'.gname}
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
577 call assert_equal('gvar', s:gvar)
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
578 let s:gvar = ''
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
579 let { 's:'.lname } = { 'g:'.gname }
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
580 call assert_equal('gvar', s:gvar)
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
581 let s:gvar = ''
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
582 let { 's:' . lname } = { 'g:' . gname }
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
583 call assert_equal('gvar', s:gvar)
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
584 let s:gvar = ''
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
585 let { 's:' .. lname } = { 'g:' .. gname }
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
586 call assert_equal('gvar', s:gvar)
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
587
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
588 unlet s:svar
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
589 unlet s:gvar
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
590 unlet g:gvar
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
591 endfunc
140a9082f87c patch 8.2.1379: curly braces expression ending in " }" does not work
Bram Moolenaar <Bram@vim.org>
parents: 21267
diff changeset
592
27356
84682ad16c31 patch 8.2.4206: condition with many "(" causes a crash
Bram Moolenaar <Bram@vim.org>
parents: 27082
diff changeset
593 func Test_deep_recursion()
84682ad16c31 patch 8.2.4206: condition with many "(" causes a crash
Bram Moolenaar <Bram@vim.org>
parents: 27082
diff changeset
594 " this was running out of stack
84682ad16c31 patch 8.2.4206: condition with many "(" causes a crash
Bram Moolenaar <Bram@vim.org>
parents: 27082
diff changeset
595 call assert_fails("exe 'if ' .. repeat('(', 1002)", 'E1169: Expression too recursive: ((')
84682ad16c31 patch 8.2.4206: condition with many "(" causes a crash
Bram Moolenaar <Bram@vim.org>
parents: 27082
diff changeset
596 endfunc
84682ad16c31 patch 8.2.4206: condition with many "(" causes a crash
Bram Moolenaar <Bram@vim.org>
parents: 27082
diff changeset
597
28668
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
598 " K_SPECIAL in the modified character used be escaped, which causes
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
599 " double-escaping with feedkeys() or as the return value of an <expr> mapping,
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
600 " and doesn't match what getchar() returns,
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
601 func Test_modified_char_no_escape_special()
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
602 nnoremap <M-…> <Cmd>let g:got_m_ellipsis += 1<CR>
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
603 call feedkeys("\<M-…>", 't')
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
604 call assert_equal("\<M-…>", getchar())
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
605 let g:got_m_ellipsis = 0
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
606 call feedkeys("\<M-…>", 'xt')
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
607 call assert_equal(1, g:got_m_ellipsis)
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
608 func Func()
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
609 return "\<M-…>"
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
610 endfunc
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
611 nmap <expr> <F2> Func()
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
612 call feedkeys("\<F2>", 'xt')
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
613 call assert_equal(2, g:got_m_ellipsis)
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
614 delfunc Func
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
615 nunmap <F2>
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
616 unlet g:got_m_ellipsis
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
617 nunmap <M-…>
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
618 endfunc
53c608c7ea9e patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents: 27356
diff changeset
619
19724
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19477
diff changeset
620 " vim: shiftwidth=2 sts=2 expandtab