aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/api/vim_spec.lua4
-rw-r--r--test/functional/autocmd/textyankpost_spec.lua6
-rw-r--r--test/functional/ex_cmds/cmd_map_spec.lua4
-rw-r--r--test/functional/legacy/matchparen_spec.lua43
-rw-r--r--test/functional/legacy/memory_usage_spec.lua2
-rw-r--r--test/functional/lua/buffer_updates_spec.lua8
-rw-r--r--test/functional/lua/diagnostic_spec.lua2
-rw-r--r--test/functional/lua/thread_spec.lua4
-rw-r--r--test/functional/lua/vim_spec.lua30
-rw-r--r--test/functional/options/defaults_spec.lua6
-rw-r--r--test/functional/options/num_options_spec.lua2
-rw-r--r--test/functional/options/winfixbuf_spec.lua54
-rw-r--r--test/functional/plugin/lsp/diagnostic_spec.lua10
-rw-r--r--test/functional/plugin/lsp/inlay_hint_spec.lua14
-rw-r--r--test/functional/plugin/lsp_spec.lua14
-rw-r--r--test/functional/shada/merging_spec.lua10
-rw-r--r--test/functional/treesitter/highlight_spec.lua89
-rw-r--r--test/functional/treesitter/parser_spec.lua8
-rw-r--r--test/functional/ui/float_spec.lua2
-rw-r--r--test/functional/ui/inccommand_spec.lua4
-rw-r--r--test/functional/ui/messages_spec.lua10
21 files changed, 252 insertions, 74 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 9a4a457637..09a45242ec 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -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)
diff --git a/test/functional/autocmd/textyankpost_spec.lua b/test/functional/autocmd/textyankpost_spec.lua
index 29cd62f586..17eb7695f2 100644
--- a/test/functional/autocmd/textyankpost_spec.lua
+++ b/test/functional/autocmd/textyankpost_spec.lua
@@ -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)
diff --git a/test/functional/ex_cmds/cmd_map_spec.lua b/test/functional/ex_cmds/cmd_map_spec.lua
index cb7d7340e2..4499b2172d 100644
--- a/test/functional/ex_cmds/cmd_map_spec.lua
+++ b/test/functional/ex_cmds/cmd_map_spec.lua
@@ -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([[
diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua
index b03107deb0..137448acbd 100644
--- a/test/functional/legacy/matchparen_spec.lua
+++ b/test/functional/legacy/matchparen_spec.lua
@@ -61,13 +61,15 @@ describe('matchparen', function()
set hidden
call setline(1, ['()'])
normal 0
+
+ func OtherBuffer()
+ enew
+ exe "normal iaa\<Esc>0"
+ endfunc
]])
screen:expect(screen1)
- exec([[
- enew
- exe "normal iaa\<Esc>0"
- ]])
+ exec('call OtherBuffer()')
screen:expect(screen2)
feed('<C-^>')
@@ -77,6 +79,39 @@ describe('matchparen', function()
screen:expect(screen2)
end)
+ -- oldtest: Test_matchparen_win_execute()
+ it('matchparen highlight when switching buffer in win_execute()', function()
+ local screen = Screen.new(20, 5)
+ screen:set_default_attr_ids({
+ [1] = { background = Screen.colors.Cyan },
+ [2] = { reverse = true, bold = true },
+ [3] = { reverse = true },
+ })
+ screen:attach()
+
+ exec([[
+ source $VIMRUNTIME/plugin/matchparen.vim
+ let s:win = win_getid()
+ call setline(1, '{}')
+ split
+
+ func SwitchBuf()
+ call win_execute(s:win, 'enew | buffer #')
+ endfunc
+ ]])
+ screen:expect([[
+ {1:^{}} |
+ {2:[No Name] [+] }|
+ {} |
+ {3:[No Name] [+] }|
+ |
+ ]])
+
+ -- Switching buffer away and back shouldn't change matchparen highlight.
+ exec('call SwitchBuf()')
+ screen:expect_unchanged()
+ end)
+
-- oldtest: Test_matchparen_pum_clear()
it('is cleared when completion popup is shown', function()
local screen = Screen.new(30, 9)
diff --git a/test/functional/legacy/memory_usage_spec.lua b/test/functional/legacy/memory_usage_spec.lua
index a05e9fdf57..3a6eb2c31c 100644
--- a/test/functional/legacy/memory_usage_spec.lua
+++ b/test/functional/legacy/memory_usage_spec.lua
@@ -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)
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index 714e1b951f..2479a433e6 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -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(
@@ -541,7 +541,7 @@ describe('lua: nvim_buf_attach on_bytes', function()
feed 'cc'
check_events {
- { 'test1', 'bytes', 1, 4, 0, 0, 0, 0, 15, 15, 0, 0, 0 },
+ { 'test1', 'bytes', 1, 3, 0, 0, 0, 0, 15, 15, 0, 0, 0 },
}
feed '<ESC>'
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua
index 5802925339..716c1e0f30 100644
--- a/test/functional/lua/diagnostic_spec.lua
+++ b/test/functional/lua/diagnostic_spec.lua
@@ -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()
diff --git a/test/functional/lua/thread_spec.lua b/test/functional/lua/thread_spec.lua
index c1981e19d4..9bbee73e27 100644
--- a/test/functional/lua/thread_spec.lua
+++ b/test/functional/lua/thread_spec.lua
@@ -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)
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index add3df6d8a..7ab009659b 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -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 [[
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index d27fa375ee..a7cdc5f9fa 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.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)
diff --git a/test/functional/options/num_options_spec.lua b/test/functional/options/num_options_spec.lua
index 0614bcf814..3b411b109c 100644
--- a/test/functional/options/num_options_spec.lua
+++ b/test/functional/options/num_options_spec.lua
@@ -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
diff --git a/test/functional/options/winfixbuf_spec.lua b/test/functional/options/winfixbuf_spec.lua
new file mode 100644
index 0000000000..20407b9bb7
--- /dev/null
+++ b/test/functional/options/winfixbuf_spec.lua
@@ -0,0 +1,54 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear = helpers.clear
+local exec_lua = helpers.exec_lua
+
+describe("Nvim API calls with 'winfixbuf'", function()
+ before_each(function()
+ clear()
+ end)
+
+ it("Calling vim.api.nvim_win_set_buf with 'winfixbuf'", function()
+ local results = exec_lua([[
+ local function _setup_two_buffers()
+ local buffer = vim.api.nvim_create_buf(true, true)
+
+ vim.api.nvim_create_buf(true, true) -- Make another buffer
+
+ local current_window = 0
+ vim.api.nvim_set_option_value("winfixbuf", true, {win=current_window})
+
+ return buffer
+ end
+
+ local other_buffer = _setup_two_buffers()
+ local current_window = 0
+ local results, _ = pcall(vim.api.nvim_win_set_buf, current_window, other_buffer)
+
+ return results
+ ]])
+
+ assert(results == false)
+ end)
+
+ it("Calling vim.api.nvim_set_current_buf with 'winfixbuf'", function()
+ local results = exec_lua([[
+ local function _setup_two_buffers()
+ local buffer = vim.api.nvim_create_buf(true, true)
+
+ vim.api.nvim_create_buf(true, true) -- Make another buffer
+
+ local current_window = 0
+ vim.api.nvim_set_option_value("winfixbuf", true, {win=current_window})
+
+ return buffer
+ end
+
+ local other_buffer = _setup_two_buffers()
+ local results, _ = pcall(vim.api.nvim_set_current_buf, other_buffer)
+
+ return results
+ ]])
+
+ assert(results == false)
+ end)
+end)
diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua
index 705c182df7..72531db021 100644
--- a/test/functional/plugin/lsp/diagnostic_spec.lua
+++ b/test/functional/plugin/lsp/diagnostic_spec.lua
@@ -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)
diff --git a/test/functional/plugin/lsp/inlay_hint_spec.lua b/test/functional/plugin/lsp/inlay_hint_spec.lua
index 192797b312..864394d7e0 100644
--- a/test/functional/plugin/lsp/inlay_hint_spec.lua
+++ b/test/functional/plugin/lsp/inlay_hint_spec.lua
@@ -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)
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 4826153edb..0cb2b88948 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -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)
diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua
index 1b5c0eab5d..ff81ce4eb9 100644
--- a/test/functional/shada/merging_spec.lua
+++ b/test/functional/shada/merging_spec.lua
@@ -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)
diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua
index 2bf230fe69..7f2b5751ae 100644
--- a/test/functional/treesitter/highlight_spec.lua
+++ b/test/functional/treesitter/highlight_spec.lua
@@ -681,6 +681,12 @@ describe('treesitter highlighting (C)', function()
((identifier) @Identifier
(#set! conceal "")
(#eq? @Identifier "lstate"))
+
+ ((call_expression
+ function: (identifier) @function
+ arguments: (argument_list) @arguments)
+ (#eq? @function "multiqueue_put")
+ (#set! @function conceal "V"))
]]}})
]=]
@@ -697,7 +703,7 @@ describe('treesitter highlighting (C)', function()
|
LuaRef cb = nlua_ref(, 1); |
|
- multiqueue_put(main_loop.events, nlua_schedule_event, |
+ {11:V}(main_loop.events, nlua_schedule_event, |
1, (void *)(ptrdiff_t)cb); |
return 0; |
^} |
@@ -758,6 +764,44 @@ describe('treesitter highlighting (C)', function()
end)
end)
+describe('treesitter highlighting (lua)', function()
+ local screen
+
+ before_each(function()
+ screen = Screen.new(65, 18)
+ screen:attach()
+ screen:set_default_attr_ids {
+ [1] = { bold = true, foreground = Screen.colors.Blue },
+ [2] = { foreground = Screen.colors.DarkCyan },
+ [3] = { foreground = Screen.colors.Magenta },
+ [4] = { foreground = Screen.colors.SlateBlue },
+ [5] = { bold = true, foreground = Screen.colors.Brown },
+ }
+ end)
+
+ it('supports language injections', function()
+ insert [[
+ local ffi = require('ffi')
+ ffi.cdef("int (*fun)(int, char *);")
+ ]]
+
+ exec_lua [[
+ vim.bo.filetype = 'lua'
+ vim.treesitter.start()
+ ]]
+
+ screen:expect {
+ grid = [[
+ {5:local} {2:ffi} {5:=} {4:require(}{3:'ffi'}{4:)} |
+ {2:ffi}{4:.}{2:cdef}{4:(}{3:"}{4:int}{3: }{4:(}{5:*}{3:fun}{4:)(int,}{3: }{4:char}{3: }{5:*}{4:);}{3:"}{4:)} |
+ ^ |
+ {1:~ }|*14
+ |
+ ]],
+ }
+ end)
+end)
+
describe('treesitter highlighting (help)', function()
local screen
@@ -891,3 +935,46 @@ vim.cmd([[
}
end)
end)
+
+describe('treesitter highlighting (markdown)', function()
+ local screen
+
+ before_each(function()
+ screen = Screen.new(40, 6)
+ screen:attach()
+ screen:set_default_attr_ids {
+ [1] = { foreground = Screen.colors.Blue1 },
+ [2] = { bold = true, foreground = Screen.colors.Blue1 },
+ [3] = { bold = true, foreground = Screen.colors.Brown },
+ [4] = { foreground = Screen.colors.Cyan4 },
+ [5] = { foreground = Screen.colors.Magenta1 },
+ }
+ end)
+
+ it('supports hyperlinks', function()
+ local url = 'https://example.com'
+ insert(string.format('[This link text](%s) is a hyperlink.', url))
+ exec_lua([[
+ vim.bo.filetype = 'markdown'
+ vim.treesitter.start()
+ ]])
+
+ screen:expect {
+ grid = [[
+ {4:[}{6:This link text}{4:](}{7:https://example.com}{4:)} is|
+ a hyperlink^. |
+ {2:~ }|*3
+ |
+ ]],
+ attr_ids = {
+ [1] = { foreground = Screen.colors.Blue1 },
+ [2] = { bold = true, foreground = Screen.colors.Blue1 },
+ [3] = { bold = true, foreground = Screen.colors.Brown },
+ [4] = { foreground = Screen.colors.Cyan4 },
+ [5] = { foreground = Screen.colors.Magenta },
+ [6] = { foreground = Screen.colors.Cyan4, url = url },
+ [7] = { underline = true, foreground = Screen.colors.SlateBlue },
+ },
+ }
+ end)
+end)
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index 875b772fec..24f395c1ef 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -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()
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 65a7d359af..361ea3e778 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -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()
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 29c8c43ca1..d143c594f5 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -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
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 31b1464589..c18a07fef0 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -844,7 +844,7 @@ describe('ui/ext_messages', function()
}
end)
- it('implies ext_cmdline and ignores cmdheight', function()
+ it("implies ext_cmdline but allows changing 'cmdheight'", function()
eq(0, eval('&cmdheight'))
feed(':set cmdheight=1')
screen:expect {
@@ -864,15 +864,17 @@ describe('ui/ext_messages', function()
feed('<cr>')
screen:expect([[
^ |
- {1:~ }|*4
+ {1:~ }|*3
+ |
]])
- eq(0, eval('&cmdheight'))
+ eq(1, eval('&cmdheight'))
feed(':set cmdheight=0')
screen:expect {
grid = [[
^ |
- {1:~ }|*4
+ {1:~ }|*3
+ |
]],
cmdline = {
{