mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
test: correct order of arguments to eq() (#27816)
This commit is contained in:
@ -707,13 +707,13 @@ describe('API', function()
|
||||
|
||||
it('works', function()
|
||||
api.nvim_set_current_dir('Xtestdir')
|
||||
eq(fn.getcwd(), start_dir .. helpers.get_pathsep() .. 'Xtestdir')
|
||||
eq(start_dir .. helpers.get_pathsep() .. 'Xtestdir', fn.getcwd())
|
||||
end)
|
||||
|
||||
it('sets previous directory', function()
|
||||
api.nvim_set_current_dir('Xtestdir')
|
||||
command('cd -')
|
||||
eq(fn.getcwd(), start_dir)
|
||||
eq(start_dir, fn.getcwd())
|
||||
end)
|
||||
end)
|
||||
|
||||
|
@ -72,19 +72,19 @@ describe('TextYankPost', function()
|
||||
command('set debug=msg')
|
||||
-- the regcontents should not be changed without copy.
|
||||
local status, err = pcall(command, 'call extend(g:event.regcontents, ["more text"])')
|
||||
eq(status, false)
|
||||
eq(false, status)
|
||||
neq(nil, string.find(err, ':E742:'))
|
||||
|
||||
-- can't mutate keys inside the autocommand
|
||||
command('autocmd! TextYankPost * let v:event.regcontents = 0')
|
||||
status, err = pcall(command, 'normal yy')
|
||||
eq(status, false)
|
||||
eq(false, status)
|
||||
neq(nil, string.find(err, ':E46:'))
|
||||
|
||||
-- can't add keys inside the autocommand
|
||||
command('autocmd! TextYankPost * let v:event.mykey = 0')
|
||||
status, err = pcall(command, 'normal yy')
|
||||
eq(status, false)
|
||||
eq(false, status)
|
||||
neq(nil, string.find(err, ':E742:'))
|
||||
end)
|
||||
|
||||
|
@ -505,7 +505,7 @@ describe('mappings with <Cmd>', function()
|
||||
feed('"bd<F7>')
|
||||
expect([[
|
||||
soest text]])
|
||||
eq(fn.getreg('b', 1, 1), { 'me short lines', 'of t' })
|
||||
eq({ 'me short lines', 'of t' }, fn.getreg('b', 1, 1))
|
||||
|
||||
-- startinsert aborts operator
|
||||
feed('d<F8>')
|
||||
@ -561,7 +561,7 @@ describe('mappings with <Cmd>', function()
|
||||
of stuff test text]])
|
||||
|
||||
feed('<F5>')
|
||||
eq(fn.getreg('a', 1, 1), { 'deed some short little lines', 'of stuff t' })
|
||||
eq({ 'deed some short little lines', 'of stuff t' }, fn.getreg('a', 1, 1))
|
||||
|
||||
-- still in insert
|
||||
screen:expect([[
|
||||
|
@ -59,7 +59,7 @@ local monitor_memory_usage = {
|
||||
end
|
||||
table.remove(self.hist, 1)
|
||||
self.last = self.hist[#self.hist]
|
||||
eq(#result, 1)
|
||||
eq(1, #result)
|
||||
end)
|
||||
end,
|
||||
dump = function(self)
|
||||
|
@ -312,15 +312,15 @@ describe('lua buffer event callbacks: on_lines', function()
|
||||
feed('G0')
|
||||
feed('p')
|
||||
-- Is the last arg old_byte_size correct? Doesn't matter for this PR
|
||||
eq(api.nvim_get_var('linesev'), { 'lines', 1, 4, 2, 3, 5, 4 })
|
||||
eq({ 'lines', 1, 4, 2, 3, 5, 4 }, api.nvim_get_var('linesev'))
|
||||
|
||||
feed('2G0')
|
||||
feed('p')
|
||||
eq(api.nvim_get_var('linesev'), { 'lines', 1, 5, 1, 4, 4, 8 })
|
||||
eq({ 'lines', 1, 5, 1, 4, 4, 8 }, api.nvim_get_var('linesev'))
|
||||
|
||||
feed('1G0')
|
||||
feed('P')
|
||||
eq(api.nvim_get_var('linesev'), { 'lines', 1, 6, 0, 3, 3, 9 })
|
||||
eq({ 'lines', 1, 6, 0, 3, 3, 9 }, api.nvim_get_var('linesev'))
|
||||
end)
|
||||
|
||||
it(
|
||||
|
@ -205,7 +205,7 @@ describe('vim.diagnostic', function()
|
||||
diag[1].col = 10000
|
||||
return vim.diagnostic.get()[1].col == 10000
|
||||
]]
|
||||
eq(result, false)
|
||||
eq(false, result)
|
||||
end)
|
||||
|
||||
it('resolves buffer number 0 to the current buffer', function()
|
||||
|
@ -166,7 +166,7 @@ describe('thread', function()
|
||||
]]
|
||||
|
||||
local msg = next_msg()
|
||||
eq(msg[1], 'notification')
|
||||
eq('notification', msg[1])
|
||||
assert(tonumber(msg[2]) >= 72961)
|
||||
end)
|
||||
|
||||
@ -327,7 +327,7 @@ describe('threadpool', function()
|
||||
]]
|
||||
|
||||
local msg = next_msg()
|
||||
eq(msg[1], 'notification')
|
||||
eq('notification', msg[1])
|
||||
assert(tonumber(msg[2]) >= 72961)
|
||||
end)
|
||||
|
||||
|
@ -2016,7 +2016,7 @@ describe('lua stdlib', function()
|
||||
vim.opt.scrolloff = 10
|
||||
return vim.o.scrolloff
|
||||
]]
|
||||
eq(scrolloff, 10)
|
||||
eq(10, scrolloff)
|
||||
end)
|
||||
|
||||
pending('should handle STUPID window things', function()
|
||||
@ -2037,7 +2037,7 @@ describe('lua stdlib', function()
|
||||
vim.opt.wildignore = { 'hello', 'world' }
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'hello,world')
|
||||
eq('hello,world', wildignore)
|
||||
end)
|
||||
|
||||
it('should allow setting tables with shortnames', function()
|
||||
@ -2045,7 +2045,7 @@ describe('lua stdlib', function()
|
||||
vim.opt.wig = { 'hello', 'world' }
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'hello,world')
|
||||
eq('hello,world', wildignore)
|
||||
end)
|
||||
|
||||
it('should error when you attempt to set string values to numeric options', function()
|
||||
@ -2451,13 +2451,13 @@ describe('lua stdlib', function()
|
||||
vim.opt.wildignore = 'foo'
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'foo')
|
||||
eq('foo', wildignore)
|
||||
|
||||
wildignore = exec_lua [[
|
||||
vim.opt.wildignore = vim.opt.wildignore + { 'bar', 'baz' }
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'foo,bar,baz')
|
||||
eq('foo,bar,baz', wildignore)
|
||||
end)
|
||||
|
||||
it('should handle adding duplicates', function()
|
||||
@ -2465,19 +2465,19 @@ describe('lua stdlib', function()
|
||||
vim.opt.wildignore = 'foo'
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'foo')
|
||||
eq('foo', wildignore)
|
||||
|
||||
wildignore = exec_lua [[
|
||||
vim.opt.wildignore = vim.opt.wildignore + { 'bar', 'baz' }
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'foo,bar,baz')
|
||||
eq('foo,bar,baz', wildignore)
|
||||
|
||||
wildignore = exec_lua [[
|
||||
vim.opt.wildignore = vim.opt.wildignore + { 'bar', 'baz' }
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'foo,bar,baz')
|
||||
eq('foo,bar,baz', wildignore)
|
||||
end)
|
||||
|
||||
it('should allow adding multiple times', function()
|
||||
@ -2486,7 +2486,7 @@ describe('lua stdlib', function()
|
||||
vim.opt.wildignore = vim.opt.wildignore + 'bar' + 'baz'
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'foo,bar,baz')
|
||||
eq('foo,bar,baz', wildignore)
|
||||
end)
|
||||
|
||||
it('should remove values when you use minus', function()
|
||||
@ -2494,19 +2494,19 @@ describe('lua stdlib', function()
|
||||
vim.opt.wildignore = 'foo'
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'foo')
|
||||
eq('foo', wildignore)
|
||||
|
||||
wildignore = exec_lua [[
|
||||
vim.opt.wildignore = vim.opt.wildignore + { 'bar', 'baz' }
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'foo,bar,baz')
|
||||
eq('foo,bar,baz', wildignore)
|
||||
|
||||
wildignore = exec_lua [[
|
||||
vim.opt.wildignore = vim.opt.wildignore - 'bar'
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'foo,baz')
|
||||
eq('foo,baz', wildignore)
|
||||
end)
|
||||
|
||||
it('should prepend values when using ^', function()
|
||||
@ -2521,7 +2521,7 @@ describe('lua stdlib', function()
|
||||
vim.opt.wildignore = vim.opt.wildignore ^ 'super_first'
|
||||
return vim.o.wildignore
|
||||
]]
|
||||
eq(wildignore, 'super_first,first,foo')
|
||||
eq('super_first,first,foo', wildignore)
|
||||
end)
|
||||
|
||||
it('should not remove duplicates from wildmode: #14708', function()
|
||||
@ -2530,7 +2530,7 @@ describe('lua stdlib', function()
|
||||
return vim.o.wildmode
|
||||
]]
|
||||
|
||||
eq(wildmode, 'full,list,full')
|
||||
eq('full,list,full', wildmode)
|
||||
end)
|
||||
|
||||
describe('option types', function()
|
||||
@ -2738,7 +2738,7 @@ describe('lua stdlib', function()
|
||||
return vim.go.whichwrap
|
||||
]]
|
||||
|
||||
eq(ww, 'b,s')
|
||||
eq('b,s', ww)
|
||||
eq(
|
||||
'b,s,<,>,[,]',
|
||||
exec_lua [[
|
||||
|
@ -1243,11 +1243,11 @@ describe('autocommands', function()
|
||||
command('au BufEnter * let g:n = g:n + 1')
|
||||
|
||||
command('terminal')
|
||||
eq(eval('get(g:, "n", 0)'), 1)
|
||||
eq(1, eval('get(g:, "n", 0)'))
|
||||
|
||||
helpers.retry(nil, 1000, function()
|
||||
neq(api.nvim_get_option_value('buftype', { buf = 0 }), 'terminal')
|
||||
eq(eval('get(g:, "n", 0)'), 2)
|
||||
neq('terminal', api.nvim_get_option_value('buftype', { buf = 0 }))
|
||||
eq(2, eval('get(g:, "n", 0)'))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
@ -12,7 +12,7 @@ local function should_fail(opt, value, errmsg)
|
||||
eq(errmsg, eval('v:errmsg'):match('E%d*'))
|
||||
feed_command('let v:errmsg = ""')
|
||||
local status, err = pcall(api.nvim_set_option_value, opt, value, {})
|
||||
eq(status, false)
|
||||
eq(false, status)
|
||||
eq(errmsg, err:match('E%d*'))
|
||||
eq('', eval('v:errmsg'))
|
||||
end
|
||||
|
@ -257,7 +257,7 @@ describe('vim.lsp.diagnostic', function()
|
||||
}, {client_id=client_id})
|
||||
return vim.fn.bufnr(vim.uri_to_fname("file:///fake/uri2"))
|
||||
]]
|
||||
eq(bufnr, -1)
|
||||
eq(-1, bufnr)
|
||||
|
||||
-- Create buffer on diagnostics
|
||||
bufnr = exec_lua [[
|
||||
@ -269,8 +269,8 @@ describe('vim.lsp.diagnostic', function()
|
||||
}, {client_id=client_id})
|
||||
return vim.fn.bufnr(vim.uri_to_fname("file:///fake/uri2"))
|
||||
]]
|
||||
neq(bufnr, -1)
|
||||
eq(exec_lua([[return #vim.diagnostic.get(...)]], bufnr), 1)
|
||||
neq(-1, bufnr)
|
||||
eq(1, exec_lua([[return #vim.diagnostic.get(...)]], bufnr))
|
||||
|
||||
-- Clear diagnostics after buffer was created
|
||||
bufnr = exec_lua [[
|
||||
@ -280,8 +280,8 @@ describe('vim.lsp.diagnostic', function()
|
||||
}, {client_id=client_id})
|
||||
return vim.fn.bufnr(vim.uri_to_fname("file:///fake/uri2"))
|
||||
]]
|
||||
neq(bufnr, -1)
|
||||
eq(exec_lua([[return #vim.diagnostic.get(...)]], bufnr), 0)
|
||||
neq(-1, bufnr)
|
||||
eq(0, exec_lua([[return #vim.diagnostic.get(...)]], bufnr))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
@ -169,12 +169,12 @@ describe('vim.lsp.inlay_hint', function()
|
||||
|
||||
--- @type vim.lsp.inlay_hint.get.ret
|
||||
local res = exec_lua([[return vim.lsp.inlay_hint.get()]])
|
||||
eq(res, {
|
||||
eq({
|
||||
{ bufnr = 1, client_id = 1, inlay_hint = expected[1] },
|
||||
{ bufnr = 1, client_id = 1, inlay_hint = expected[2] },
|
||||
{ bufnr = 1, client_id = 1, inlay_hint = expected[3] },
|
||||
{ bufnr = 1, client_id = 2, inlay_hint = expected2 },
|
||||
})
|
||||
}, res)
|
||||
|
||||
--- @type vim.lsp.inlay_hint.get.ret
|
||||
res = exec_lua([[return vim.lsp.inlay_hint.get({
|
||||
@ -183,9 +183,9 @@ describe('vim.lsp.inlay_hint', function()
|
||||
["end"] = { line = 2, character = 10 },
|
||||
},
|
||||
})]])
|
||||
eq(res, {
|
||||
eq({
|
||||
{ bufnr = 1, client_id = 2, inlay_hint = expected2 },
|
||||
})
|
||||
}, res)
|
||||
|
||||
--- @type vim.lsp.inlay_hint.get.ret
|
||||
res = exec_lua([[return vim.lsp.inlay_hint.get({
|
||||
@ -195,16 +195,16 @@ describe('vim.lsp.inlay_hint', function()
|
||||
["end"] = { line = 5, character = 17 },
|
||||
},
|
||||
})]])
|
||||
eq(res, {
|
||||
eq({
|
||||
{ bufnr = 1, client_id = 1, inlay_hint = expected[2] },
|
||||
{ bufnr = 1, client_id = 1, inlay_hint = expected[3] },
|
||||
})
|
||||
}, res)
|
||||
|
||||
--- @type vim.lsp.inlay_hint.get.ret
|
||||
res = exec_lua([[return vim.lsp.inlay_hint.get({
|
||||
bufnr = vim.api.nvim_get_current_buf() + 1,
|
||||
})]])
|
||||
eq(res, {})
|
||||
eq({}, res)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
@ -641,11 +641,11 @@ describe('LSP', function()
|
||||
vim.lsp.stop_client(client_id)
|
||||
return server.messages
|
||||
]])
|
||||
eq(#messages, 4)
|
||||
eq(messages[1].method, 'initialize')
|
||||
eq(messages[2].method, 'initialized')
|
||||
eq(messages[3].method, 'shutdown')
|
||||
eq(messages[4].method, 'exit')
|
||||
eq(4, #messages)
|
||||
eq('initialize', messages[1].method)
|
||||
eq('initialized', messages[2].method)
|
||||
eq('shutdown', messages[3].method)
|
||||
eq('exit', messages[4].method)
|
||||
end)
|
||||
|
||||
it('BufWritePre sends willSave / willSaveWaitUntil, applies textEdits', function()
|
||||
@ -4221,7 +4221,7 @@ describe('LSP', function()
|
||||
server:shutdown()
|
||||
return vim.json.decode(init)
|
||||
]]
|
||||
eq(result.method, 'initialize')
|
||||
eq('initialize', result.method)
|
||||
end)
|
||||
it('can connect to lsp server via rpc.domain_socket_connect', function()
|
||||
local tmpfile
|
||||
@ -4257,7 +4257,7 @@ describe('LSP', function()
|
||||
]],
|
||||
tmpfile
|
||||
)
|
||||
eq(result.method, 'initialize')
|
||||
eq('initialize', result.method)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ describe('ShaDa jumps support code', function()
|
||||
eq(jumps[found].line, v.value.l)
|
||||
end
|
||||
end
|
||||
eq(found, #jumps)
|
||||
eq(#jumps, found)
|
||||
end)
|
||||
|
||||
it('merges JUMPLISTSIZE jumps when writing', function()
|
||||
@ -1041,7 +1041,7 @@ describe('ShaDa jumps support code', function()
|
||||
eq(jumps[found].line, v.value.l)
|
||||
end
|
||||
end
|
||||
eq(found, 100)
|
||||
eq(100, found)
|
||||
end)
|
||||
end)
|
||||
|
||||
@ -1132,7 +1132,7 @@ describe('ShaDa changes support code', function()
|
||||
eq(changes[found].line, v.value.l or 1)
|
||||
end
|
||||
end
|
||||
eq(found, #changes)
|
||||
eq(#changes, found)
|
||||
end)
|
||||
|
||||
it('merges JUMPLISTSIZE changes when writing', function()
|
||||
@ -1170,7 +1170,7 @@ describe('ShaDa changes support code', function()
|
||||
eq(changes[found].line, v.value.l)
|
||||
end
|
||||
end
|
||||
eq(found, 100)
|
||||
eq(100, found)
|
||||
end)
|
||||
|
||||
it('merges JUMPLISTSIZE changes when writing, with new items between old', function()
|
||||
@ -1213,6 +1213,6 @@ describe('ShaDa changes support code', function()
|
||||
eq(changes[found].line, v.value.l)
|
||||
end
|
||||
end
|
||||
eq(found, 100)
|
||||
eq(100, found)
|
||||
end)
|
||||
end)
|
||||
|
@ -828,7 +828,7 @@ end]]
|
||||
return parser:included_regions()
|
||||
]]
|
||||
|
||||
eq(range_tbl, { { { 0, 0, 0, 17, 1, 508 } } })
|
||||
eq({ { { 0, 0, 0, 17, 1, 508 } } }, range_tbl)
|
||||
end)
|
||||
|
||||
it('allows to set complex ranges', function()
|
||||
@ -1111,7 +1111,7 @@ int x = INT_MAX;
|
||||
return sub_tree == parser:children().c
|
||||
]])
|
||||
|
||||
eq(result, true)
|
||||
eq(true, result)
|
||||
end)
|
||||
end)
|
||||
|
||||
@ -1135,7 +1135,7 @@ int x = INT_MAX;
|
||||
return result
|
||||
]])
|
||||
|
||||
eq(result, 'value')
|
||||
eq('value', result)
|
||||
end)
|
||||
|
||||
describe('when setting a key on a capture', function()
|
||||
@ -1158,7 +1158,7 @@ int x = INT_MAX;
|
||||
end
|
||||
]])
|
||||
|
||||
eq(result, 'value')
|
||||
eq('value', result)
|
||||
end)
|
||||
|
||||
it('it should not overwrite the nested table', function()
|
||||
|
@ -6257,7 +6257,7 @@ describe('float window', function()
|
||||
run(on_request, nil, on_setup)
|
||||
os.remove('Xtest_written')
|
||||
os.remove('Xtest_written2')
|
||||
eq(exited, true)
|
||||
eq(true, exited)
|
||||
end)
|
||||
|
||||
it(':quit two floats in a row', function()
|
||||
|
@ -204,8 +204,8 @@ describe(":substitute, 'inccommand' preserves", function()
|
||||
feed(':%s/as/glork/')
|
||||
poke_eventloop()
|
||||
feed('<enter>')
|
||||
eq(api.nvim_get_option_value('undolevels', { scope = 'global' }), 139)
|
||||
eq(api.nvim_get_option_value('undolevels', { buf = 0 }), 34)
|
||||
eq(139, api.nvim_get_option_value('undolevels', { scope = 'global' }))
|
||||
eq(34, api.nvim_get_option_value('undolevels', { buf = 0 }))
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -51,11 +51,11 @@ describe('msgpack', function()
|
||||
|
||||
unpacker_goto(unpacker, payload, payload:len() - 1)
|
||||
local finished = unpacker_advance(unpacker)
|
||||
eq(finished, false)
|
||||
eq(false, finished)
|
||||
|
||||
unpacker[0].read_size = unpacker[0].read_size + 1
|
||||
finished = unpacker_advance(unpacker)
|
||||
eq(finished, true)
|
||||
eq(true, finished)
|
||||
end
|
||||
)
|
||||
|
||||
@ -73,7 +73,7 @@ describe('msgpack', function()
|
||||
'\x93\x02\xa6\x72\x65\x64\x72\x61\x77\x91\x92\xa9\x67\x72\x69\x64\x5f\x6c\x69\x6e\x65\x95\x02\x00\x00\x90\xc2'
|
||||
)
|
||||
local finished = unpacker_advance(unpacker)
|
||||
eq(finished, true)
|
||||
eq(true, finished)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
@ -306,9 +306,9 @@ describe('env.c', function()
|
||||
-- expand_env_esc SHOULD NOT expand the variable if there is not enough space to
|
||||
-- contain the result
|
||||
for i = 0, 3 do
|
||||
eq(output[i], input[i])
|
||||
eq(input[i], output[i])
|
||||
end
|
||||
eq(output[4], 0)
|
||||
eq(0, output[4])
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
@ -125,9 +125,9 @@ describe('shell functions', function()
|
||||
cimported.p_sxe = to_cstr('"&|<>()@^')
|
||||
|
||||
local argv = ffi.cast('char**', cimported.shell_build_argv(to_cstr('echo &|<>()@^'), nil))
|
||||
eq(ffi.string(argv[0]), '/bin/sh')
|
||||
eq(ffi.string(argv[1]), '-c')
|
||||
eq(ffi.string(argv[2]), '(echo ^&^|^<^>^(^)^@^^)')
|
||||
eq('/bin/sh', ffi.string(argv[0]))
|
||||
eq('-c', ffi.string(argv[1]))
|
||||
eq('(echo ^&^|^<^>^(^)^@^^)', ffi.string(argv[2]))
|
||||
eq(nil, argv[3])
|
||||
end)
|
||||
|
||||
@ -136,9 +136,9 @@ describe('shell functions', function()
|
||||
cimported.p_sxe = to_cstr('"&|<>()@^')
|
||||
|
||||
local argv = ffi.cast('char**', cimported.shell_build_argv(to_cstr('echo -n some text'), nil))
|
||||
eq(ffi.string(argv[0]), '/bin/sh')
|
||||
eq(ffi.string(argv[1]), '-c')
|
||||
eq(ffi.string(argv[2]), '"(echo -n some text)"')
|
||||
eq('/bin/sh', ffi.string(argv[0]))
|
||||
eq('-c', ffi.string(argv[1]))
|
||||
eq('"(echo -n some text)"', ffi.string(argv[2]))
|
||||
eq(nil, argv[3])
|
||||
end)
|
||||
|
||||
@ -147,17 +147,17 @@ describe('shell functions', function()
|
||||
cimported.p_sxe = to_cstr('')
|
||||
|
||||
local argv = ffi.cast('char**', cimported.shell_build_argv(to_cstr('echo -n some text'), nil))
|
||||
eq(ffi.string(argv[0]), '/bin/sh')
|
||||
eq(ffi.string(argv[1]), '-c')
|
||||
eq(ffi.string(argv[2]), '"echo -n some text"')
|
||||
eq('/bin/sh', ffi.string(argv[0]))
|
||||
eq('-c', ffi.string(argv[1]))
|
||||
eq('"echo -n some text"', ffi.string(argv[2]))
|
||||
eq(nil, argv[3])
|
||||
end)
|
||||
|
||||
itp('with empty shellxquote/shellxescape', function()
|
||||
local argv = ffi.cast('char**', cimported.shell_build_argv(to_cstr('echo -n some text'), nil))
|
||||
eq(ffi.string(argv[0]), '/bin/sh')
|
||||
eq(ffi.string(argv[1]), '-c')
|
||||
eq(ffi.string(argv[2]), 'echo -n some text')
|
||||
eq('/bin/sh', ffi.string(argv[0]))
|
||||
eq('-c', ffi.string(argv[1]))
|
||||
eq('echo -n some text', ffi.string(argv[2]))
|
||||
eq(nil, argv[3])
|
||||
end)
|
||||
end)
|
||||
|
@ -229,7 +229,7 @@ describe('profiling related functions', function()
|
||||
describe('profile_msg', function()
|
||||
itp('prints the zero time as 0.00000', function()
|
||||
local str = trim(profile_msg(profile_zero()))
|
||||
eq(str, '0.000000')
|
||||
eq('0.000000', str)
|
||||
end)
|
||||
|
||||
itp('prints the time passed, in seconds.microsends', function()
|
||||
@ -245,7 +245,7 @@ describe('profiling related functions', function()
|
||||
|
||||
-- zero seconds have passed (if this is not true, either LuaJIT is too
|
||||
-- slow or the profiling functions are too slow and need to be fixed)
|
||||
eq(s, '0')
|
||||
eq('0', s)
|
||||
|
||||
-- more or less the same goes for the microsecond part, if it doesn't
|
||||
-- start with 0, it's too slow.
|
||||
|
@ -28,7 +28,7 @@ describe('tempfile related functions', function()
|
||||
assert.True(dir ~= nil and dir:len() > 0)
|
||||
-- os_file_is_writable returns 2 for a directory which we have rights
|
||||
-- to write into.
|
||||
eq(lib.os_file_is_writable(helpers.to_cstr(dir)), 2)
|
||||
eq(2, lib.os_file_is_writable(helpers.to_cstr(dir)))
|
||||
for entry in vim.fs.dir(dir) do
|
||||
assert.True(entry == '.' or entry == '..')
|
||||
end
|
||||
@ -57,7 +57,7 @@ describe('tempfile related functions', function()
|
||||
itp('generate file name in Nvim own temp directory', function()
|
||||
local dir = vim_gettempdir()
|
||||
local file = vim_tempname()
|
||||
eq(string.sub(file, 1, string.len(dir)), dir)
|
||||
eq(dir, string.sub(file, 1, string.len(dir)))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user