blob: 317d45867f0626aa6e2112e9ad75f99d9c1fcb73 [file] [log] [blame]
Bram Moolenaarf6f32c32016-03-12 19:03:59 +01001" Test for assignment
2
3func Test_no_type_checking()
4 let v = 1
5 let v = [1,2,3]
6 let v = {'a': 1, 'b': 2}
7 let v = 3.4
8 let v = 'hello'
9endfunc
Bram Moolenaare353c402017-02-04 19:49:16 +010010
11func Test_let_termcap()
12 " Terminal code
13 let old_t_te = &t_te
14 let &t_te = "\<Esc>[yes;"
15 call assert_match('t_te.*^[[yes;', execute("set termcap"))
16 let &t_te = old_t_te
17
Bram Moolenaar1c410402017-02-23 15:20:03 +010018 if exists("+t_k1")
Bram Moolenaar1fb0d492017-02-04 21:50:19 +010019 " Key code
20 let old_t_k1 = &t_k1
21 let &t_k1 = "that"
22 call assert_match('t_k1.*that', execute("set termcap"))
23 let &t_k1 = old_t_k1
24 endif
Bram Moolenaare353c402017-02-04 19:49:16 +010025
26 call assert_fails('let x = &t_xx', 'E15')
27 let &t_xx = "yes"
28 call assert_equal("yes", &t_xx)
29 let &t_xx = ""
30 call assert_fails('let x = &t_xx', 'E15')
31endfunc
Bram Moolenaar2a6a6c32017-10-02 19:29:48 +020032
33func Test_let_option_error()
34 let _w = &tw
35 let &tw = 80
36 call assert_fails('let &tw .= 1', 'E734')
37 call assert_equal(80, &tw)
38 let &tw = _w
39
40 let _w = &fillchars
41 let &fillchars = "vert:|"
42 call assert_fails('let &fillchars += "diff:-"', 'E734')
43 call assert_equal("vert:|", &fillchars)
44 let &fillchars = _w
45endfunc