aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-08-21 02:32:20 +0200
committerGitHub <noreply@github.com>2019-08-21 02:32:20 +0200
commit47e27a4f5b2b2ae20e20a51a6cf0f76078c28698 (patch)
tree5c09c34ee2d7a2f588222a7edcc30aa96a2ea8fa
parent7adea68c1eab6ba71344aa24aaf5026b824d7ea1 (diff)
downloadrneovim-47e27a4f5b2b2ae20e20a51a6cf0f76078c28698.tar.gz
rneovim-47e27a4f5b2b2ae20e20a51a6cf0f76078c28698.tar.bz2
rneovim-47e27a4f5b2b2ae20e20a51a6cf0f76078c28698.zip
tests: support msg with global_helpers.ok (#10820)
Ref: https://github.com/neovim/neovim/pull/10768#discussion_r315904175 Co-Authored-By: Justin M. Keyes <justinkz@gmail.com>
-rw-r--r--test/functional/api/proc_spec.lua7
-rw-r--r--test/functional/api/server_requests_spec.lua3
-rw-r--r--test/functional/eval/timer_spec.lua3
-rw-r--r--test/helpers.lua4
4 files changed, 9 insertions, 8 deletions
diff --git a/test/functional/api/proc_spec.lua b/test/functional/api/proc_spec.lua
index e11e03203f..063d382790 100644
--- a/test/functional/api/proc_spec.lua
+++ b/test/functional/api/proc_spec.lua
@@ -4,8 +4,8 @@ local clear = helpers.clear
local eq = helpers.eq
local funcs = helpers.funcs
local iswin = helpers.iswin
+local neq = helpers.neq
local nvim_argv = helpers.nvim_argv
-local ok = helpers.ok
local request = helpers.request
local retry = helpers.retry
local NIL = helpers.NIL
@@ -63,8 +63,9 @@ describe('api', function()
local pid = funcs.getpid()
local pinfo = request('nvim_get_proc', pid)
eq((iswin() and 'nvim.exe' or 'nvim'), pinfo.name)
- ok(pinfo.pid == pid)
- ok(type(pinfo.ppid) == 'number' and pinfo.ppid ~= pid)
+ eq(pinfo.pid, pid)
+ eq(type(pinfo.ppid), 'number')
+ neq(pinfo.ppid, pid)
end)
it('validates input', function()
diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua
index dbe9f20412..ddd044a10f 100644
--- a/test/functional/api/server_requests_spec.lua
+++ b/test/functional/api/server_requests_spec.lua
@@ -169,8 +169,7 @@ describe('server -> client', function()
if method == "notification" then
eq('done!', eval('rpcrequest('..cid..', "nested")'))
elseif method == "nested_done" then
- -- this should never have been sent
- ok(false)
+ ok(false, 'this should never have been sent')
end
end
diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua
index 51d79867dd..5c5b1b42cb 100644
--- a/test/functional/eval/timer_spec.lua
+++ b/test/functional/eval/timer_spec.lua
@@ -94,7 +94,8 @@ describe('timers', function()
command("call timer_start(5, 'MyHandler', {'repeat': -1})")
nvim_async("command", "let g:val = 0 | let g:c = getchar()")
retry(nil, nil, function()
- ok(eval("g:val") >= 2)
+ local val = eval("g:val")
+ ok(val >= 2, "expected >= 2, got: "..tostring(val))
eq(0, eval("getchar(1)"))
end)
feed("c")
diff --git a/test/helpers.lua b/test/helpers.lua
index e14bcff2c8..ce5e8b9c04 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -59,8 +59,8 @@ end
function module.neq(expected, actual, context)
return assert.are_not.same(expected, actual, context)
end
-function module.ok(res)
- return assert.is_true(res)
+function module.ok(res, msg)
+ return assert.is_true(res, msg)
end
function module.near(actual, expected, tolerance)
return assert.is.near(actual, expected, tolerance)