Skip to content

Commit f416086

Browse files
committed
patch 7.4.1265
Problem: Not all channel commands are tested. Solution: Add a test for "normal", "expr" and "redraw".
1 parent 6076fe1 commit f416086

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

src/testdir/test_channel.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def handle(self):
7575
print("sending: {}".format(cmd))
7676
self.request.sendall(cmd.encode('utf-8'))
7777
response = "ok"
78+
elif decoded[1] == 'do normal':
79+
# Send a normal command.
80+
cmd = '["normal","G$s more\u001b"]'
81+
print("sending: {}".format(cmd))
82+
self.request.sendall(cmd.encode('utf-8'))
83+
response = "ok"
7884
elif decoded[1] == 'eval-works':
7985
# Send an eval request. We ignore the response.
8086
cmd = '["eval","\\"foo\\" . 123", -1]'
@@ -93,6 +99,22 @@ def handle(self):
9399
print("sending: {}".format(cmd))
94100
self.request.sendall(cmd.encode('utf-8'))
95101
response = "ok"
102+
elif decoded[1] == 'an expr':
103+
# Send an expr request.
104+
cmd = '["expr","setline(\\"$\\", [\\"one\\",\\"two\\",\\"three\\"])"]'
105+
print("sending: {}".format(cmd))
106+
self.request.sendall(cmd.encode('utf-8'))
107+
response = "ok"
108+
elif decoded[1] == 'redraw':
109+
cmd = '["redraw",""]'
110+
print("sending: {}".format(cmd))
111+
self.request.sendall(cmd.encode('utf-8'))
112+
response = "ok"
113+
elif decoded[1] == 'redraw!':
114+
cmd = '["redraw","force"]'
115+
print("sending: {}".format(cmd))
116+
self.request.sendall(cmd.encode('utf-8'))
117+
response = "ok"
96118
elif decoded[1] == 'empty-request':
97119
cmd = '[]'
98120
print("sending: {}".format(cmd))

src/testdir/test_channel.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ func Test_communicate()
9393
call assert_equal('added1', getline(line('$') - 1))
9494
call assert_equal('added2', getline('$'))
9595

96+
call assert_equal('ok', ch_sendexpr(handle, 'do normal'))
97+
sleep 10m
98+
call assert_equal('added more', getline('$'))
99+
96100
" Send a request with a specific handler.
97101
call ch_sendexpr(handle, 'hello!', 's:RequestHandler')
98102
sleep 10m
@@ -114,6 +118,19 @@ func Test_communicate()
114118
sleep 10m
115119
call assert_equal([-2, 'ERROR'], ch_sendexpr(handle, 'eval-result'))
116120

121+
" Send an expr request
122+
call assert_equal('ok', ch_sendexpr(handle, 'an expr'))
123+
sleep 10m
124+
call assert_equal('one', getline(line('$') - 2))
125+
call assert_equal('two', getline(line('$') - 1))
126+
call assert_equal('three', getline('$'))
127+
128+
" Request a redraw, we don't check for the effect.
129+
call assert_equal('ok', ch_sendexpr(handle, 'redraw'))
130+
call assert_equal('ok', ch_sendexpr(handle, 'redraw!'))
131+
132+
call assert_equal('ok', ch_sendexpr(handle, 'empty-request'))
133+
117134
" make the server quit, can't check if this works, should not hang.
118135
call ch_sendexpr(handle, '!quit!', 0)
119136

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
1265,
745747
/**/
746748
1264,
747749
/**/

0 commit comments

Comments
 (0)