mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test: correct order of arguments to eq() and neq()
This commit is contained in:
parent
5d159a7faa
commit
519e4c4472
@ -727,7 +727,7 @@ describe('autocmd api', function()
|
||||
set_ft("txt")
|
||||
set_ft("python")
|
||||
|
||||
eq(get_executed_count(), 2)
|
||||
eq(2, get_executed_count())
|
||||
end)
|
||||
|
||||
it('works getting called multiple times', function()
|
||||
@ -736,7 +736,7 @@ describe('autocmd api', function()
|
||||
set_ft()
|
||||
set_ft()
|
||||
|
||||
eq(get_executed_count(), 3)
|
||||
eq(3, get_executed_count())
|
||||
end)
|
||||
|
||||
it('handles ++once', function()
|
||||
@ -746,7 +746,7 @@ describe('autocmd api', function()
|
||||
set_ft('txt')
|
||||
set_ft('help')
|
||||
|
||||
eq(get_executed_count(), 1)
|
||||
eq(1, get_executed_count())
|
||||
end)
|
||||
|
||||
it('errors on unexpected keys', function()
|
||||
@ -874,7 +874,7 @@ describe('autocmd api', function()
|
||||
set_ft("txt")
|
||||
set_ft("python")
|
||||
|
||||
eq(get_executed_count(), 1)
|
||||
eq(1, get_executed_count())
|
||||
end)
|
||||
|
||||
it('autocmds can be registered multiple times.', function()
|
||||
@ -888,7 +888,7 @@ describe('autocmd api', function()
|
||||
set_ft("txt")
|
||||
set_ft("python")
|
||||
|
||||
eq(get_executed_count(), 3 * 2)
|
||||
eq(3 * 2, get_executed_count())
|
||||
end)
|
||||
|
||||
it('can be deleted', function()
|
||||
|
@ -63,9 +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)
|
||||
eq(pinfo.pid, pid)
|
||||
eq(type(pinfo.ppid), 'number')
|
||||
neq(pinfo.ppid, pid)
|
||||
eq(pid, pinfo.pid)
|
||||
eq('number', type(pinfo.ppid))
|
||||
neq(pid, pinfo.ppid)
|
||||
end)
|
||||
|
||||
it('validates input', function()
|
||||
|
@ -122,9 +122,9 @@ describe('API', function()
|
||||
|
||||
-- Functions
|
||||
nvim('exec', 'function Foo()\ncall setline(1,["xxx"])\nendfunction', false)
|
||||
eq(nvim('get_current_line'), '')
|
||||
eq('', nvim('get_current_line'))
|
||||
nvim('exec', 'call Foo()', false)
|
||||
eq(nvim('get_current_line'), 'xxx')
|
||||
eq('xxx', nvim('get_current_line'))
|
||||
|
||||
-- Autocmds
|
||||
nvim('exec','autocmd BufAdd * :let x1 = "Hello"', false)
|
||||
@ -1841,10 +1841,10 @@ describe('API', function()
|
||||
-- spin the loop a bit
|
||||
helpers.run(nil, nil, on_setup)
|
||||
|
||||
eq(nvim('get_var', 'x1'), '…')
|
||||
eq('…', nvim('get_var', 'x1'))
|
||||
-- Because of the double escaping this is neq
|
||||
neq(nvim('get_var', 'x2'), '…')
|
||||
eq(nvim('get_var', 'x3'), '…')
|
||||
neq('…', nvim('get_var', 'x2'))
|
||||
eq('…', nvim('get_var', 'x3'))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
@ -30,7 +30,7 @@ describe("'langmap'", function()
|
||||
command('nmapclear')
|
||||
end)
|
||||
it("'langnoremap' is by default ON", function()
|
||||
eq(eval('&langnoremap'), 1)
|
||||
eq(1, eval('&langnoremap'))
|
||||
end)
|
||||
it("Results of maps are not converted when 'langnoremap' ON.",
|
||||
function()
|
||||
@ -71,19 +71,19 @@ describe("'langmap'", function()
|
||||
feed('<C-w>s')
|
||||
local origwin = curwin()
|
||||
feed('<C-w>i')
|
||||
neq(curwin(), origwin)
|
||||
neq(origwin, curwin())
|
||||
-- Works when setting a mark
|
||||
feed('yy3p3gg0mwgg0mi')
|
||||
eq(call('getpos', "'i"), {0, 3, 1, 0})
|
||||
eq(call('getpos', "'w"), {0, 1, 1, 0})
|
||||
eq({0, 3, 1, 0}, call('getpos', "'i"))
|
||||
eq({0, 1, 1, 0}, call('getpos', "'w"))
|
||||
feed('3dd')
|
||||
-- Works when moving to a mark
|
||||
feed("'i")
|
||||
eq(call('getpos', '.'), {0, 1, 1, 0})
|
||||
eq({0, 1, 1, 0}, call('getpos', '.'))
|
||||
-- Works when selecting a register
|
||||
feed('qillqqwhhq')
|
||||
eq(eval('@i'), 'hh')
|
||||
eq(eval('@w'), 'll')
|
||||
eq('hh', eval('@i'))
|
||||
eq('ll', eval('@w'))
|
||||
feed('a<C-r>i<esc>')
|
||||
expect('illii www')
|
||||
feed('"ip')
|
||||
@ -107,7 +107,7 @@ describe("'langmap'", function()
|
||||
expect('wwi www')
|
||||
feed('u@a')
|
||||
expect('wwi www')
|
||||
eq(eval('@a'), ':s/i/w/gc\ryyn')
|
||||
eq(':s/i/w/gc\ryyn', eval('@a'))
|
||||
end)
|
||||
it('insert-mode CTRL-G', function()
|
||||
command('set langmap=jk,kj')
|
||||
@ -127,7 +127,7 @@ describe("'langmap'", function()
|
||||
helhellolo
|
||||
helxlo
|
||||
hello]])
|
||||
eq(eval('@a'), 'gg3|ahellojx')
|
||||
eq('gg3|ahellojx', eval('@a'))
|
||||
end)
|
||||
it('command-line CTRL-\\', function()
|
||||
command('set langmap=en,ne')
|
||||
@ -145,8 +145,8 @@ describe("'langmap'", function()
|
||||
set langmap=ij,ji
|
||||
]])
|
||||
feed(':let <C-R>i=1<CR>')
|
||||
eq(eval('i_value'), 1)
|
||||
eq(eval('j_value'), 0)
|
||||
eq(1, eval('i_value'))
|
||||
eq(0, eval('j_value'))
|
||||
end)
|
||||
-- it('-- More -- prompt', function()
|
||||
-- -- The 'b' 'j' 'd' 'f' commands at the -- More -- prompt
|
||||
@ -186,17 +186,17 @@ describe("'langmap'", function()
|
||||
nnoremap x :call Map()<CR>
|
||||
]])
|
||||
feed('x1<CR>')
|
||||
eq(eval('gotten_one'), 1)
|
||||
eq(1, eval('gotten_one'))
|
||||
command('let g:gotten_one = 0')
|
||||
feed_command('call Map()')
|
||||
feed('1<CR>')
|
||||
eq(eval('gotten_one'), 1)
|
||||
eq(1, eval('gotten_one'))
|
||||
end)
|
||||
end)
|
||||
it('conversions are not applied during setreg()',
|
||||
function()
|
||||
call('setreg', 'i', 'ww')
|
||||
eq(eval('@i'), 'ww')
|
||||
eq('ww', eval('@i'))
|
||||
end)
|
||||
it('conversions not applied in insert mode', function()
|
||||
feed('aiiiwww')
|
||||
|
@ -17,20 +17,20 @@ describe('macros', function()
|
||||
it('can be recorded and replayed', function()
|
||||
feed('qiahello<esc>q')
|
||||
expect('hello')
|
||||
eq(eval('@i'), 'ahello')
|
||||
eq('ahello', eval('@i'))
|
||||
feed('@i')
|
||||
expect('hellohello')
|
||||
eq(eval('@i'), 'ahello')
|
||||
eq('ahello', eval('@i'))
|
||||
end)
|
||||
it('applies maps', function()
|
||||
command('imap x l')
|
||||
command('nmap l a')
|
||||
feed('qilxxx<esc>q')
|
||||
expect('lll')
|
||||
eq(eval('@i'), 'lxxx')
|
||||
eq('lxxx', eval('@i'))
|
||||
feed('@i')
|
||||
expect('llllll')
|
||||
eq(eval('@i'), 'lxxx')
|
||||
eq('lxxx', eval('@i'))
|
||||
end)
|
||||
|
||||
it('can be replayed with Q', function()
|
||||
|
@ -17,7 +17,7 @@ describe('argument list commands', function()
|
||||
end
|
||||
|
||||
local function assert_fails(cmd, err)
|
||||
neq(exc_exec(cmd):find(err), nil)
|
||||
neq(nil, exc_exec(cmd):find(err))
|
||||
end
|
||||
|
||||
it('test that argidx() works', function()
|
||||
|
@ -52,6 +52,6 @@ describe('sort', function()
|
||||
eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval([[sort([3.3, 1, "2", "A", "a", "AA"], '')]]))
|
||||
eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"], 0)'))
|
||||
eq({'2', 'A', 'a', 'AA', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"], 1)'))
|
||||
neq(exc_exec('call sort([3.3, 1, "2"], 3)'):find('E474:'), nil)
|
||||
neq(nil, exc_exec('call sort([3.3, 1, "2"], 3)'):find('E474:'))
|
||||
end)
|
||||
end)
|
||||
|
@ -50,44 +50,44 @@ describe('wordcount', function()
|
||||
]=])
|
||||
|
||||
-- Test 1: empty window
|
||||
eq(eval('DoRecordWin()'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[[''], {'chars': 0, 'cursor_chars': 0, 'words': 0, 'cursor_words': 0, 'bytes': 0, 'cursor_bytes': 0}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('DoRecordWin()')
|
||||
)
|
||||
|
||||
-- Test 2: some words, cursor at start
|
||||
command([[call PutInWindow('one two three')]])
|
||||
eq(eval('DoRecordWin([1, 1, 0])'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'one two three'], {'chars': 15, 'cursor_chars': 1, 'words': 3, 'cursor_words': 0, 'bytes': 15, 'cursor_bytes': 1}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('DoRecordWin([1, 1, 0])')
|
||||
)
|
||||
|
||||
-- Test 3: some words, cursor at end
|
||||
command([[call PutInWindow('one two three')]])
|
||||
eq(eval('DoRecordWin([2, 99, 0])'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 14}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('DoRecordWin([2, 99, 0])')
|
||||
)
|
||||
|
||||
-- Test 4: some words, cursor at end, ve=all
|
||||
command('set ve=all')
|
||||
command([[call PutInWindow('one two three')]])
|
||||
eq(eval('DoRecordWin([2,99,0])'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'one two three'], {'chars': 15, 'cursor_chars': 15, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 15}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('DoRecordWin([2,99,0])')
|
||||
)
|
||||
command('set ve=')
|
||||
|
||||
-- Test 5: several lines with words
|
||||
command([=[call PutInWindow(['one two three', 'one two three', 'one two three'])]=])
|
||||
eq(eval('DoRecordWin([4,99,0])'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'one two three', 'one two three', 'one two three'], {'chars': 43, 'cursor_chars': 42, 'words': 9, 'cursor_words': 9, 'bytes': 43, 'cursor_bytes': 42}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('DoRecordWin([4,99,0])')
|
||||
)
|
||||
|
||||
-- Test 6: one line with BOM set
|
||||
@ -95,10 +95,10 @@ describe('wordcount', function()
|
||||
command('wincmd k')
|
||||
command('set bomb')
|
||||
command('wincmd j')
|
||||
eq(eval('DoRecordWin([2,99,0])'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 18, 'cursor_bytes': 14}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('DoRecordWin([2,99,0])')
|
||||
)
|
||||
command('wincmd k')
|
||||
command('set nobomb')
|
||||
@ -106,18 +106,18 @@ describe('wordcount', function()
|
||||
|
||||
-- Test 7: one line with multibyte words
|
||||
command([=[call PutInWindow(['Äne M¤ne Müh'])]=])
|
||||
eq(eval('DoRecordWin([2,99,0])'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'Äne M¤ne Müh'], {'chars': 14, 'cursor_chars': 13, 'words': 3, 'cursor_words': 3, 'bytes': 17, 'cursor_bytes': 16}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('DoRecordWin([2,99,0])')
|
||||
)
|
||||
|
||||
-- Test 8: several lines with multibyte words
|
||||
command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
|
||||
eq(eval('DoRecordWin([3,99,0])'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'cursor_chars': 31, 'words': 7, 'cursor_words': 7, 'bytes': 36, 'cursor_bytes': 35}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('DoRecordWin([3,99,0])')
|
||||
)
|
||||
|
||||
-- Test 9: visual mode, complete buffer
|
||||
@ -131,10 +131,10 @@ describe('wordcount', function()
|
||||
command('set stl= ls=1')
|
||||
command('let log=DoRecordWin([3,99,0])')
|
||||
command('let log[1]=g:visual_stat')
|
||||
eq(eval('log'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 32, 'visual_words': 7, 'visual_bytes': 36}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('log')
|
||||
)
|
||||
|
||||
-- Test 10: visual mode (empty)
|
||||
@ -148,10 +148,10 @@ describe('wordcount', function()
|
||||
command('set stl= ls=1')
|
||||
command('let log=DoRecordWin([3,99,0])')
|
||||
command('let log[1]=g:visual_stat')
|
||||
eq(eval('log'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 1, 'visual_words': 0, 'visual_bytes': 1}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('log')
|
||||
)
|
||||
|
||||
-- Test 11: visual mode, single line
|
||||
@ -165,10 +165,10 @@ describe('wordcount', function()
|
||||
command('set stl= ls=1')
|
||||
command('let log=DoRecordWin([3,99,0])')
|
||||
command('let log[1]=g:visual_stat')
|
||||
eq(eval('log'),
|
||||
eval([=[
|
||||
eq(eval([=[
|
||||
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 13, 'visual_words': 3, 'visual_bytes': 16}]
|
||||
]=])
|
||||
]=]),
|
||||
eval('log')
|
||||
)
|
||||
end)
|
||||
end)
|
||||
|
@ -645,17 +645,17 @@ describe('lua stdlib', function()
|
||||
return vim.tbl_islist(c) and count == 0
|
||||
]]))
|
||||
|
||||
eq(exec_lua([[
|
||||
eq({a = {b = 1}}, exec_lua([[
|
||||
local a = { a = { b = 1 } }
|
||||
local b = { a = {} }
|
||||
return vim.tbl_deep_extend("force", a, b)
|
||||
]]), {a = {b = 1}})
|
||||
]]))
|
||||
|
||||
eq(exec_lua([[
|
||||
eq({a = {b = 1}}, exec_lua([[
|
||||
local a = { a = 123 }
|
||||
local b = { a = { b = 1} }
|
||||
return vim.tbl_deep_extend("force", a, b)
|
||||
]]), {a = {b = 1}})
|
||||
]]))
|
||||
|
||||
ok(exec_lua([[
|
||||
local a = { a = {[2] = 3} }
|
||||
@ -664,11 +664,11 @@ describe('lua stdlib', function()
|
||||
return vim.deep_equal(c, {a = {[3] = 3}})
|
||||
]]))
|
||||
|
||||
eq(exec_lua([[
|
||||
eq({a = 123}, exec_lua([[
|
||||
local a = { a = { b = 1} }
|
||||
local b = { a = 123 }
|
||||
return vim.tbl_deep_extend("force", a, b)
|
||||
]]), {a = 123 })
|
||||
]]))
|
||||
|
||||
matches('invalid "behavior": nil',
|
||||
pcall_err(exec_lua, [[
|
||||
|
@ -120,9 +120,9 @@ describe("'keymap' / :lmap", function()
|
||||
it("Can be toggled with <C-^> in insert mode", function()
|
||||
feed('i<C-^>l<C-^>l<esc>')
|
||||
expect('lalllaaa')
|
||||
eq(eval('&iminsert'), 1)
|
||||
eq(1, eval('&iminsert'))
|
||||
feed('i<C-^><esc>')
|
||||
eq(eval('&iminsert'), 0)
|
||||
eq(0, eval('&iminsert'))
|
||||
end)
|
||||
end)
|
||||
describe("'imsearch' option", function()
|
||||
@ -136,36 +136,36 @@ describe("'keymap' / :lmap", function()
|
||||
expect('aaa')
|
||||
end)
|
||||
it("Can be toggled with C-^", function()
|
||||
eq(eval('&imsearch'), 1)
|
||||
eq(1, eval('&imsearch'))
|
||||
feed('/<C-^>lll<cr>3x')
|
||||
expect('aaa')
|
||||
eq(eval('&imsearch'), 0)
|
||||
eq(0, eval('&imsearch'))
|
||||
feed('u0/<C-^>lll<cr>3x')
|
||||
expect('lll')
|
||||
eq(eval('&imsearch'), 1)
|
||||
eq(1, eval('&imsearch'))
|
||||
end)
|
||||
it("can follow 'iminsert'", function()
|
||||
command('set imsearch=-1')
|
||||
feed('/lll<cr>3x')
|
||||
expect('lll')
|
||||
eq(eval('&imsearch'), -1)
|
||||
eq(eval('&iminsert'), 1)
|
||||
eq(-1, eval('&imsearch'))
|
||||
eq(1, eval('&iminsert'))
|
||||
feed('u/<C-^>lll<cr>3x')
|
||||
expect('aaa')
|
||||
eq(eval('&imsearch'), -1)
|
||||
eq(eval('&iminsert'), 0)
|
||||
eq(-1, eval('&imsearch'))
|
||||
eq(0, eval('&iminsert'))
|
||||
end)
|
||||
end)
|
||||
it(":lmap not applied to macros", function()
|
||||
command("call setreg('a', 'il')")
|
||||
feed('@a')
|
||||
expect('llllaaa')
|
||||
eq(call('getreg', 'a'), 'il')
|
||||
eq('il', call('getreg', 'a'))
|
||||
end)
|
||||
it(":lmap applied to macro recording", function()
|
||||
feed('qail<esc>q@a')
|
||||
expect('aalllaaa')
|
||||
eq(call('getreg', 'a'), 'ia')
|
||||
eq('ia', call('getreg', 'a'))
|
||||
end)
|
||||
it(":lmap not applied to mappings", function()
|
||||
command('imap t l')
|
||||
|
@ -85,8 +85,8 @@ describe('float window', function()
|
||||
local buf = meths.create_buf(false, false)
|
||||
meths.buf_set_lines(buf, 0, -1, true, {'the floatwin'})
|
||||
local win = meths.open_win(buf, true, {relative='win', width=16, height=1, row=0, col=10})
|
||||
eq(pcall_err(funcs.win_execute, win, 'close'), 'Vim(close):E37: No write since last change (add ! to override)')
|
||||
eq(pcall_err(funcs.win_execute, win, 'bdelete'), 'Vim(bdelete):E89: No write since last change for buffer 2 (add ! to override)')
|
||||
eq('Vim(close):E37: No write since last change (add ! to override)', pcall_err(funcs.win_execute, win, 'close'))
|
||||
eq('Vim(bdelete):E89: No write since last change for buffer 2 (add ! to override)', pcall_err(funcs.win_execute, win, 'bdelete'))
|
||||
funcs.win_execute(win, 'bwipe!')
|
||||
end)
|
||||
|
||||
@ -367,7 +367,7 @@ describe('float window', function()
|
||||
return vim.api.nvim_open_win(bufnr, false, opts)
|
||||
]])
|
||||
command('windo echo')
|
||||
neq(eval('win_getid()'), winid)
|
||||
neq(winid, eval('win_getid()'))
|
||||
end)
|
||||
|
||||
it('is active after windo when focusable', function()
|
||||
@ -384,7 +384,7 @@ describe('float window', function()
|
||||
return vim.api.nvim_open_win(bufnr, false, opts)
|
||||
]])
|
||||
command('windo echo')
|
||||
eq(eval('win_getid()'), winid)
|
||||
eq(winid, eval('win_getid()'))
|
||||
end)
|
||||
|
||||
it('supports windo with focusable and non-focusable floats', function()
|
||||
|
@ -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%."))
|
||||
|
@ -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)
|
||||
|
@ -154,7 +154,7 @@ describe('env.c', function()
|
||||
local value = 'TESTVALUE'
|
||||
os_setenv(name, value, 1)
|
||||
eq(OK, os_unsetenv(name))
|
||||
neq(os_getenv(name), value)
|
||||
neq(value, os_getenv(name))
|
||||
-- Depending on the platform the var might be unset or set as ''
|
||||
assert.True(os_getenv(name) == nil or os_getenv(name) == '')
|
||||
if os_getenv(name) == nil then
|
||||
|
Loading…
Reference in New Issue
Block a user