forked from aniani/vim
		
	patch 7.4.1265
Problem: Not all channel commands are tested. Solution: Add a test for "normal", "expr" and "redraw".
This commit is contained in:
		@@ -75,6 +75,12 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
 | 
			
		||||
                        print("sending: {}".format(cmd))
 | 
			
		||||
                        self.request.sendall(cmd.encode('utf-8'))
 | 
			
		||||
                        response = "ok"
 | 
			
		||||
                    elif decoded[1] == 'do normal':
 | 
			
		||||
                        # Send a normal command.
 | 
			
		||||
                        cmd = '["normal","G$s more\u001b"]'
 | 
			
		||||
                        print("sending: {}".format(cmd))
 | 
			
		||||
                        self.request.sendall(cmd.encode('utf-8'))
 | 
			
		||||
                        response = "ok"
 | 
			
		||||
                    elif decoded[1] == 'eval-works':
 | 
			
		||||
                        # Send an eval request.  We ignore the response.
 | 
			
		||||
                        cmd = '["eval","\\"foo\\" . 123", -1]'
 | 
			
		||||
@@ -93,6 +99,22 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
 | 
			
		||||
                        print("sending: {}".format(cmd))
 | 
			
		||||
                        self.request.sendall(cmd.encode('utf-8'))
 | 
			
		||||
                        response = "ok"
 | 
			
		||||
                    elif decoded[1] == 'an expr':
 | 
			
		||||
                        # Send an expr request.
 | 
			
		||||
                        cmd = '["expr","setline(\\"$\\", [\\"one\\",\\"two\\",\\"three\\"])"]'
 | 
			
		||||
                        print("sending: {}".format(cmd))
 | 
			
		||||
                        self.request.sendall(cmd.encode('utf-8'))
 | 
			
		||||
                        response = "ok"
 | 
			
		||||
                    elif decoded[1] == 'redraw':
 | 
			
		||||
                        cmd = '["redraw",""]'
 | 
			
		||||
                        print("sending: {}".format(cmd))
 | 
			
		||||
                        self.request.sendall(cmd.encode('utf-8'))
 | 
			
		||||
                        response = "ok"
 | 
			
		||||
                    elif decoded[1] == 'redraw!':
 | 
			
		||||
                        cmd = '["redraw","force"]'
 | 
			
		||||
                        print("sending: {}".format(cmd))
 | 
			
		||||
                        self.request.sendall(cmd.encode('utf-8'))
 | 
			
		||||
                        response = "ok"
 | 
			
		||||
                    elif decoded[1] == 'empty-request':
 | 
			
		||||
                        cmd = '[]'
 | 
			
		||||
                        print("sending: {}".format(cmd))
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,10 @@ func Test_communicate()
 | 
			
		||||
  call assert_equal('added1', getline(line('$') - 1))
 | 
			
		||||
  call assert_equal('added2', getline('$'))
 | 
			
		||||
 | 
			
		||||
  call assert_equal('ok', ch_sendexpr(handle, 'do normal'))
 | 
			
		||||
  sleep 10m
 | 
			
		||||
  call assert_equal('added more', getline('$'))
 | 
			
		||||
 | 
			
		||||
  " Send a request with a specific handler.
 | 
			
		||||
  call ch_sendexpr(handle, 'hello!', 's:RequestHandler')
 | 
			
		||||
  sleep 10m
 | 
			
		||||
@@ -114,6 +118,19 @@ func Test_communicate()
 | 
			
		||||
  sleep 10m
 | 
			
		||||
  call assert_equal([-2, 'ERROR'], ch_sendexpr(handle, 'eval-result'))
 | 
			
		||||
 | 
			
		||||
  " Send an expr request
 | 
			
		||||
  call assert_equal('ok', ch_sendexpr(handle, 'an expr'))
 | 
			
		||||
  sleep 10m
 | 
			
		||||
  call assert_equal('one', getline(line('$') - 2))
 | 
			
		||||
  call assert_equal('two', getline(line('$') - 1))
 | 
			
		||||
  call assert_equal('three', getline('$'))
 | 
			
		||||
 | 
			
		||||
  " Request a redraw, we don't check for the effect.
 | 
			
		||||
  call assert_equal('ok', ch_sendexpr(handle, 'redraw'))
 | 
			
		||||
  call assert_equal('ok', ch_sendexpr(handle, 'redraw!'))
 | 
			
		||||
 | 
			
		||||
  call assert_equal('ok', ch_sendexpr(handle, 'empty-request'))
 | 
			
		||||
 | 
			
		||||
  " make the server quit, can't check if this works, should not hang.
 | 
			
		||||
  call ch_sendexpr(handle, '!quit!', 0)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -742,6 +742,8 @@ static char *(features[]) =
 | 
			
		||||
 | 
			
		||||
static int included_patches[] =
 | 
			
		||||
{   /* Add new patch number below this line */
 | 
			
		||||
/**/
 | 
			
		||||
    1265,
 | 
			
		||||
/**/
 | 
			
		||||
    1264,
 | 
			
		||||
/**/
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user