annotate src/testdir/test_eval_stuff.vim @ 20743:a672feb8fc4f v8.2.0924

patch 8.2.0924: cannot save and restore a register properly Commit: https://github.com/vim/vim/commit/bb861e293e0170455184079fa537278754b07911 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 7 18:16:36 2020 +0200 patch 8.2.0924: cannot save and restore a register properly Problem: Cannot save and restore a register properly. Solution: Add getreginfo() and make setreg() accept a dictionary. (Andy Massimino, closes #3370)
author Bram Moolenaar <Bram@vim.org>
date Sun, 07 Jun 2020 18:30:03 +0200
parents 6ff992bf4c82
children 7833afe1c66e
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
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 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
4 try
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 return [] == 0
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 catch
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 return 1
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 endtry
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 endfunction
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
30f9a62f5f51 patch 8.0.1423: error in return not caught by try/catch
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 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
12 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
13 endfunc
13288
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
14
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
15 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
16 silent! try
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
17 throw 1
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
18 catch
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
19 endtry
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
20 echoerr 'wrong'
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
21 let c1 = nr2char(screenchar(&lines, 1))
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
22 let c2 = nr2char(screenchar(&lines, 2))
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
23 let c3 = nr2char(screenchar(&lines, 3))
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
24 let c4 = nr2char(screenchar(&lines, 4))
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
25 let c5 = nr2char(screenchar(&lines, 5))
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
26 call assert_equal('wrong', c1 . c2 . c3 . c4 . c5)
530943a23d3f patch 8.0.1518: error messages suppressed after ":silent! try"
Christian Brabandt <cb@256bit.org>
parents: 13096
diff changeset
27 endfunc
13672
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
28
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
29 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
30 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
31 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
32 try
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
33 " 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
34 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
35 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
36 catch /E739:/
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
37 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
38 endtry
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
39 " '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
40 call writefile([], 'Xfile')
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
41 call assert_fails('call mkdir("Xfile", "p")', 'E739')
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
42 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
43 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
44 call assert_equal(0, mkdir(test_null_string()))
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20156
diff changeset
45 call assert_fails('call mkdir([])', 'E730')
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20156
diff changeset
46 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
47 endfunc
14714
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
48
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
49 func Test_line_continuation()
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
50 let array = [5,
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
51 "\ ignore this
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
52 \ 6,
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
53 "\ more to ignore
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
54 "\ more moreto ignore
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
55 \ ]
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
56 "\ and some more
bdbb049c2aa8 patch 8.1.0369: continuation lines cannot contain comments
Christian Brabandt <cb@256bit.org>
parents: 13672
diff changeset
57 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
58 endfunc
15107
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
59
6344377dc7dc patch 8.1.0564: setting v:errors to wrong type still possible
Bram Moolenaar <Bram@vim.org>
parents: 14714
diff changeset
60 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
61 " 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
62 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
63 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
64 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
65 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
66 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
67 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
68 endfunc
15456
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
69
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
70 func Test_for_invalid()
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
71 call assert_fails("for x in 99", 'E714:')
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
72 call assert_fails("for x in 'asdf'", 'E714:')
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
73 call assert_fails("for x in {'a': 9}", 'E714:')
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
74 endfunc
15468
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
75
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
76 func Test_readfile_binary()
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
77 new
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
78 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
79 setlocal ff=dos
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
80 silent write XReadfile
17982
2029737e6a22 patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17448
diff changeset
81 let lines = 'XReadfile'->readfile()
15468
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
82 call assert_equal(['one', 'two', 'three'], lines)
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
83 let lines = readfile('XReadfile', '', 2)
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'], lines)
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
85 let lines = readfile('XReadfile', 'b')
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\r", "two\r", "three\r", ""], lines)
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
87 let lines = readfile('XReadfile', 'b', 2)
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"], lines)
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
89
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
90 bwipe!
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
91 call delete('XReadfile')
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
92 endfunc
15593
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
93
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
94 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
95 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
96 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
97 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
98 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
99 endfunc
16219
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
100
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
101 func Test_string_concatenation()
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
102 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
103 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
104 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
105 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
106
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
107 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
108 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
109 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
110 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
111
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
112 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
113 let b = 'b'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
114 let a .= b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
115 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
116
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
117 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
118 let a.=b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
119 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
120
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
121 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
122 let a ..= b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
123 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
124
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
125 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
126 let 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)
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
128 endfunc
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
129
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
130 " Test fix for issue #4507
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
131 func Test_skip_after_throw()
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
132 try
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
133 throw 'something'
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
134 let x = wincol() || &ts
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
135 catch /something/
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
136 endtry
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
137 endfunc
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
138
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
139 scriptversion 2
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
140 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
141 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
142 let a = 'a'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
143 let b = 'b'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
144
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
145 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
146 call assert_fails('let a .= b', 'E985:')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
147 call assert_fails('let vers = 1.2.3', 'E15:')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
148
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
149 if has('float')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
150 let f = .5
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
151 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
152 endif
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
153 endfunc
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
154
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
155 scriptversion 1
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
156 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
157 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
158 let a = 'a'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
159 let b = 'b'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
160
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
161 echo a . b
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
162 let a .= b
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
163 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
164 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
165
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
166 if has('float')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
167 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
168 endif
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
169 endfunc
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
170
16366
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
171 scriptversion 3
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
172 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
173 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
174 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
175 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
176 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
177 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
178 endfunc
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
179
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
180 scriptversion 2
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
181 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
182 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
183 echo version
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
184 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
185 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
186
d5fa04016df0 patch 8.1.1526: no numerical value for the patchlevel
Bram Moolenaar <Bram@vim.org>
parents: 16982
diff changeset
187 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
188 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
189 endfunc
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
190
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
191 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
192 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
193
f8cd16838434 patch 8.1.1722: error when scriptversion is 2 a making a dictionary access
Bram Moolenaar <Bram@vim.org>
parents: 17053
diff changeset
194 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
195 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
196 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
197
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
198 scriptversion 4
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
199 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
200 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
201 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
202 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
203 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
204 call assert_equal(18, 018)
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
205 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
206 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
207 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
208 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
209 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
210 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
211 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
212 endfunc
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
213
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
214 scriptversion 1
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
215 func Test_vvar_scriptversion1()
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
216 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
217 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
218 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
219 call assert_equal(18, 018)
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
220 endfunc
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
221
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
222 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
223 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
224 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
225 call delete('Xversionscript')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
226 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
227
20156
49694eceaa55 patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents: 20109
diff changeset
228 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
229 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
230 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
231 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
232 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
233 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
234 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
235 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
236 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
237 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
238 endif
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
239 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
240
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
241 func Test_numbersize()
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
242 " This will fail on systems without 64 bit int support or when not configured
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
243 " correctly.
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
244 call assert_equal(64, v:numbersize)
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
245 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
246
20083
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
247 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
248 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
249 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
250 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
251 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
252 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
253 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
254
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
255 func Test_let_register()
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
256 let @" = 'abc'
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
257 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
258 let @" = "abc\n"
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
259 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
260 let @" = "abc\<C-m>"
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
261 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
262 let @= = '"abc"'
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
263 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
264 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
265
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
266 func Assert_regput(name, result)
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
267 new
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
268 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
269 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
270 bwipe!
20083
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
271 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
272
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
273 func Test_setreg_basic()
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
274 call setreg('a', 'abcA', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
275 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
276 call Assert_regput('a', ['==', '=abcA='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
277
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
278 call setreg('A', 'abcAc', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
279 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
280 call Assert_regput('a', ['==', '=abcAabcAc='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
281
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
282 call setreg('A', 'abcAl', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
283 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
284 call Assert_regput('a', ['==', 'abcAabcAcabcAl', '=='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
285
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
286 call setreg('A', 'abcAc2','c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
287 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
288 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
289
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
290 call setreg('b', 'abcB', 'v')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
291 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
292 call Assert_regput('b', ['==', '=abcB='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
293
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
294 call setreg('b', 'abcBc', 'ca')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
295 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
296 call Assert_regput('b', ['==', '=abcBabcBc='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
297
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
298 call setreg('b', 'abcBb', 'ba')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
299 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
300 call Assert_regput('b', ['==', '=abcBabcBcabcBb='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
301
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
302 call setreg('b', 'abcBc2','ca')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
303 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
304 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
305
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
306 call setreg('b', 'abcBb2','b50a')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
307 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
308 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
309
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
310 call setreg('c', 'abcC', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
311 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
312 call Assert_regput('c', ['==', 'abcC', '=='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
313
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
314 call setreg('C', 'abcCl', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
315 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
316 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
317
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
318 call setreg('C', 'abcCc', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
319 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
320 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
321
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
322 call setreg('d', 'abcD', 'V')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
323 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
324 call Assert_regput('d', ['==', 'abcD', '=='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
325
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
326 call setreg('D', 'abcDb', 'b')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
327 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
328 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
329
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
330 call setreg('e', 'abcE', 'b')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
331 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
332 call Assert_regput('e', ['==', '=abcE='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
333
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
334 call setreg('E', 'abcEb', 'b')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
335 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
336 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
337
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
338 call setreg('E', 'abcEl', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
339 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
340 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
341
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
342 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
343 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
344 call Assert_regput('f', ['==', '=abcF='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
345
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
346 call setreg('F', 'abcFc', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
347 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
348 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
349
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
350 call setreg('g', 'abcG', 'b10')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
351 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
352 call Assert_regput('g', ['==', '=abcG ='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
353
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
354 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
355 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
356 call Assert_regput('h', ['==', '=abcH ='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
357
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
358 call setreg('I', 'abcI')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
359 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
360 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
361
20211
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
362 " Appending NL with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
363 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
364 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
365 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
366 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
367 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
368 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
369 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
370 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
371 call setreg('I', 'abcI2')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
372
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
373 call setreg('A', "\n")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
374 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
375 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
376
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
377 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
378 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
379 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
380
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
381 call setreg('C', "\n")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
382 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
383 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
384
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
385 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
386 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
387 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
388
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
389 call setreg('E', "\n")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
390 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
391 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
392
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
393 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
394 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
395 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
396
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
397 " Setting lists with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
398 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
399 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
400 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
401
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
402 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
403 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
404 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
405
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
406 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
407 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
408 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
409
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
410 call setreg('d', ['abcD3'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
411 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
412 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
413
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
414 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
415 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
416 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
417
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
418 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
419 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
420 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
421
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
422 " Appending lists with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
423 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
424 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
425 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
426
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
427 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
428 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
429 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
430
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
431 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
432 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
433 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
434
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
435 call setreg('D', ['abcD32'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
436 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
437 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
438
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
439 call setreg('A', ['abcA32'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
440 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
441 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
442
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
443 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
444 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
445 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
446
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
447 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
448 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
449 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
450
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
451 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
452 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
453 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
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 NL 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', ["\n", 'abcA3l2'], 'l')
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\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
458 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
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', ["\n", 'abcB3c2'], 'c')
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\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
462 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
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', ["\n", 'abcC3b2'], 'b')
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', "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
466 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
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', ["\n", 'abcD3b50'],'b50')
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', "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
470 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
471
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
472 " 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
473 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
474 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
475 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
476
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
477 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
478 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
479 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
480
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
481 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
482 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
483 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
484
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
485 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
486 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
487 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
488
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
489 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
490 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
491 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
492
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
493 " Search and expressions
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
494 call setreg('/', ['abc/'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
495 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
496 call Assert_regput('/', ['==', '=abc/='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
497
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
498 call setreg('/', ["abc/\n"])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
499 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
500 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
501
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
502 call setreg('=', ['"abc/"'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
503 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
504
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
505 call setreg('=', ["\"abc/\n\""])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
506 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
507
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
508 " System clipboard
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
509 if has('clipboard')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
510 new | only!
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
511 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
512 " 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
513 " 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
514 let _clipreg = ['*', getreg('*'), getregtype('*')]
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
515 let _clipopt = &cb
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
516 let &cb='unnamed'
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
517 1y
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
518 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
519 tabdo :windo :echo "hi"
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
520 2y
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
521 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
522 let &cb=_clipopt
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
523 call call('setreg', _clipreg)
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
524 enew!
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
525 endif
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
526
20109
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
527 " Error cases
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
528 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
529 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
530 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
531 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
532 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
533 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
534 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
535 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
536 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
537
19724
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19477
diff changeset
538 " vim: shiftwidth=2 sts=2 expandtab