Skip to content

Commit 9d9c356

Browse files
committed
patch 8.0.0153: system() test fails on MS-Windows
Problem: system() test fails on MS-Windows. Solution: Deal when extra space and CR.
1 parent 04e94c7 commit 9d9c356

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

src/testdir/test_system.vim

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,36 @@ function! Test_System()
44
if !executable('echo') || !executable('cat') || !executable('wc')
55
return
66
endif
7-
call assert_equal("123\n", system('echo 123'))
8-
call assert_equal(['123'], systemlist('echo 123'))
7+
let out = system('echo 123')
8+
" On Windows we may get a trailing space.
9+
if out != "123 \n"
10+
call assert_equal("123\n", out)
11+
endif
12+
13+
let out = systemlist('echo 123')
14+
" On Windows we may get a trailing space and CR.
15+
if out != ["123 \r"]
16+
call assert_equal(['123'], out)
17+
endif
18+
919
call assert_equal('123', system('cat', '123'))
1020
call assert_equal(['123'], systemlist('cat', '123'))
1121
call assert_equal(["as\<NL>df"], systemlist('cat', ["as\<NL>df"]))
1222
new Xdummy
1323
call setline(1, ['asdf', "pw\<NL>er", 'xxxx'])
1424
call assert_equal("3\n", system('wc -l', bufnr('%')))
15-
call assert_equal(['3'], systemlist('wc -l', bufnr('%')))
16-
call assert_equal(['asdf', "pw\<NL>er", 'xxxx'], systemlist('cat', bufnr('%')))
25+
26+
let out = systemlist('wc -l', bufnr('%'))
27+
" On Windows we may get a trailing CR.
28+
if out != ["3\r"]
29+
call assert_equal(['3'], out)
30+
endif
31+
32+
let out = systemlist('cat', bufnr('%'))
33+
" On Windows we may get a trailing CR.
34+
if out != ["asdf\r", "pw\<NL>er\r", "xxxx\r"]
35+
call assert_equal(['asdf', "pw\<NL>er", 'xxxx'], out)
36+
endif
1737
bwipe!
1838

1939
call assert_fails('call system("wc -l", 99999)', 'E86:')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
153,
767769
/**/
768770
152,
769771
/**/

0 commit comments

Comments
 (0)