changeset 10526:06724e21d8c1 v8.0.0153

commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 8 13:55:06 2017 +0100 patch 8.0.0153: system() test fails on MS-Windows Problem: system() test fails on MS-Windows. Solution: Deal when extra space and CR.
author Christian Brabandt <cb@256bit.org>
date Sun, 08 Jan 2017 14:00:04 +0100
parents 80f969a6cae2
children d6990fcba559
files src/testdir/test_system.vim src/version.c
diffstat 2 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_system.vim
+++ b/src/testdir/test_system.vim
@@ -4,16 +4,36 @@ function! Test_System()
   if !executable('echo') || !executable('cat') || !executable('wc')
     return
   endif
-  call assert_equal("123\n", system('echo 123'))
-  call assert_equal(['123'], systemlist('echo 123'))
+  let out = system('echo 123')
+  " On Windows we may get a trailing space.
+  if out != "123 \n"
+    call assert_equal("123\n", out)
+  endif
+
+  let out = systemlist('echo 123')
+  " On Windows we may get a trailing space and CR.
+  if out != ["123 \r"]
+    call assert_equal(['123'], out)
+  endif
+
   call assert_equal('123',   system('cat', '123'))
   call assert_equal(['123'], systemlist('cat', '123'))
   call assert_equal(["as\<NL>df"], systemlist('cat', ["as\<NL>df"]))
   new Xdummy
   call setline(1, ['asdf', "pw\<NL>er", 'xxxx'])
   call assert_equal("3\n",  system('wc -l', bufnr('%')))
-  call assert_equal(['3'],  systemlist('wc -l', bufnr('%')))
-  call assert_equal(['asdf', "pw\<NL>er", 'xxxx'],  systemlist('cat', bufnr('%')))
+
+  let out = systemlist('wc -l', bufnr('%'))
+  " On Windows we may get a trailing CR.
+  if out != ["3\r"]
+    call assert_equal(['3'],  out)
+  endif
+
+  let out = systemlist('cat', bufnr('%'))
+  " On Windows we may get a trailing CR.
+  if out != ["asdf\r", "pw\<NL>er\r", "xxxx\r"]
+    call assert_equal(['asdf', "pw\<NL>er", 'xxxx'],  out)
+  endif
   bwipe!
 
   call assert_fails('call system("wc -l", 99999)', 'E86:')
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    153,
+/**/
     152,
 /**/
     151,