Hi Bram and mattn,

2016/2/15 Mon 18:15:45 UTC+9 mattn wrote:
> test_channel.vim should work with following patch. But test_channel.vim have 
> a problem that doesn't work with python provided on msys2/mingw64. The patch 
> for this problem will be present from Ken Takata in later.

I have attached the patch for this.
This tries to use py.exe first and python.exe next.
Also includes fixes for line endings. (test_channel_pipe.py might return CRLF
on Windows.)

Regards,
Ken Takata

-- 
-- 
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.
# HG changeset patch
# Parent  99133880a7964538d76483831bdd52f4bfb2b16f

diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -13,9 +13,14 @@ if has('unix')
   if !(executable('python') && (has('job') || executable('pkill')))
     finish
   endif
+  let s:python = 'python'
 elseif has('win32')
-  " Use Python Launcher for Windows (py.exe).
-  if !executable('py')
+  " Use Python Launcher for Windows (py.exe) if available.
+  if executable('py.exe')
+    let s:python = 'py.exe'
+  elseif executable('python.exe')
+    let s:python = 'python.exe'
+  else
     finish
   endif
 else
@@ -32,11 +37,11 @@ func s:run_server(testfunc)
 
   try
     if has('job')
-      let s:job = job_start("python test_channel.py")
+      let s:job = job_start(s:python . " test_channel.py")
     elseif has('win32')
-      silent !start cmd /c start "test_channel" py test_channel.py
+      exe 'silent !start cmd /c start "test_channel" ' . s:python . ' test_channel.py'
     else
-      silent !python test_channel.py&
+      exe 'silent !' . s:python . ' test_channel.py&'
     endif
 
     " Wait for up to 2 seconds for the port number to be there.
@@ -77,7 +82,7 @@ func s:kill_server()
       unlet s:job
     endif
   elseif has('win32')
-    call system('taskkill /IM py.exe /T /F /FI "WINDOWTITLE eq test_channel"')
+    call system('taskkill /IM ' . s:python . ' /T /F /FI "WINDOWTITLE eq test_channel"')
   else
     call system("pkill -f test_channel.py")
   endif
@@ -280,16 +285,21 @@ func Test_connect_waittime()
 endfunc
 
 func Test_pipe()
-  if !has('job') || !has('unix')
+  if !has('job')
     return
   endif
-  let job = job_start("python test_channel_pipe.py")
+  let job = job_start(s:python . " test_channel_pipe.py")
   call assert_equal("run", job_status(job))
   try
     let handle = job_getchannel(job)
+
     call ch_sendraw(handle, "echo something\n", 0)
-    call assert_equal("something\n", ch_readraw(handle))
+    let reply = ch_readraw(handle))
+    let reply = substitute(reply, '\r', '', '')
+    call assert_equal("something\n", reply)
+
     let reply = ch_sendraw(handle, "quit\n")
+    let reply = substitute(reply, '\r', '', '')
     call assert_equal("Goodbye!\n", reply)
   finally
     call job_stop(job)

Raspunde prin e-mail lui