aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-30 09:29:21 +0800
committerGitHub <noreply@github.com>2024-03-30 09:29:21 +0800
commit35239e977f53c25016b57729cada612aa53e11d4 (patch)
tree45e24edd39b7b80199d4a2b510add5c57f4148a8 /test/functional/vimscript
parent19d63563e1cceabbf8603d0abb2e88fae5bd3626 (diff)
downloadrneovim-35239e977f53c25016b57729cada612aa53e11d4.tar.gz
rneovim-35239e977f53c25016b57729cada612aa53e11d4.tar.bz2
rneovim-35239e977f53c25016b57729cada612aa53e11d4.zip
test: use matches(...) instead of ok(string.find(...)) (#28111)
Diffstat (limited to 'test/functional/vimscript')
-rw-r--r--test/functional/vimscript/reltime_spec.lua5
-rw-r--r--test/functional/vimscript/server_spec.lua4
2 files changed, 5 insertions, 4 deletions
diff --git a/test/functional/vimscript/reltime_spec.lua b/test/functional/vimscript/reltime_spec.lua
index 7cdb78e4ce..fc4dd0d87b 100644
--- a/test/functional/vimscript/reltime_spec.lua
+++ b/test/functional/vimscript/reltime_spec.lua
@@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, eq, ok = helpers.clear, helpers.eq, helpers.ok
local neq, command, fn = helpers.neq, helpers.command, helpers.fn
+local matches = helpers.matches
local reltime, reltimestr, reltimefloat = fn.reltime, fn.reltimestr, fn.reltimefloat
describe('reltimestr(), reltimefloat()', function()
@@ -15,7 +16,7 @@ describe('reltimestr(), reltimefloat()', function()
neq('0.0', reltimestr(elapsed))
ok(reltimefloat(elapsed) > 0.0)
-- original vim test for < 0.1, but easily fails on travis
- ok(nil ~= string.match(reltimestr(elapsed), '0%.'))
+ matches('0%.', reltimestr(elapsed))
ok(reltimefloat(elapsed) < 1.0)
local same = reltime(now, now)
@@ -29,7 +30,7 @@ describe('reltimestr(), reltimefloat()', function()
neq('0.0', reltimestr(differs))
ok(reltimefloat(differs) > 0.0)
-- original vim test for < 0.1, but easily fails on travis
- ok(nil ~= string.match(reltimestr(differs), '0%.'))
+ matches('0%.', reltimestr(differs))
ok(reltimefloat(differs) < 1.0)
end)
diff --git a/test/functional/vimscript/server_spec.lua b/test/functional/vimscript/server_spec.lua
index 360fcf0dfe..c6c9e9c0ab 100644
--- a/test/functional/vimscript/server_spec.lua
+++ b/test/functional/vimscript/server_spec.lua
@@ -100,14 +100,14 @@ describe('server', function()
local s = fn.serverstart('127.0.0.1:0') -- assign random port
if #s > 0 then
- assert(string.match(s, '127.0.0.1:%d+'))
+ matches('127.0.0.1:%d+', s)
eq(s, fn.serverlist()[1])
clear_serverlist()
end
s = fn.serverstart('127.0.0.1:') -- assign random port
if #s > 0 then
- assert(string.match(s, '127.0.0.1:%d+'))
+ matches('127.0.0.1:%d+', s)
eq(s, fn.serverlist()[1])
clear_serverlist()
end