annotate src/testdir/test_assign.vim @ 18478:94223687df0e

Added tag v8.1.2233 for changeset e93cab5d0f0f27fad7882f1f412927df055b090d
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Oct 2019 04:30:05 +0100
parents f01eb1aed348
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8512
5104f96b6ecf commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for assignment
5104f96b6ecf commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
5104f96b6ecf commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_no_type_checking()
5104f96b6ecf commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 let v = 1
5104f96b6ecf commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 let v = [1,2,3]
5104f96b6ecf commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 let v = {'a': 1, 'b': 2}
5104f96b6ecf commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 let v = 3.4
5104f96b6ecf commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 let v = 'hello'
5104f96b6ecf commit https://github.com/vim/vim/commit/f6f32c38bf3319144a84a01a154c8c91939e7acf
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 endfunc
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
10
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
11 func Test_let_termcap()
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
12 " Terminal code
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
13 let old_t_te = &t_te
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
14 let &t_te = "\<Esc>[yes;"
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
15 call assert_match('t_te.*^[[yes;', execute("set termcap"))
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
16 let &t_te = old_t_te
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
17
10930
126405b39964 patch 8.0.0354: test to check that setting termcap key fails sometimes
Christian Brabandt <cb@256bit.org>
parents: 10829
diff changeset
18 if exists("+t_k1")
10829
8233f8f3f7ae patch 8.0.0304: assign test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
19 " Key code
8233f8f3f7ae patch 8.0.0304: assign test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
20 let old_t_k1 = &t_k1
8233f8f3f7ae patch 8.0.0304: assign test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
21 let &t_k1 = "that"
8233f8f3f7ae patch 8.0.0304: assign test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
22 call assert_match('t_k1.*that', execute("set termcap"))
8233f8f3f7ae patch 8.0.0304: assign test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
23 let &t_k1 = old_t_k1
8233f8f3f7ae patch 8.0.0304: assign test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
24 endif
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
25
15456
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
26 call assert_fails('let x = &t_xx', 'E113')
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
27 let &t_xx = "yes"
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
28 call assert_equal("yes", &t_xx)
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
29 let &t_xx = ""
15456
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
30 call assert_fails('let x = &t_xx', 'E113')
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 8512
diff changeset
31 endfunc
12588
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
32
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
33 func Test_let_option_error()
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
34 let _w = &tw
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
35 let &tw = 80
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
36 call assert_fails('let &tw .= 1', 'E734')
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
37 call assert_equal(80, &tw)
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
38 let &tw = _w
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
39
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
40 let _w = &fillchars
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
41 let &fillchars = "vert:|"
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
42 call assert_fails('let &fillchars += "diff:-"', 'E734')
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
43 call assert_equal("vert:|", &fillchars)
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
44 let &fillchars = _w
5bc07e5d2c1f patch 8.0.1172: when E734 is given option is still set
Christian Brabandt <cb@256bit.org>
parents: 10930
diff changeset
45 endfunc
15456
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
46
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
47 func Test_let_errors()
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
48 let s = 'abcd'
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
49 call assert_fails('let s[1] = 5', 'E689:')
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
50
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
51 let l = [1, 2, 3]
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
52 call assert_fails('let l[:] = 5', 'E709:')
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 12588
diff changeset
53 endfunc