Patch 7.4.1661
Problem:    No test for special characters in channel eval command.
Solution:   Testing sending and receiving text with special characters.
Files:      src/testdir/test_channel.vim, src/testdir/test_channel.py


*** ../vim-7.4.1660/src/testdir/test_channel.vim        2016-03-21 
23:18:49.345362408 +0100
--- src/testdir/test_channel.vim        2016-03-26 22:17:58.031602922 +0100
***************
*** 192,211 ****
    sleep 10m
    call assert_equal([-1, 'foo123'], ch_evalexpr(handle, 'eval-result'))
  
    " Send an eval request that fails.
    call assert_equal('ok', ch_evalexpr(handle, 'eval-fails'))
    sleep 10m
!   call assert_equal([-2, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
  
    " Send an eval request that works but can't be encoded.
    call assert_equal('ok', ch_evalexpr(handle, 'eval-error'))
    sleep 10m
!   call assert_equal([-3, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
  
    " Send a bad eval request. There will be no response.
    call assert_equal('ok', ch_evalexpr(handle, 'eval-bad'))
    sleep 10m
!   call assert_equal([-3, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
  
    " Send an expr request
    call assert_equal('ok', ch_evalexpr(handle, 'an expr'))
--- 192,222 ----
    sleep 10m
    call assert_equal([-1, 'foo123'], ch_evalexpr(handle, 'eval-result'))
  
+   " Send an eval request with special characters.
+   call assert_equal('ok', ch_evalexpr(handle, 'eval-special'))
+   sleep 10m
+   call assert_equal([-2, "foo\x7f\x10\x01bar"], ch_evalexpr(handle, 
'eval-result'))
+ 
+   " Send an eval request to get a line with special characters.
+   call setline(3, "a\nb\<CR>c\x01d\x7fe")
+   call assert_equal('ok', ch_evalexpr(handle, 'eval-getline'))
+   sleep 10m
+   call assert_equal([-3, "a\nb\<CR>c\x01d\x7fe"], ch_evalexpr(handle, 
'eval-result'))
+ 
    " Send an eval request that fails.
    call assert_equal('ok', ch_evalexpr(handle, 'eval-fails'))
    sleep 10m
!   call assert_equal([-4, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
  
    " Send an eval request that works but can't be encoded.
    call assert_equal('ok', ch_evalexpr(handle, 'eval-error'))
    sleep 10m
!   call assert_equal([-5, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
  
    " Send a bad eval request. There will be no response.
    call assert_equal('ok', ch_evalexpr(handle, 'eval-bad'))
    sleep 10m
!   call assert_equal([-5, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
  
    " Send an expr request
    call assert_equal('ok', ch_evalexpr(handle, 'an expr'))
*** ../vim-7.4.1660/src/testdir/test_channel.py 2016-03-20 18:24:40.502259462 
+0100
--- src/testdir/test_channel.py 2016-03-26 22:12:51.994732000 +0100
***************
*** 85,100 ****
                          print("sending: {0}".format(cmd))
                          self.request.sendall(cmd.encode('utf-8'))
                          response = "ok"
                      elif decoded[1] == 'eval-fails':
                          # Send an eval request that will fail.
!                         cmd = '["expr","xxx", -2]'
                          print("sending: {0}".format(cmd))
                          self.request.sendall(cmd.encode('utf-8'))
                          response = "ok"
                      elif decoded[1] == 'eval-error':
                          # Send an eval request that works but the result can't
                          # be encoded.
!                         cmd = '["expr","function(\\"tr\\")", -3]'
                          print("sending: {0}".format(cmd))
                          self.request.sendall(cmd.encode('utf-8'))
                          response = "ok"
--- 85,112 ----
                          print("sending: {0}".format(cmd))
                          self.request.sendall(cmd.encode('utf-8'))
                          response = "ok"
+                     elif decoded[1] == 'eval-special':
+                         # Send an eval request.  We ignore the response.
+                         cmd = '["expr","\\"foo\x7f\x10\x01bar\\"", -2]'
+                         print("sending: {0}".format(cmd))
+                         self.request.sendall(cmd.encode('utf-8'))
+                         response = "ok"
+                     elif decoded[1] == 'eval-getline':
+                         # Send an eval request.  We ignore the response.
+                         cmd = '["expr","getline(3)", -3]'
+                         print("sending: {0}".format(cmd))
+                         self.request.sendall(cmd.encode('utf-8'))
+                         response = "ok"
                      elif decoded[1] == 'eval-fails':
                          # Send an eval request that will fail.
!                         cmd = '["expr","xxx", -4]'
                          print("sending: {0}".format(cmd))
                          self.request.sendall(cmd.encode('utf-8'))
                          response = "ok"
                      elif decoded[1] == 'eval-error':
                          # Send an eval request that works but the result can't
                          # be encoded.
!                         cmd = '["expr","function(\\"tr\\")", -5]'
                          print("sending: {0}".format(cmd))
                          self.request.sendall(cmd.encode('utf-8'))
                          response = "ok"
*** ../vim-7.4.1660/src/version.c       2016-03-26 21:24:10.548534905 +0100
--- src/version.c       2016-03-26 22:18:32.671246967 +0100
***************
*** 750,751 ****
--- 750,753 ----
  {   /* Add new patch number below this line */
+ /**/
+     1661,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
134. You consider bandwidth to be more important than carats.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui