Mercurial > vim
annotate src/testdir/test_tcl.vim @ 21550:b0b57d91671c v8.2.1325
patch 8.2.1325: Vim9: using Vim9 script for autaload not tested
Commit: https://github.com/vim/vim/commit/ea2d8d25718836bf627b67b7fcd28a1e528bb7b9
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 29 22:11:05 2020 +0200
patch 8.2.1325: Vim9: using Vim9 script for autaload not tested
Problem: Vim9: using Vim9 script for autaload not tested.
Solution: Add a test. Update help.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 29 Jul 2020 22:15:05 +0200 |
parents | 0a8322506058 |
children | 000568dd900a |
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 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
3 source check.vim |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
4 CheckFeature tcl |
10763
ae0bbbbe2a38
patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
6 " Helper function as there is no builtin tcleval() function similar |
17918
9606c0adc148
patch 8.1.1955: tests contain typos
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
7 " to perleval, luaeval(), pyeval(), etc. |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
8 func TclEval(tcl_expr) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
9 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
|
10 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
|
11 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
12 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
13 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
|
14 " 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
|
15 new |
ae0bbbbe2a38
patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 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
|
17 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
|
18 bwipe! |
ae0bbbbe2a38
patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
20 " 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
|
21 new |
ae0bbbbe2a38
patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 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
|
23 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
|
24 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
|
25 call assert_equal(wincount + 1, winnr('$')) |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
26 |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
27 " Try to run a command in a 'nomodifiable' buffer |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
28 call setline(1, ['one', 'two', 'three']) |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
29 set nomodifiable |
21269
0a8322506058
patch 8.2.1185: some other tests fail
Bram Moolenaar <Bram@vim.org>
parents:
21228
diff
changeset
|
30 call assert_fails('tcldo set line "abc"', |
0a8322506058
patch 8.2.1185: some other tests fail
Bram Moolenaar <Bram@vim.org>
parents:
21228
diff
changeset
|
31 \ ['E21:', 'cannot save undo information']) |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
32 set modifiable |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
33 |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
34 %bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
35 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
36 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
37 " Test :tcldo with a range |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
38 func Test_tcldo_range() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
39 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
40 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
|
41 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
|
42 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
|
43 bwipe! |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
44 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
45 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
46 " Test ::vim::beep |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
47 func Test_vim_beep() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
48 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
|
49 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
|
50 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
51 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
52 " Test ::vim::buffer |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
53 func Test_vim_buffer() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
54 " Test ::vim::buffer {nr} |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
55 e Xfoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
56 call setline(1, ['foobar']) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
57 let bn1 = bufnr('%') |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
58 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
|
59 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
|
60 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
61 new Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
62 call setline(1, ['barfoo']) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
63 let bn2 = bufnr('%') |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
64 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
|
65 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
|
66 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
67 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
|
68 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
|
69 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
70 " Test ::vim::buffer exists {nr} |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
71 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
|
72 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
|
73 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
|
74 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
75 " Test ::vim::buffer list |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
76 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
|
77 call assert_equal(b1.' '.b2, TclEval('::vim::buffer list')) |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
78 tcl << trim EOF |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
79 proc eachbuf { cmd } { |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
80 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
|
81 } |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
82 EOF |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
83 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
|
84 b! Xfoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
85 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
|
86 b! Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
87 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
|
88 |
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', |
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 option"') |
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 ' . bn1 . ' x', |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
92 \ '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
|
93 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
|
94 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
|
95 \ '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
|
96 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
|
97 \ '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
|
98 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
|
99 \ 'expected integer but got "x"') |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
100 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
|
101 \ 'wrong # args: should be "::vim::buffer list "') |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
102 " Invalid buffer command |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
103 call assert_fails('tcl $::vim::current(buffer) abcd', |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
104 \ 'bad option "abcd":') |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
105 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
106 tcl rename eachbuf "" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
107 %bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
108 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
109 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
110 " Test ::vim::option |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
111 func Test_vim_option() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
112 set cc=3,5 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
113 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
114 " Test getting option 'cc' |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
115 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
|
116 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
|
117 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
118 " 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
|
119 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
|
120 call assert_equal('+4', &cc) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
121 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
|
122 |
14294
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
123 " 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
|
124 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
|
125 call assert_equal(1, &nu) |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
126 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
|
127 call assert_equal(0, &nu) |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
128 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
|
129 call assert_equal(1, &nu) |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
130 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
|
131 call assert_equal(0, &nu) |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
132 |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 \ '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
|
137 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
138 set cc& |
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::expr |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
142 func Test_vim_expr() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
143 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
|
144 \ TclEval('::vim::expr char2nr("X")')) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
145 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
146 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
|
147 \ '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
|
148 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
|
149 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
150 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
151 " Test ::vim::command |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
152 func Test_vim_command() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
153 call assert_equal('hello world', |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
154 \ 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
|
155 |
14294
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
156 " 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
|
157 tcl set foo 123 |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
158 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
|
159 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
|
160 |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
161 " 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
|
162 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
|
163 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
164 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
|
165 \ '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
|
166 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
|
167 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
|
168 \ '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
|
169 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
170 " 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
|
171 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
|
172 |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
173 tcl unset foo |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
174 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
175 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
176 " Test ::vim::window list |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
177 func Test_vim_window_list() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
178 e Xfoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
179 new Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
180 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
|
181 wincmd j |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
182 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
|
183 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
184 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
|
185 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
|
186 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
187 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
|
188 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
|
189 \ 'wrong # args: should be "::vim::window option"') |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
190 call assert_fails('tcl $::vim::current(window) abcd', |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
191 \ 'bad option "abcd":') |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
192 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
193 %bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
194 endfunc |
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 " Test output messages |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
197 func Test_output() |
14294
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
198 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
|
199 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
|
200 tcl puts vimout "message #1" |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
201 tcl puts stdout "message #2" |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
202 tcl puts "message #3" |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
203 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
|
204 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
|
205 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
|
206 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
|
207 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
208 call assert_fails('tcl puts', |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
209 \ '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
|
210 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
211 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
212 " 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
|
213 func Test_window_height() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
214 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
215 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
216 " Test setting window height |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
217 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
|
218 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
|
219 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
220 " Test getting window height |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
221 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
|
222 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
223 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
|
224 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
|
225 \ 'expected integer but got "x"') |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
226 bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
227 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
228 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
229 " 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
|
230 func Test_window_cursor() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
231 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
232 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
|
233 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
|
234 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
235 tcl $win cursor 2 4 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
236 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
|
237 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
|
238 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
239 " 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
|
240 " instead of 1. |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
241 tcl set ::vim::lbase 0 |
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, 4, 0], getpos('.')) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
243 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
|
244 tcl $win cursor 2 4 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
245 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
|
246 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
|
247 tcl set ::vim::lbase 1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
248 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
|
249 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
|
250 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
251 " test $win cursor {$var} |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
252 call cursor(2, 3) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
253 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
|
254 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
|
255 call cursor(3, 1) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
256 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
|
257 tcl $win cursor here |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
258 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
|
259 call cursor(3, 1) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
260 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
|
261 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
|
262 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
|
263 |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
264 " Invalid values for the row and column |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
265 tcl array set pos {1 2} |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
266 call assert_fails('tcl $win cursor pos', "can't read \"pos(row)\":") |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
267 tcl array set pos {row '' abc 2} |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
268 call assert_fails('tcl $win cursor pos', "expected integer but got \"''\"") |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
269 tcl array set pos {row 1 abc 2} |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
270 call assert_fails('tcl $win cursor pos', "can't read \"pos(column)\":") |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
271 tcl array set pos {row 1 column ''} |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
272 call assert_fails('tcl $win cursor pos', "expected integer but got \"''\"") |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
273 |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
274 call assert_fails("tcl $win cursor '' 2", "expected integer but got \"''\"") |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
275 call assert_fails("tcl $win cursor 1 ''", "expected integer but got \"''\"") |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
276 |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
277 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
|
278 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
279 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
|
280 bwipe! |
ae0bbbbe2a38
patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
281 endfunc |
ae0bbbbe2a38
patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
282 |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
283 " Test $win buffer |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
284 func Test_window_buffer() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
285 new Xfoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
286 new Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
287 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
|
288 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
|
289 wincmd j |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
290 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
|
291 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
|
292 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
293 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
|
294 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
|
295 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
|
296 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
|
297 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
298 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
|
299 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
300 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
|
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 command |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
305 func Test_window_command() |
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 call setline(1, ['FOObar']) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
308 new Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
309 call setline(1, ['fooBAR']) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
310 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
|
311 wincmd j |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
312 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
|
313 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
314 tcl $w1 command "norm VU" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
315 tcl $w2 command "norm Vu" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
316 b! Xfoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
317 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
|
318 b! Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
319 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
|
320 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
321 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
|
322 \ '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
|
323 tcl $w1 command -quiet xyz |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
324 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
325 tcl unset w1 w2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
326 %bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
327 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
328 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
329 " Test $win expr |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
330 func Test_window_expr() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
331 new Xfoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
332 new Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
333 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
|
334 wincmd j |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
335 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
|
336 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
337 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
|
338 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
|
339 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
340 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
|
341 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
|
342 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
343 tcl unset w1 w2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
344 %bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
345 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
346 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
347 " Test $win option |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
348 func Test_window_option() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
349 new Xfoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
350 new Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
351 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
|
352 wincmd j |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
353 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
|
354 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
355 " Test setting window option |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
356 tcl $w1 option syntax java |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
357 tcl $w2 option syntax rust |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
358 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
359 call assert_equal('java', &syntax) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
360 wincmd k |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
361 call assert_equal('rust', &syntax) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
362 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
363 " Test getting window option |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
364 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
|
365 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
|
366 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
367 tcl unset w1 w2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
368 %bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
369 endfunc |
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 " Test $win delcmd {cmd} |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
372 func Test_window_delcmd() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
373 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
374 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
|
375 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
|
376 q |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
377 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
|
378 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
379 call assert_fails('tcl $::vim::current(window) delcmd', 'wrong # args') |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
380 call assert_fails('tcl $::vim::current(window) delcmd x x', 'wrong # args') |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
381 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
382 tcl unset msg |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
383 bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
384 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
385 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
386 " Test $buf name |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
387 func Test_buffer_name() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
388 " 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
|
389 new Xfoo |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
390 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
|
391 bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
392 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
393 " 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
|
394 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
395 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
|
396 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
397 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
|
398 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
399 bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
400 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
401 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
402 " Test $buf number |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
403 func Test_buffer_number() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
404 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
405 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
|
406 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
407 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
|
408 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
409 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
|
410 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
411 %bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
412 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
413 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
414 " 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
|
415 func Test_buffer_count() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
416 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
417 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
|
418 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
|
419 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
|
420 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
421 " 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
|
422 tcl set ::vim::lbase 0 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
423 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
|
424 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
|
425 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
426 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
|
427 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
|
428 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
429 tcl set ::vim::lbase 1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
430 bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
431 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
432 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
433 " 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
|
434 func Test_buffer_delete() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
435 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
436 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
|
437 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
|
438 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
|
439 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
|
440 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
441 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
|
442 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
|
443 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
|
444 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
445 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
|
446 call assert_fails('tcl $::vim::current(buffer) delete 1 2 3', 'wrong # args:') |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
447 call assert_fails('tcl $::vim::current(buffer) delete 1 abc', |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
448 \ 'expected integer but got "abc"') |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
449 |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
450 " Try to delete lines from an 'nomodifiable' buffer |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
451 set nomodifiable |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
452 call assert_fails('tcl $::vim::current(buffer) delete 2 1', |
21269
0a8322506058
patch 8.2.1185: some other tests fail
Bram Moolenaar <Bram@vim.org>
parents:
21228
diff
changeset
|
453 \ ['E21:', 'cannot save undo information']) |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
454 set modifiable |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
455 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
456 bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
457 endfunc |
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 " 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
|
460 func Test_buffer_insert() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
461 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
462 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
|
463 tcl $buf insert 1 "first" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
464 tcl $buf insert 2 "second" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
465 tcl $buf insert 2 "third" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
466 tcl $buf insert 4 "fourth" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
467 tcl $buf insert 1 "fifth" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
468 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
|
469 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
470 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
|
471 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
|
472 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
|
473 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
474 tcl unset buf |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
475 bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
476 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
477 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
478 " 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
|
479 func Test_buffer_append() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
480 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
481 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
|
482 tcl $buf append 1 "first" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
483 tcl $buf append 2 "second" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
484 tcl $buf append 2 "third" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
485 tcl $buf append 4 "fourth" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
486 tcl $buf append 1 "fifth" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
487 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
|
488 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
489 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
|
490 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
|
491 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
|
492 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
493 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
|
494 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
|
495 |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
496 " Try to append lines to a 'nomodifiable' buffer |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
497 set nomodifiable |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
498 call assert_fails('tcl $buf append 1 "first"', |
21269
0a8322506058
patch 8.2.1185: some other tests fail
Bram Moolenaar <Bram@vim.org>
parents:
21228
diff
changeset
|
499 \ ['E21:', 'cannot save undo information']) |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
500 set modifiable |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
501 |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
502 tcl unset buf |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
503 bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
504 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
505 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
506 " 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
|
507 func Test_buffer_set() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
508 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
509 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
|
510 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
|
511 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
|
512 |
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
513 " 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
|
514 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
|
515 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
|
516 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
|
517 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
|
518 |
14294
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
519 " 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
|
520 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
|
521 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
|
522 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
|
523 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
|
524 |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
525 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
|
526 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
|
527 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
528 call assert_fails('tcl $::vim::current(buffer) set', 'wrong # args:') |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
529 call assert_fails('tcl $::vim::current(buffer) set 1 2 {[list "a" "b"]}', |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
530 \ 'list element in quotes followed by "]" instead of space') |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
531 |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
532 " Try to modify a 'nomodifiable' buffer |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
533 set nomodifiable |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
534 call assert_fails('tcl $::vim::current(buffer) set 1 "x"', |
21269
0a8322506058
patch 8.2.1185: some other tests fail
Bram Moolenaar <Bram@vim.org>
parents:
21228
diff
changeset
|
535 \ ['E21:', 'cannot save undo information']) |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
536 call assert_fails('tcl $::vim::current(buffer) set 1 {a b}', |
21269
0a8322506058
patch 8.2.1185: some other tests fail
Bram Moolenaar <Bram@vim.org>
parents:
21228
diff
changeset
|
537 \ ['E21:', 'cannot save undo information']) |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
538 call assert_fails('tcl $::vim::current(buffer) set 1 2 {a b}', |
21269
0a8322506058
patch 8.2.1185: some other tests fail
Bram Moolenaar <Bram@vim.org>
parents:
21228
diff
changeset
|
539 \ ['E21:', 'cannot save undo information']) |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
540 set modifiable |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
541 bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
542 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
543 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
544 " 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
|
545 func Test_buffer_get() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
546 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
547 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
|
548 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
|
549 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
550 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
|
551 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
|
552 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
|
553 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
|
554 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
555 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
|
556 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
|
557 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
|
558 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
|
559 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
560 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
|
561 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
|
562 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
|
563 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
564 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
|
565 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
|
566 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
|
567 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
|
568 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
569 call assert_fails('tcl $::vim::current(buffer) get x', 'expected integer but got "x"') |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
570 call assert_fails('tcl $::vim::current(buffer) get 1 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
|
571 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
|
572 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
573 tcl unset buf |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
574 bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
575 endfunc |
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 " 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
|
578 func Test_buffer_mark() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
579 new |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
580 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
|
581 /three |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
582 norm! ma |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
583 norm! jllmB |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
584 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
585 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
|
586 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
|
587 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
588 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
|
589 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
|
590 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
|
591 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
592 delmarks aB |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
593 bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
594 endfunc |
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 " 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
|
597 func Test_buffer_option() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
598 new Xfoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
599 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
|
600 new Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
601 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
|
602 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
603 tcl $b1 option foldcolumn 2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
604 tcl $b2 option foldcolumn 3 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
605 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
606 call assert_equal(3, &foldcolumn) |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
607 wincmd j |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
608 call assert_equal(2, &foldcolumn) |
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 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
|
611 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
|
612 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
613 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
|
614 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
615 set foldcolumn& |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
616 tcl unset b1 b2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
617 %bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
618 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
619 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
620 " 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
|
621 func Test_buffer_expr() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
622 new Xfoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
623 norm ifoo1 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
624 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
|
625 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
626 new Xfoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
627 norm ifoo2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
628 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
|
629 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
630 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
|
631 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
|
632 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
633 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
|
634 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
635 tcl unset b1 b2 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
636 %bwipe! |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
637 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
638 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
639 " 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
|
640 func Test_buffer_delcmd() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
641 new Xfoo |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
642 split |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
643 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
|
644 q |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
645 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
|
646 q |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
647 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
|
648 |
21228
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
649 call assert_fails('tcl $::vim::current(buffer) delcmd', 'wrong # args') |
91b1047d4aa4
patch 8.2.1165: insufficient testing for the Tcl interface
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
650 call assert_fails('tcl $::vim::current(buffer) delcmd x x', 'wrong # args') |
14268
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 tcl unset msg |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
653 %bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
654 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
655 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
656 func Test_vim_current() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
657 " 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
|
658 " tested by many other tests. |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
659 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
|
660 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
|
661 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
662 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
663 " 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
|
664 func Test_buffer_windows() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
665 new Xfoo |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
666 split |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
667 new Xbar |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
668 split |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
669 vsplit |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
670 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
671 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
|
672 2wincmd j |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
673 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
|
674 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
675 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
|
676 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
|
677 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
678 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
|
679 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
680 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
|
681 %bwipe |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
682 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
683 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
684 " Test :tclfile |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
685 func Test_tclfile() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
686 call delete('Xtcl_file') |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
687 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
|
688 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
|
689 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
690 tclfile Xtcl_file |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
691 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
|
692 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
693 tcl unset pi |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
694 call delete('Xtcl_file') |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
695 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
696 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
697 " 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
|
698 func Test_tclfile_error() |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
699 call delete('Xtcl_file') |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
700 call writefile(['xyz'], 'Xtcl_file') |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
701 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
|
702 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
703 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
|
704 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
705 call delete('Xtcl_file') |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
706 endfunc |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
707 |
14294
6c5c8de48152
patch 8.1.0163: insufficient testing for Tcl
Christian Brabandt <cb@256bit.org>
parents:
14268
diff
changeset
|
708 " 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
|
709 func Test_tcl_exit() |
19740
a653d1a165ef
patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
710 call assert_fails('tcl exit 1 1', 'wrong # args: should be "exit ?returnCode?"') |
a653d1a165ef
patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
711 call assert_fails('tcl exit x', 'expected integer but got "x"') |
a653d1a165ef
patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
712 |
14268
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
713 tcl set foo "foo" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
714 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
|
715 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
716 " 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
|
717 " 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
|
718 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
|
719 tcl set bar "bar" |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
720 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
|
721 |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
722 tcl unset bar |
c80acf74e7df
patch 8.1.0150: insufficient test coverage for Tcl
Christian Brabandt <cb@256bit.org>
parents:
10763
diff
changeset
|
723 endfunc |
14395
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14294
diff
changeset
|
724 |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14294
diff
changeset
|
725 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
|
726 " 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
|
727 new |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14294
diff
changeset
|
728 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
|
729 normal gg |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14294
diff
changeset
|
730 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
|
731 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
|
732 |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14294
diff
changeset
|
733 " 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
|
734 normal j |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14294
diff
changeset
|
735 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
|
736 endfunc |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
737 |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
738 " Test for different syntax for ruby heredoc |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
739 func Test_tcl_heredoc() |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
740 tcl << END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
741 ::vim::command {let s = "A"} |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
742 END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
743 tcl << |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
744 ::vim::command {let s ..= "B"} |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
745 . |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
746 tcl << trim END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
747 ::vim::command {let s ..= "C"} |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
748 END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
749 tcl << trim |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
750 ::vim::command {let s ..= "D"} |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
751 . |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
752 call assert_equal('ABCD', s) |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
753 endfunc |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
754 |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
755 " vim: shiftwidth=2 sts=2 expandtab |