diff options
author | ZyX <kp-pav@yandex.ru> | 2016-11-04 18:20:58 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-11 23:23:30 +0300 |
commit | b44257486297a0a1ffc3fa21d045de03d0504e1b (patch) | |
tree | 8d35ba9614a2b11e64472870dad113d4607af5db /test/unit/helpers.lua | |
parent | ff5dca66303f289bf3c4ba406df57a548022cccc (diff) | |
download | rneovim-b44257486297a0a1ffc3fa21d045de03d0504e1b.tar.gz rneovim-b44257486297a0a1ffc3fa21d045de03d0504e1b.tar.bz2 rneovim-b44257486297a0a1ffc3fa21d045de03d0504e1b.zip |
unittests: Allow failing test to fail
Diffstat (limited to 'test/unit/helpers.lua')
-rw-r--r-- | test/unit/helpers.lua | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua index b66602b886..61c1107a30 100644 --- a/test/unit/helpers.lua +++ b/test/unit/helpers.lua @@ -375,7 +375,7 @@ local function gen_itp(it) assert:register('assertion', 'just_fail', just_fail, 'assertion.just_fail.positive', 'assertion.just_fail.negative') - local function itp(name, func) + local function itp(name, func, allow_failure) it(name, function() local rd, wr = sc.pipe() local pid = sc.fork() @@ -397,17 +397,28 @@ local function gen_itp(it) else sc.close(wr) sc.wait(pid) - local res = sc.read(rd, 2) - eq(2, #res) - if res == '+\n' then - return + local function check() + local res = sc.read(rd, 2) + eq(2, #res) + if res == '+\n' then + return + end + eq('-\n', res) + local len_s = sc.read(rd, 5) + local len = tonumber(len_s) + neq(0, len) + local err = sc.read(rd, len + 1) + assert.just_fail(err) + end + if allow_failure then + local err, emsg = pcall(check) + if not err then + io.stderr:write('Errorred out:\n' .. tostring(emsg) .. '\n') + os.execute([[sh -c "source .ci/common/test.sh ; check_core_dumps --delete \"\$(which luajit)\""]]) + end + else + check() end - eq('-\n', res) - local len_s = sc.read(rd, 5) - local len = tonumber(len_s) - neq(0, len) - local err = sc.read(rd, len + 1) - assert.just_fail(err) end end) end |