diff options
author | ZyX <kp-pav@yandex.ru> | 2017-03-17 00:04:03 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-19 14:13:21 +0300 |
commit | 0320a58082f922b54cb36ce57064c07a9e781aa8 (patch) | |
tree | 74f18e6450124946c5e7b1c8708232241fe55f01 /test/unit/preprocess.lua | |
parent | 65c41e6c2b5015ff0b0485aadd362c0883a02a85 (diff) | |
download | rneovim-0320a58082f922b54cb36ce57064c07a9e781aa8.tar.gz rneovim-0320a58082f922b54cb36ce57064c07a9e781aa8.tar.bz2 rneovim-0320a58082f922b54cb36ce57064c07a9e781aa8.zip |
functests: Check that `-s` works as expected
Diffstat (limited to 'test/unit/preprocess.lua')
-rw-r--r-- | test/unit/preprocess.lua | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/test/unit/preprocess.lua b/test/unit/preprocess.lua index 363358d134..18b2284e3d 100644 --- a/test/unit/preprocess.lua +++ b/test/unit/preprocess.lua @@ -2,6 +2,10 @@ -- windows, will probably need quite a bit of adjustment to run there. local ffi = require("ffi") +local global_helpers = require('test.helpers') + +local popen_r = global_helpers.popen_r +local argss_to_cmd = global_helpers.argss_to_cmd local ccs = {} @@ -22,15 +26,6 @@ table.insert(ccs, {path = {"/usr/bin/env", "gcc-4.7"}, type = "gcc"}) table.insert(ccs, {path = {"/usr/bin/env", "clang"}, type = "clang"}) table.insert(ccs, {path = {"/usr/bin/env", "icc"}, type = "gcc"}) -local quote_me = '[^.%w%+%-%@%_%/]' -- complement (needn't quote) -local function shell_quote(str) - if string.find(str, quote_me) or str == '' then - return "'" .. string.gsub(str, "'", [['"'"']]) .. "'" - else - return str - end -end - -- parse Makefile format dependencies into a Lua table local function parse_make_deps(deps) -- remove line breaks and line concatenators @@ -149,16 +144,6 @@ function Gcc:add_to_include_path(...) end end -local function argss_to_cmd(...) - local cmd = '' - for i = 1, select('#', ...) do - for _, arg in ipairs(select(i, ...)) do - cmd = cmd .. ' ' .. shell_quote(arg) - end - end - return cmd -end - -- returns a list of the headers files upon which this file relies function Gcc:dependencies(hdr) local cmd = argss_to_cmd(self.path, {'-M', hdr}) .. ' 2>&1' @@ -173,9 +158,8 @@ function Gcc:dependencies(hdr) end local function repeated_call(...) - local cmd = argss_to_cmd(...) for _ = 1, 10 do - local stream = io.popen(cmd) + local stream = popen_r(...) local ret = stream:read('*a') stream:close() if ret then |