annotate src/testdir/test_tcl.vim @ 16050:c19853508d3e v8.1.1030

patch 8.1.1030: quickfix function arguments are inconsistent commit https://github.com/vim/vim/commit/0398e00a1bf79e85223fb26938c8dd0d54883b77 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 21 21:12:49 2019 +0100 patch 8.1.1030: quickfix function arguments are inconsistent Problem: Quickfix function arguments are inconsistent. Solution: Pass a list pointer instead of info and index. (Yegappan Lakshmanan, closes #4135)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 Mar 2019 21:15:06 +0100
parents c15bef307de6
children f38fcbf343ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10763
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for the Tcl interface.
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has('tcl')
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 end
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
7 " Helper function as there is no builtin tcleval() function similar
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
8 " to perleval, luaevel(), pyeval(), etc.
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
9 func TclEval(tcl_expr)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
10 let s = split(execute('tcl ' . a:tcl_expr), "\n")
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
11 return (len(s) == 0) ? '' : s[-1]
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
12 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
13
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
14 func Test_tcldo()
10763
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 " Check deleting lines does not trigger ml_get error.
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 new
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call setline(1, ['one', 'two', 'three'])
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 tcldo ::vim::command %d_
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 bwipe!
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
21 " Check that switching to another buffer does not trigger ml_get error.
10763
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 new
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 let wincount = winnr('$')
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call setline(1, ['one', 'two', 'three'])
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 tcldo ::vim::command new
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_equal(wincount + 1, winnr('$'))
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
27 %bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
28 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
29
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
30 " Test :tcldo with a range
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
31 func Test_tcldo_range()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
32 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
33 call setline(1, ['line1', 'line2', 'line3', 'line4'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
34 2,3tcldo set line [string toupper $line]
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
35 call assert_equal(['line1', 'LINE2', 'LINE3', 'line4'], getline(1, '$'))
10763
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 bwipe!
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
37 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
38
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
39 " Test ::vim::beep
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
40 func Test_vim_beep()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
41 call assert_beeps('tcl ::vim::beep')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
42 call assert_fails('tcl ::vim::beep x', 'wrong # args: should be "::vim::beep"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
43 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
44
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
45 " Test ::vim::buffer
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
46 func Test_vim_buffer()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
47 " Test ::vim::buffer {nr}
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
48 e Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
49 call setline(1, ['foobar'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
50 let bn1 = bufnr('%')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
51 let b1 = TclEval('::vim::buffer ' . bn1)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
52 call assert_equal(b1, TclEval('set ::vim::current(buffer)'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
53
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
54 new Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
55 call setline(1, ['barfoo'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
56 let bn2 = bufnr('%')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
57 let b2 = TclEval('::vim::buffer ' . bn2)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
58 call assert_equal(b2, TclEval('set ::vim::current(buffer)'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
59
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
60 call assert_match('Xfoo1$', TclEval(b1 . ' name'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
61 call assert_match('Xfoo2$', TclEval(b2 . ' name'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
62
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
63 " Test ::vim::buffer exists {nr}
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
64 call assert_match('^[1-9]\d*$', TclEval('::vim::buffer exists ' . bn1))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
65 call assert_match('^[1-9]\d*$', TclEval('::vim::buffer exists ' . bn2))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
66 call assert_equal('0', TclEval('::vim::buffer exists 54321'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
67
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
68 " Test ::vim::buffer list
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
69 call assert_equal('2', TclEval('llength [::vim::buffer list]'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
70 call assert_equal(b1.' '.b2, TclEval('::vim::buffer list'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
71 tcl <<EOF
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
72 proc eachbuf { cmd } {
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
73 foreach b [::vim::buffer list] { $b command $cmd }
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
74 }
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
75 EOF
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
76 tcl eachbuf %s/foo/FOO/g
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
77 b! Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
78 call assert_equal(['FOObar'], getline(1, '$'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
79 b! Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
80 call assert_equal(['barFOO'], getline(1, '$'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
81
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
82 call assert_fails('tcl ::vim::buffer',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
83 \ 'wrong # args: should be "::vim::buffer option"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
84 call assert_fails('tcl ::vim::buffer ' . bn1 . ' x',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
85 \ 'wrong # args: should be "::vim::buffer bufNumber"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
86 call assert_fails('tcl ::vim::buffer 4321', 'invalid buffer number')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
87 call assert_fails('tcl ::vim::buffer x',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
88 \ 'bad option "x": must be exists or list')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
89 call assert_fails('tcl ::vim::buffer exists',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
90 \ 'wrong # args: should be "::vim::buffer exists bufNumber"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
91 call assert_fails('tcl ::vim::buffer exists x',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
92 \ 'expected integer but got "x"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
93 call assert_fails('tcl ::vim::buffer list x',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
94 \ 'wrong # args: should be "::vim::buffer list "')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
95
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
96 tcl rename eachbuf ""
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
97 %bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
98 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
99
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
100 " Test ::vim::option
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
101 func Test_vim_option()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
102 set cc=3,5
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
103
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
104 " Test getting option 'cc'
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
105 call assert_equal('3,5', TclEval('::vim::option cc'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
106 call assert_equal('3,5', &cc)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
107
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
108 " Test setting option 'cc' (it returns the old option value)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
109 call assert_equal('3,5', TclEval('::vim::option cc +4'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
110 call assert_equal('+4', &cc)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
111 call assert_equal('+4', TclEval('::vim::option cc'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
112
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
113 " Test boolean option with 'toggle', 'on' and 'off' keywords.
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
114 call assert_equal('0', TclEval('::vim::option nu toggle'))
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
115 call assert_equal(1, &nu)
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
116 call assert_equal('1', TclEval('::vim::option nu toggle'))
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
117 call assert_equal(0, &nu)
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
118 call assert_equal('0', TclEval('::vim::option nu on'))
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
119 call assert_equal(1, &nu)
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
120 call assert_equal('1', TclEval('::vim::option nu off'))
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
121 call assert_equal(0, &nu)
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
122
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
123 call assert_fails('tcl ::vim::option nu x', 'expected integer but got "x"')
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
124 call assert_fails('tcl ::vim::option xxx', 'unknown vimOption')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
125 call assert_fails('tcl ::vim::option',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
126 \ 'wrong # args: should be "::vim::option vimOption ?value?"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
127
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
128 set cc&
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
129 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
130
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
131 " Test ::vim::expr
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
132 func Test_vim_expr()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
133 call assert_equal(string(char2nr('X')),
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
134 \ TclEval('::vim::expr char2nr("X")'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
135
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
136 call assert_fails('tcl ::vim::expr x y',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
137 \ 'wrong # args: should be "::vim::expr vimExpr"')
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
138 call assert_fails('tcl ::vim::expr 1-', 'E15: Invalid expression: 1-')
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
139 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
140
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
141 " Test ::vim::command
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
142 func Test_vim_command()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
143 call assert_equal('hello world',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
144 \ TclEval('::vim::command {echo "hello world"}'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
145
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
146 " Check that if ::vim::command created a new Tcl interpreter, it is removed.
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
147 tcl set foo 123
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
148 call assert_equal('321', TclEval('::vim::command "tcl set foo 321"'))
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
149 call assert_equal('123', TclEval('set foo'))
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
150
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
151 " With the -quiet option, the error should silently be ignored.
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
152 call assert_equal('', TclEval('::vim::command -quiet xyz'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
153
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
154 call assert_fails('tcl ::vim::command',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
155 \ 'wrong # args: should be "::vim::command ?-quiet? exCommand"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
156 call assert_fails('tcl ::vim::command -foo xyz', 'unknown flag: -foo')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
157 call assert_fails('tcl ::vim::command xyz',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
158 \ 'E492: Not an editor command: xyz')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
159
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
160 " With the -quiet option, the error should silently be ignored.
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
161 call assert_equal('', TclEval('::vim::command -quiet xyz'))
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
162
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
163 tcl unset foo
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
164 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
165
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
166 " Test ::vim::window list
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
167 func Test_vim_window_list()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
168 e Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
169 new Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
170 let w2 = TclEval('set ::vim::current(window)')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
171 wincmd j
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
172 let w1 = TclEval('set ::vim::current(window)')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
173
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
174 call assert_equal('2', TclEval('llength [::vim::window list]'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
175 call assert_equal(w2.' '.w1, TclEval('::vim::window list'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
176
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
177 call assert_fails('tcl ::vim::window x', 'unknown option')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
178 call assert_fails('tcl ::vim::window list x',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
179 \ 'wrong # args: should be "::vim::window option"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
180
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
181 %bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
182 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
183
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
184 " Test output messages
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
185 func Test_output()
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
186 call assert_fails('tcl puts vimerr "error #1"', 'error #1')
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
187 call assert_fails('tcl puts stderr "error #2"', 'error #2')
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
188 tcl puts vimout "message #1"
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
189 tcl puts stdout "message #2"
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
190 tcl puts "message #3"
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
191 let messages = split(execute('message'), "\n")
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
192 call assert_equal('message #3', messages[-1])
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
193 call assert_equal('message #2', messages[-2])
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
194 call assert_equal('message #1', messages[-3])
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
195
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
196 call assert_fails('tcl puts',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
197 \ 'wrong # args: should be "puts ?-nonewline? ?channelId? string"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
198 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
199
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
200 " Test $win height (get and set window height)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
201 func Test_window_height()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
202 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
203
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
204 " Test setting window height
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
205 tcl $::vim::current(window) height 2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
206 call assert_equal(2, winheight(0))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
207
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
208 " Test getting window height
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
209 call assert_equal('2', TclEval('$::vim::current(window) height'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
210
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
211 call assert_fails('tcl $::vim::current(window) height 2 2', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
212 call assert_fails('tcl $::vim::current(window) height x',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
213 \ 'expected integer but got "x"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
214 bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
215 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
216
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
217 " Test $win cursor (get and set cursor)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
218 func Test_window_cursor()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
219 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
220 call setline(1, ['line1', 'line2', 'line3', 'line5'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
221 tcl set win $::vim::current(window)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
222
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
223 tcl $win cursor 2 4
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
224 call assert_equal([0, 2, 4, 0], getpos('.'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
225 call assert_equal('row 2 column 4', TclEval('$win cursor'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
226
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
227 " When setting ::vim::lbase to 0, line/col are counted from 0
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
228 " instead of 1.
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
229 tcl set ::vim::lbase 0
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
230 call assert_equal([0, 2, 4, 0], getpos('.'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
231 call assert_equal('row 1 column 3', TclEval('$win cursor'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
232 tcl $win cursor 2 4
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
233 call assert_equal([0, 3, 5, 0], getpos('.'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
234 call assert_equal('row 2 column 4', TclEval('$win cursor'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
235 tcl set ::vim::lbase 1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
236 call assert_equal('row 3 column 5', TclEval('$win cursor'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
237 call assert_equal([0, 3, 5, 0], getpos('.'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
238
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
239 " test $win cursor {$var}
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
240 call cursor(2, 3)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
241 tcl array set here [$win cursor]
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
242 call assert_equal([0, 2, 3, 0], getpos('.'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
243 call cursor(3, 1)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
244 call assert_equal([0, 3, 1, 0], getpos('.'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
245 tcl $win cursor here
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
246 call assert_equal([0, 2, 3, 0], getpos('.'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
247 call cursor(3, 1)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
248 call assert_equal([0, 3, 1, 0], getpos('.'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
249 tcl $win cursor $here(row) $here(column)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
250 call assert_equal([0, 2, 3, 0], getpos('.'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
251
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
252 call assert_fails('tcl $win cursor 1 1 1', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
253
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
254 tcl unset win here
10763
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 bwipe!
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 endfunc
ae0bbbbe2a38 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
258 " Test $win buffer
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
259 func Test_window_buffer()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
260 new Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
261 new Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
262 tcl set b2 $::vim::current(buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
263 tcl set w2 $::vim::current(window)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
264 wincmd j
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
265 tcl set b1 $::vim::current(buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
266 tcl set w1 $::vim::current(window)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
267
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
268 call assert_equal(TclEval('set b1'), TclEval('$w1 buffer'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
269 call assert_equal(TclEval('set b2'), TclEval('$w2 buffer'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
270 call assert_equal(string(bufnr('Xfoo1')), TclEval('[$w1 buffer] number'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
271 call assert_equal(string(bufnr('Xfoo2')), TclEval('[$w2 buffer] number'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
272
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
273 call assert_fails('tcl $w1 buffer x', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
274
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
275 tcl unset b1 b2 w1 w2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
276 %bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
277 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
278
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
279 " Test $win command
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
280 func Test_window_command()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
281 new Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
282 call setline(1, ['FOObar'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
283 new Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
284 call setline(1, ['fooBAR'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
285 tcl set w2 $::vim::current(window)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
286 wincmd j
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
287 tcl set w1 $::vim::current(window)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
288
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
289 tcl $w1 command "norm VU"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
290 tcl $w2 command "norm Vu"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
291 b! Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
292 call assert_equal('FOOBAR', getline(1))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
293 b! Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
294 call assert_equal('foobar', getline(1))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
295
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
296 call assert_fails('tcl $w1 command xyz',
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
297 \ 'E492: Not an editor command: xyz')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
298 tcl $w1 command -quiet xyz
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
299
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
300 tcl unset w1 w2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
301 %bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
302 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
303
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
304 " Test $win expr
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
305 func Test_window_expr()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
306 new Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
307 new Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
308 tcl set w2 $::vim::current(window)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
309 wincmd j
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
310 tcl set w1 $::vim::current(window)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
311
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
312 call assert_equal('Xfoo1', TclEval('$w1 expr bufname("%")'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
313 call assert_equal('Xfoo2', TclEval('$w2 expr bufname("%")'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
314
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
315 call assert_fails('tcl $w1 expr', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
316 call assert_fails('tcl $w1 expr x x', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
317
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
318 tcl unset w1 w2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
319 %bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
320 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
321
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
322 " Test $win option
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
323 func Test_window_option()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
324 new Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
325 new Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
326 tcl set w2 $::vim::current(window)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
327 wincmd j
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
328 tcl set w1 $::vim::current(window)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
329
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
330 " Test setting window option
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
331 tcl $w1 option syntax java
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
332 tcl $w2 option syntax rust
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
333
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
334 call assert_equal('java', &syntax)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
335 wincmd k
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
336 call assert_equal('rust', &syntax)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
337
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
338 " Test getting window option
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
339 call assert_equal('java', TclEval('$w1 option syntax'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
340 call assert_equal('rust', TclEval('$w2 option syntax'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
341
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
342 tcl unset w1 w2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
343 %bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
344 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
345
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
346 " Test $win delcmd {cmd}
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
347 func Test_window_delcmd()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
348 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
349 tcl $::vim::current(window) delcmd [list set msg "window deleted"]
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
350 call assert_fails('tcl set msg', "can't read \"msg\": no such variable")
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
351 q
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
352 call assert_equal('window deleted', TclEval('set msg'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
353
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
354 call assert_fails('tcl $::vim::current(window) delcmd', 'wrong # args')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
355
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
356 tcl unset msg
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
357 bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
358 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
359
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
360 " Test $buf name
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
361 func Test_buffer_name()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
362 " Test buffer name with a named buffer
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
363 new Xfoo
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
364 call assert_equal(expand('%:p'), TclEval('$::vim::current(buffer) name'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
365 bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
366
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
367 " Test buffer name with an unnamed buffer
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
368 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
369 call assert_equal('', TclEval('$::vim::current(buffer) name'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
370
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
371 call assert_fails('tcl $::vim::current(buffer) name x', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
372
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
373 bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
374 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
375
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
376 " Test $buf number
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
377 func Test_buffer_number()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
378 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
379 call assert_equal(string(bufnr('%')), TclEval('$::vim::current(buffer) number'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
380 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
381 call assert_equal(string(bufnr('%')), TclEval('$::vim::current(buffer) number'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
382
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
383 call assert_fails('tcl $::vim::current(buffer) number x', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
384
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
385 %bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
386 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
387
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
388 " Test $buf count and $buf last
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
389 func Test_buffer_count()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
390 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
391 call setline(1, ['one', 'two', 'three'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
392 call assert_equal('3', TclEval('$::vim::current(buffer) count'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
393 call assert_equal('3', TclEval('$::vim::current(buffer) last'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
394
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
395 " Check that $buf count and $buf last differ when ::vim::lbase is 0.
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
396 tcl set ::vim::lbase 0
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
397 call assert_equal('3', TclEval('$::vim::current(buffer) count'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
398 call assert_equal('2', TclEval('$::vim::current(buffer) last'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
399
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
400 call assert_fails('tcl $::vim::current(buffer) count x', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
401 call assert_fails('tcl $::vim::current(buffer) last x', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
402
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
403 tcl set ::vim::lbase 1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
404 bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
405 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
406
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
407 " Test $buf delete (delete line(s) in buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
408 func Test_buffer_delete()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
409 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
410 call setline(1, ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
411 tcl $::vim::current(buffer) delete 4 6
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
412 tcl $::vim::current(buffer) delete 2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
413 call assert_equal(['one', 'three', 'seven', 'eight'], getline(1, '$'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
414
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
415 call assert_fails('tcl $::vim::current(buffer) delete -1', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
416 call assert_fails('tcl $::vim::current(buffer) delete 0', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
417 call assert_fails('tcl $::vim::current(buffer) delete 5', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
418
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
419 call assert_fails('tcl $::vim::current(buffer) delete', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
420 call assert_fails('tcl $::vim::current(buffer) delete 1 2 3', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
421
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
422 bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
423 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
424
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
425 " Test $buf insert (insert line(s) in buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
426 func Test_buffer_insert()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
427 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
428 tcl set buf $::vim::current(buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
429 tcl $buf insert 1 "first"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
430 tcl $buf insert 2 "second"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
431 tcl $buf insert 2 "third"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
432 tcl $buf insert 4 "fourth"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
433 tcl $buf insert 1 "fifth"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
434 call assert_equal(['fifth', 'first', 'third', 'second', 'fourth', ''], getline(1, '$'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
435
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
436 call assert_fails('tcl $buf insert -1 "x"', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
437 call assert_fails('tcl $buf insert 0 "x"', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
438 call assert_fails('tcl $buf insert 7 "x"', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
439
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
440 tcl unset buf
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
441 bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
442 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
443
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
444 " Test $buf append (append line in buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
445 func Test_buffer_append()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
446 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
447 tcl set buf $::vim::current(buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
448 tcl $buf append 1 "first"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
449 tcl $buf append 2 "second"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
450 tcl $buf append 2 "third"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
451 tcl $buf append 4 "fourth"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
452 tcl $buf append 1 "fifth"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
453 call assert_equal(['', 'fifth', 'first', 'third', 'second', 'fourth'], getline(1, '$'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
454
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
455 call assert_fails('tcl $buf append -1 "x"', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
456 call assert_fails('tcl $buf append 0 "x"', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
457 call assert_fails('tcl $buf append 7 "x"', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
458
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
459 call assert_fails('tcl $buf append', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
460 call assert_fails('tcl $buf append 1 x x', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
461
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
462 tcl unset buf
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
463 bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
464 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
465
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
466 " Test $buf set (replacing line(s) in a buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
467 func Test_buffer_set()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
468 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
469 call setline(1, ['line1', 'line2', 'line3', 'line4', 'line5'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
470 tcl $::vim::current(buffer) set 2 a
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
471 call assert_equal(['line1', 'a', 'line3', 'line4', 'line5'], getline(1, '$'))
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
472
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
473 " Test with fewer replacing lines than replaced lines: lines get deleted.
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
474 tcl $::vim::current(buffer) set 3 4 b
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
475 call assert_equal(['line1', 'a', 'b', 'line5'], getline(1, '$'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
476 tcl $::vim::current(buffer) set 4 3 c
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
477 call assert_equal(['line1', 'a', 'c'], getline(1, '$'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
478
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
479 " Test with more replacing lines than replaced lines: lines get added.
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
480 tcl $::vim::current(buffer) set 2 3 {x y z}
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
481 call assert_equal(['line1', 'x', 'y', 'z'], getline(1, '$'))
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
482 tcl $::vim::current(buffer) set 3 2 {X Y Z}
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
483 call assert_equal(['line1', 'X', 'Y', 'Z', 'z'], getline(1, '$'))
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
484
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
485 call assert_fails('tcl $::vim::current(buffer) set 0 "x"', 'line number out of range')
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
486 call assert_fails('tcl $::vim::current(buffer) set 6 "x"', 'line number out of range')
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
487
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
488 call assert_fails('tcl $::vim::current(buffer) set', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
489 bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
490 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
491
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
492 " Test $buf get (get line(s) from buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
493 func Test_buffer_get()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
494 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
495 call setline(1, ['first line', 'two', 'three', 'last line'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
496 tcl set buf $::vim::current(buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
497
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
498 call assert_equal('first line', TclEval('$buf get top'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
499 call assert_equal('first line', TclEval('$buf get begin'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
500 call assert_equal('last line', TclEval('$buf get bottom'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
501 call assert_equal('last line', TclEval('$buf get last'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
502
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
503 call assert_equal('first line', TclEval('$buf get 1'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
504 call assert_equal('two', TclEval('$buf get 2'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
505 call assert_equal('three', TclEval('$buf get 3'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
506 call assert_equal('last line', TclEval('$buf get 4'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
507
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
508 call assert_equal('two three', TclEval('$buf get 2 3'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
509 call assert_equal('two three', TclEval('$buf get 3 2'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
510 call assert_equal('three {last line}', TclEval('$buf get 3 last'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
511
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
512 call assert_fails('tcl $buf get -1', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
513 call assert_fails('tcl $buf get 0', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
514 call assert_fails('tcl $buf get 5', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
515 call assert_fails('tcl $buf get 0 1', 'line number out of range')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
516
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
517 call assert_fails('tcl $::vim::current(buffer) get x', 'expected integer but got "x"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
518 call assert_fails('tcl $::vim::current(buffer) get 1 1 1', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
519
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
520 tcl unset buf
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
521 bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
522 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
523
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
524 " Test $buf mark (get position of a mark)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
525 func Test_buffer_mark()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
526 new
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
527 call setline(1, ['one', 'two', 'three', 'four'])
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
528 /three
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
529 norm! ma
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
530 norm! jllmB
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
531
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
532 call assert_equal('row 3 column 1', TclEval('$::vim::current(buffer) mark a'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
533 call assert_equal('row 4 column 3', TclEval('$::vim::current(buffer) mark B'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
534
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
535 call assert_fails('tcl $::vim::current(buffer) mark /', 'invalid mark name')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
536 call assert_fails('tcl $::vim::current(buffer) mark z', 'mark not set')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
537 call assert_fails('tcl $::vim::current(buffer) mark', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
538
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
539 delmarks aB
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
540 bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
541 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
542
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
543 " Test $buf option (test and set option in context of a buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
544 func Test_buffer_option()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
545 new Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
546 tcl set b1 $::vim::current(buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
547 new Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
548 tcl set b2 $::vim::current(buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
549
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
550 tcl $b1 option foldcolumn 2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
551 tcl $b2 option foldcolumn 3
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
552
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
553 call assert_equal(3, &foldcolumn)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
554 wincmd j
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
555 call assert_equal(2, &foldcolumn)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
556
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
557 call assert_equal('2', TclEval('$b1 option foldcolumn'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
558 call assert_equal('3', TclEval('$b2 option foldcolumn'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
559
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
560 call assert_fails('tcl $::vim::current(buffer) option', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
561
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
562 set foldcolumn&
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
563 tcl unset b1 b2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
564 %bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
565 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
566
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
567 " Test $buf expr (evaluate vim expression)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
568 func Test_buffer_expr()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
569 new Xfoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
570 norm ifoo1
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
571 tcl set b1 $::vim::current(buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
572
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
573 new Xfoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
574 norm ifoo2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
575 tcl set b2 $::vim::current(buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
576
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
577 call assert_equal('foo1', TclEval('$b1 expr getline(1)'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
578 call assert_equal('foo2', TclEval('$b2 expr getline(1)'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
579
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
580 call assert_fails('tcl expr', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
581
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
582 tcl unset b1 b2
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
583 %bwipe!
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
584 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
585
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
586 " Test $buf delcmd {cmd} (command executed when buffer is deleted)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
587 func Test_buffer_delcmd()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
588 new Xfoo
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
589 split
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
590 tcl $::vim::current(buffer) delcmd [list set msg "buffer deleted"]
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
591 q
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
592 call assert_fails('tcl set msg', "can't read \"msg\": no such variable")
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
593 q
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
594 call assert_equal('buffer deleted', TclEval('set msg'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
595
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
596 call assert_fails('tcl $::vim::current(window) delcmd', 'wrong # args')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
597 call assert_fails('tcl $::vim::current(window) delcmd x x', 'wrong # args')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
598
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
599 tcl unset msg
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
600 %bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
601 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
602
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
603 func Test_vim_current()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
604 " Only test errors as ::vim::current(...) is already indirectly
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
605 " tested by many other tests.
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
606 call assert_fails('tcl $::vim::current(buffer)', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
607 call assert_fails('tcl $::vim::current(window)', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
608 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
609
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
610 " Test $buf windows (windows list of a buffer)
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
611 func Test_buffer_windows()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
612 new Xfoo
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
613 split
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
614 new Xbar
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
615 split
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
616 vsplit
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
617
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
618 tcl set bar_wl [$::vim::current(buffer) windows]
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
619 2wincmd j
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
620 tcl set foo_wl [$::vim::current(buffer) windows]
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
621
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
622 call assert_equal('2', TclEval('llength $foo_wl'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
623 call assert_equal('3', TclEval('llength $bar_wl'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
624
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
625 call assert_fails('tcl $::vim::current(buffer) windows x', 'wrong # args:')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
626
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
627 tcl unset bar_wl foo_wl
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
628 %bwipe
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
629 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
630
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
631 " Test :tclfile
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
632 func Test_tclfile()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
633 call delete('Xtcl_file')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
634 call writefile(['set pi [format "%.2f" [expr acos(-1.0)]]'], 'Xtcl_file')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
635 call setfperm('Xtcl_file', 'r-xr-xr-x')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
636
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
637 tclfile Xtcl_file
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
638 call assert_equal('3.14', TclEval('set pi'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
639
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
640 tcl unset pi
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
641 call delete('Xtcl_file')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
642 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
643
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
644 " Test :tclfile with syntax error in tcl script
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
645 func Test_tclfile_error()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
646 call delete('Xtcl_file')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
647 call writefile(['xyz'], 'Xtcl_file')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
648 call setfperm('Xtcl_file', 'r-xr-xr-x')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
649
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
650 call assert_fails('tclfile Xtcl_file', 'invalid command name "xyz"')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
651
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
652 call delete('Xtcl_file')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
653 endfunc
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
654
14294
6c5c8de48152 patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents: 14268
diff changeset
655 " Test exiting current Tcl interpreter and re-creating one.
14268
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
656 func Test_tcl_exit()
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
657 tcl set foo "foo"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
658 call assert_fails('tcl exit 3', 'E572: exit code 3')
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
659
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
660 " The Tcl interpreter should have been deleted and a new one
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
661 " is re-created with the next :tcl command.
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
662 call assert_fails('tcl set foo', "can't read \"foo\": no such variable")
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
663 tcl set bar "bar"
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
664 call assert_equal('bar', TclEval('set bar'))
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
665
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
666 tcl unset bar
c80acf74e7df patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents: 10763
diff changeset
667 endfunc
14395
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
668
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
669 func Test_set_cursor()
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
670 " Check that setting the cursor position works.
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
671 new
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
672 call setline(1, ['first line', 'second line'])
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
673 normal gg
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
674 tcldo $::vim::current(window) cursor 1 5
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
675 call assert_equal([1, 5], [line('.'), col('.')])
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
676
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
677 " Check that movement after setting cursor position keeps current column.
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
678 normal j
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
679 call assert_equal([2, 5], [line('.'), col('.')])
c15bef307de6 patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents: 14294
diff changeset
680 endfunc