]> granicus.if.org Git - vim/commitdiff
patch 8.0.0153: system() test fails on MS-Windows v8.0.0153
authorBram Moolenaar <Bram@vim.org>
Sun, 8 Jan 2017 12:55:06 +0000 (13:55 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 8 Jan 2017 12:55:06 +0000 (13:55 +0100)
Problem:    system() test fails on MS-Windows.
Solution:   Deal when extra space and CR.

src/testdir/test_system.vim
src/version.c

index 5e8d68b1413040fba3e3654d15c189df3bb21cc7..be00d180c4046ac285c738f7030499f67f0e2a4c 100644 (file)
@@ -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:')
index 438a65d200dbe1f6ba87b3337c52d22fe2dc9615..a1a74696afde6d940213fa60a2180465ec1604fa 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    153,
 /**/
     152,
 /**/