diff options
author | ZyX <kp-pav@yandex.ru> | 2017-11-19 21:46:54 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-11-19 22:01:14 +0300 |
commit | 7c20f60b88b1df97af8ea4a6a5b9727c72748ec1 (patch) | |
tree | c95299ca12fc59b1232efc08d7744dfdc98cb68f /test/unit/helpers.lua | |
parent | ebb33eddd9ad0e9cec5013be2e37c8f9b0546c77 (diff) | |
download | rneovim-7c20f60b88b1df97af8ea4a6a5b9727c72748ec1.tar.gz rneovim-7c20f60b88b1df97af8ea4a6a5b9727c72748ec1.tar.bz2 rneovim-7c20f60b88b1df97af8ea4a6a5b9727c72748ec1.zip |
unittests: Avoid infinite cycle somewhere because of init failure
Diffstat (limited to 'test/unit/helpers.lua')
-rw-r--r-- | test/unit/helpers.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua index 2c148630dd..7689c1824b 100644 --- a/test/unit/helpers.lua +++ b/test/unit/helpers.lua @@ -644,13 +644,15 @@ local function itp_child(wr, func) s = s:sub(1, hook_msglen - 2) sc.write(wr, '>' .. s .. (' '):rep(hook_msglen - 2 - #s) .. '\n') end - init() - collectgarbage('stop') - child_sethook(wr) - local err, emsg = pcall(func) - collectgarbage('restart') - collectgarbage() - debug.sethook() + local err, emsg = pcall(init) + if err then + collectgarbage('stop') + child_sethook(wr) + err, emsg = pcall(func) + collectgarbage('restart') + collectgarbage() + debug.sethook() + end emsg = tostring(emsg) sc.write(wr, trace_end_msg) if not err then |