diff options
| author | ZyX <kp-pav@yandex.ru> | 2016-11-01 12:20:42 +0300 | 
|---|---|---|
| committer | ZyX <kp-pav@yandex.ru> | 2017-03-11 23:23:30 +0300 | 
| commit | ff5dca66303f289bf3c4ba406df57a548022cccc (patch) | |
| tree | c52c691473070f9a9144a569ef39c6ada720ef44 /test/unit/helpers.lua | |
| parent | 1edb3ccc3699d1782a1d1a12ce2429ce0dcdcfcb (diff) | |
| download | rneovim-ff5dca66303f289bf3c4ba406df57a548022cccc.tar.gz rneovim-ff5dca66303f289bf3c4ba406df57a548022cccc.tar.bz2 rneovim-ff5dca66303f289bf3c4ba406df57a548022cccc.zip | |
unittests: Log syscalls if requested
Diffstat (limited to 'test/unit/helpers.lua')
| -rw-r--r-- | test/unit/helpers.lua | 23 | 
1 files changed, 23 insertions, 0 deletions
| diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua index 832cbcbd4a..b66602b886 100644 --- a/test/unit/helpers.lua +++ b/test/unit/helpers.lua @@ -343,6 +343,29 @@ else    }  end +local function format_list(lst) +  local ret = '' +  for _, v in ipairs(lst) do +    if ret ~= '' then ret = ret .. ', ' end +    ret = ret .. assert:format({v, n=1})[1] +  end +  return ret +end + +if os.getenv('NVIM_TEST_PRINT_SYSCALLS') == '1' then +  for k_, v_ in pairs(sc) do +    (function(k, v) +      local f = sc[k] +      sc[k] = function(...) +        local rets = {f(...)} +        io.stderr:write(('%s(%s) = %s\n'):format(k, format_list({...}), +                                                 format_list(rets))) +        return unpack(rets) +      end +    end)(k_, v_) +  end +end +  local function gen_itp(it)    local function just_fail(_)      return false | 
