test: correct order of arguments to eq() and neq()

This commit is contained in:
zeertzjq
2022-04-26 11:35:05 +08:00
parent 5d159a7faa
commit 519e4c4472
14 changed files with 101 additions and 101 deletions

View File

@@ -12,7 +12,7 @@ describe('reltimestr(), reltimefloat()', function()
local later = reltime()
local elapsed = reltime(now)
neq(reltimestr(elapsed), '0.0')
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%."))
@@ -26,7 +26,7 @@ describe('reltimestr(), reltimefloat()', function()
eq(0.0, reltimefloat(same))
local differs = reltime(now, later)
neq(reltimestr(differs), '0.0')
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%."))

View File

@@ -24,41 +24,41 @@ describe('setpos() function', function()
end)
it('can set the current cursor position', function()
setpos(".", {0, 2, 1, 0})
eq(getpos("."), {0, 2, 1, 0})
eq({0, 2, 1, 0}, getpos("."))
setpos(".", {2, 1, 1, 0})
eq(getpos("."), {0, 1, 1, 0})
eq({0, 1, 1, 0}, getpos("."))
local ret = exc_exec('call setpos(".", [1, 1, 1, 0])')
eq(0, ret)
end)
it('can set lowercase marks in the current buffer', function()
setpos("'d", {0, 2, 1, 0})
eq(getpos("'d"), {0, 2, 1, 0})
eq({0, 2, 1, 0}, getpos("'d"))
command('undo')
command('call setpos("\'d", [2, 3, 1, 0])')
eq(getpos("'d"), {0, 3, 1, 0})
eq({0, 3, 1, 0}, getpos("'d"))
end)
it('can set lowercase marks in other buffers', function()
local retval = setpos("'d", {1, 2, 1, 0})
eq(0, retval)
setpos("'d", {1, 2, 1, 0})
eq(getpos("'d"), {0, 0, 0, 0})
eq({0, 0, 0, 0}, getpos("'d"))
command('wincmd w')
eq(eval('bufnr("%")'), 1)
eq(getpos("'d"), {0, 2, 1, 0})
eq(1, eval('bufnr("%")'))
eq({0, 2, 1, 0}, getpos("'d"))
end)
it("fails when setting a mark in a buffer that doesn't exist", function()
local retval = setpos("'d", {3, 2, 1, 0})
eq(-1, retval)
eq(getpos("'d"), {0, 0, 0, 0})
eq({0, 0, 0, 0}, getpos("'d"))
retval = setpos("'D", {3, 2, 1, 0})
eq(-1, retval)
eq(getpos("'D"), {0, 0, 0, 0})
eq({0, 0, 0, 0}, getpos("'D"))
end)
it('can set uppercase marks', function()
setpos("'D", {2, 2, 3, 0})
eq(getpos("'D"), {2, 2, 3, 0})
eq({2, 2, 3, 0}, getpos("'D"))
-- Can set a mark in another buffer
setpos("'D", {1, 2, 2, 0})
eq(getpos("'D"), {1, 2, 2, 0})
eq({1, 2, 2, 0}, getpos("'D"))
end)
end)