Mercurial > vim
comparison src/testdir/test_system.vim @ 10528:3ea703795a4f v8.0.0154
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 8 14:14:43 2017 +0100
patch 8.0.0154: system() test fails on OS/X
Problem: system() test fails on OS/X.
Solution: Deal with leading spaces.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 08 Jan 2017 14:15:04 +0100 |
parents | 06724e21d8c1 |
children | b0c9c1a05054 |
comparison
equal
deleted
inserted
replaced
10527:d6990fcba559 | 10528:3ea703795a4f |
---|---|
17 endif | 17 endif |
18 | 18 |
19 call assert_equal('123', system('cat', '123')) | 19 call assert_equal('123', system('cat', '123')) |
20 call assert_equal(['123'], systemlist('cat', '123')) | 20 call assert_equal(['123'], systemlist('cat', '123')) |
21 call assert_equal(["as\<NL>df"], systemlist('cat', ["as\<NL>df"])) | 21 call assert_equal(["as\<NL>df"], systemlist('cat', ["as\<NL>df"])) |
22 | |
22 new Xdummy | 23 new Xdummy |
23 call setline(1, ['asdf', "pw\<NL>er", 'xxxx']) | 24 call setline(1, ['asdf', "pw\<NL>er", 'xxxx']) |
24 call assert_equal("3\n", system('wc -l', bufnr('%'))) | 25 let out = system('wc -l', bufnr('%')) |
26 " On OS/X we get leading spaces | |
27 let out = substitute(out, '^ *', '', '') | |
28 call assert_equal("3\n", out) | |
25 | 29 |
26 let out = systemlist('wc -l', bufnr('%')) | 30 let out = systemlist('wc -l', bufnr('%')) |
27 " On Windows we may get a trailing CR. | 31 " On Windows we may get a trailing CR. |
28 if out != ["3\r"] | 32 if out != ["3\r"] |
33 " On OS/X we get leading spaces | |
34 if type(out) == v:t_list | |
35 let out[0] = substitute(out[0], '^ *', '', '') | |
36 endif | |
29 call assert_equal(['3'], out) | 37 call assert_equal(['3'], out) |
30 endif | 38 endif |
31 | 39 |
32 let out = systemlist('cat', bufnr('%')) | 40 let out = systemlist('cat', bufnr('%')) |
33 " On Windows we may get a trailing CR. | 41 " On Windows we may get a trailing CR. |