annotate src/testdir/test_eval_stuff.vim @ 21267:7833afe1c66e v8.2.1184

patch 8.2.1184: some tests fail Commit: https://github.com/vim/vim/commit/2b6ef856fb89f703714f3f1f567d9bd7c81079f3 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 11 22:25:57 2020 +0200 patch 8.2.1184: some tests fail Problem: Some tests fail. Solution: Adjust tests for different assert_fails() behavior. Remove unused variable.
author Bram Moolenaar <Bram@vim.org>
date Sat, 11 Jul 2020 22:30:08 +0200
parents a672feb8fc4f
children 140a9082f87c
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')
4a1efd1a6018 patch 8.0.1708: mkdir with 'p' flag fails on existing directory
Christian Brabandt <cb@256bit.org>
parents: 13288
diff changeset
38 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
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()))
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20156
diff changeset
42 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
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()
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15107
diff changeset
68 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
69 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
70 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
71 endfunc
15468
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
72
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
73 func Test_readfile_binary()
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
74 new
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
75 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
76 setlocal ff=dos
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
77 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
78 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
79 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
80 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
81 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
82 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
83 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
84 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
85 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
86
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
87 bwipe!
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
88 call delete('XReadfile')
1550cc188ff6 patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
89 endfunc
15593
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
90
e26caeb30026 patch 8.1.0804: crash when setting v:errmsg to empty list
Bram Moolenaar <Bram@vim.org>
parents: 15468
diff changeset
91 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
92 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
93 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
94 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
95 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
96 endfunc
16219
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
97
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
98 func Test_string_concatenation()
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
99 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
100 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
101 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
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
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 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
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
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
109 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
110 let b = 'b'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
111 let a .= b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
112 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
113
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
114 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
115 let a.=b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
116 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
117
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
118 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
119 let a ..= b
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
120 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
121
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
122 let a = 'a'
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
123 let a..=b
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)
bd49e1656c72 patch 8.1.1114: confusing overloaded operator "." for string concatenation
Bram Moolenaar <Bram@vim.org>
parents: 15593
diff changeset
125 endfunc
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
126
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
127 " Test fix for issue #4507
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
128 func Test_skip_after_throw()
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
129 try
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
130 throw 'something'
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
131 let x = wincol() || &ts
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
132 catch /something/
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
133 endtry
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
134 endfunc
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
135
16223
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
136 scriptversion 2
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
137 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
138 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
139 let a = 'a'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
140 let b = 'b'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
141
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
142 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
143 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
144 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
145
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
146 if has('float')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
147 let f = .5
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
148 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
149 endif
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
150 endfunc
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
151
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
152 scriptversion 1
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
153 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
154 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
155 let a = 'a'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
156 let b = 'b'
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
157
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
158 echo a . b
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
159 let a .= b
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
160 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
161 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
162
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
163 if has('float')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
164 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
165 endif
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
166 endfunc
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
167
16366
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
168 scriptversion 3
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
169 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
170 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
171 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
172 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
173 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
174 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
175 endfunc
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
176
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
177 scriptversion 2
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
178 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
179 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
180 echo version
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
181 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
182 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
183
d5fa04016df0 patch 8.1.1526: no numerical value for the patchlevel
Bram Moolenaar <Bram@vim.org>
parents: 16982
diff changeset
184 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
185 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
186 endfunc
6ee80f3b5ea9 patch 8.1.1188: not all Vim variables require the v: prefix
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
187
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
188 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
189 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
190
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 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
192 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
193 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
194
18080
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
195 scriptversion 4
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
196 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
197 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
198 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
199 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
200 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
201 call assert_equal(18, 018)
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
202 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
203 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
204 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
205 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
206 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
207 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
208 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
209 endfunc
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
210
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
211 scriptversion 1
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
212 func Test_vvar_scriptversion1()
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
213 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
214 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
215 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
216 call assert_equal(18, 018)
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
217 endfunc
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
218
a6d218f99ff7 patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
219 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
220 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
221 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
222 call delete('Xversionscript')
abb67309c1ca patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents: 16219
diff changeset
223 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
224
20156
49694eceaa55 patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents: 20109
diff changeset
225 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
226 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
227 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
228 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
229 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
230 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
231 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
232 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
233 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
234 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
235 endif
e3848b251a01 patch 8.2.0104: using channel or job with ":execute" has strange effects
Bram Moolenaar <Bram@vim.org>
parents: 18096
diff changeset
236 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
237
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
238 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
239 " 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
240 " correctly.
2bb0e80fcd32 patch 8.2.0296: mixing up "long long" and __int64 may cause problems
Bram Moolenaar <Bram@vim.org>
parents: 19087
diff changeset
241 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
242 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
243
20083
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
244 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
245 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
246 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
247 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
248 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
249 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
250 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
251
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
252 func Test_let_register()
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
253 let @" = 'abc'
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
254 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
255 let @" = "abc\n"
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
256 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
257 let @" = "abc\<C-m>"
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
258 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
259 let @= = '"abc"'
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
260 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
261 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
262
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
263 func Assert_regput(name, result)
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
264 new
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
265 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
266 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
267 bwipe!
20083
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
268 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
269
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
270 func Test_setreg_basic()
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
271 call setreg('a', 'abcA', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
272 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
273 call Assert_regput('a', ['==', '=abcA='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
274
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
275 call setreg('A', 'abcAc', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
276 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
277 call Assert_regput('a', ['==', '=abcAabcAc='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
278
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
279 call setreg('A', 'abcAl', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
280 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
281 call Assert_regput('a', ['==', 'abcAabcAcabcAl', '=='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
282
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
283 call setreg('A', 'abcAc2','c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
284 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
285 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
286
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
287 call setreg('b', 'abcB', 'v')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
288 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
289 call Assert_regput('b', ['==', '=abcB='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
290
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
291 call setreg('b', 'abcBc', 'ca')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
292 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
293 call Assert_regput('b', ['==', '=abcBabcBc='])
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
294
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
295 call setreg('b', 'abcBb', 'ba')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
296 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
297 call Assert_regput('b', ['==', '=abcBabcBcabcBb='])
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 call setreg('b', 'abcBc2','ca')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
300 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
301 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
302
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
303 call setreg('b', 'abcBb2','b50a')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
304 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
305 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
306
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
307 call setreg('c', 'abcC', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
308 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
309 call Assert_regput('c', ['==', 'abcC', '=='])
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('C', 'abcCl', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
312 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
313 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
314
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
315 call setreg('C', 'abcCc', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
316 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
317 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
318
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
319 call setreg('d', 'abcD', 'V')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
320 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
321 call Assert_regput('d', ['==', 'abcD', '=='])
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('D', 'abcDb', 'b')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
324 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
325 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
326
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
327 call setreg('e', 'abcE', 'b')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
328 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
329 call Assert_regput('e', ['==', '=abcE='])
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('E', 'abcEb', 'b')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
332 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
333 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
334
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
335 call setreg('E', 'abcEl', 'l')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
336 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
337 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
338
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
339 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
340 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
341 call Assert_regput('f', ['==', '=abcF='])
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('F', 'abcFc', 'c')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
344 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
345 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
346
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
347 call setreg('g', 'abcG', 'b10')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
348 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
349 call Assert_regput('g', ['==', '=abcG ='])
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('h', 'abcH', "\<C-v>10")
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
352 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
353 call Assert_regput('h', ['==', '=abcH ='])
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('I', 'abcI')
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
356 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
357 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
358
20211
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
359 " Appending NL with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
360 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
361 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
362 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
363 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
364 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
365 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
366 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
367 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
368 call setreg('I', 'abcI2')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
369
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
370 call setreg('A', "\n")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
371 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
372 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
373
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
374 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
375 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
376 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
377
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
378 call setreg('C', "\n")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
379 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
380 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
381
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
382 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
383 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
384 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
385
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
386 call setreg('E', "\n")
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
387 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
388 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
389
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
390 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
391 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
392 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
393
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
394 " Setting lists with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
395 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
396 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
397 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
398
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
399 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
400 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
401 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
402
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
403 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
404 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
405 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
406
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
407 call setreg('d', ['abcD3'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
408 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
409 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
410
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
411 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
412 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
413 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
414
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
415 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
416 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
417 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
418
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
419 " Appending lists with setreg()
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
420 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
421 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
422 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
423
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
424 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
425 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
426 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
427
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
428 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
429 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
430 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
431
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
432 call setreg('D', ['abcD32'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
433 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
434 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
435
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
436 call setreg('A', ['abcA32'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
437 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
438 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
439
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
440 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
441 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
442 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
443
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
444 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
445 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
446 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
447
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
448 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
449 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
450 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
451
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
452 " 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
453 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
454 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
455 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
456
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
457 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
458 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
459 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
460
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
461 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
462 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
463 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
464
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
465 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
466 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
467 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
468
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
469 " 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
470 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
471 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
472 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
473
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
474 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
475 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
476 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
477
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
478 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
479 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
480 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
481
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
482 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
483 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
484 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
485
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
486 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
487 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
488 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
489
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
490 " Search and expressions
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
491 call setreg('/', ['abc/'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
492 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
493 call Assert_regput('/', ['==', '=abc/='])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
494
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
495 call setreg('/', ["abc/\n"])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
496 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
497 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
498
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
499 call setreg('=', ['"abc/"'])
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
500 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
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/\n\""])
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/\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
504
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
505 " System clipboard
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
506 if has('clipboard')
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
507 new | only!
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
508 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
509 " 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
510 " 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
511 let _clipreg = ['*', getreg('*'), getregtype('*')]
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
512 let _clipopt = &cb
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
513 let &cb='unnamed'
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
514 1y
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
515 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
516 tabdo :windo :echo "hi"
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
517 2y
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', "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
519 let &cb=_clipopt
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
520 call call('setreg', _clipreg)
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
521 enew!
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
522 endif
3a94b984c9f9 patch 8.2.0661: eval test is still old style
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
523
20109
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
524 " Error cases
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 20085
diff changeset
525 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
526 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
527 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
528 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
529 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
530 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
531 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
532 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
533 endfunc
0da696bd7352 patch 8.2.0597: test_eval is old style
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
534
19724
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19477
diff changeset
535 " vim: shiftwidth=2 sts=2 expandtab