aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/lua/buffer_updates_spec.lua19
-rw-r--r--test/functional/plugin/lsp/completion_spec.lua35
-rw-r--r--test/functional/script/luacats_grammar_spec.lua4
-rw-r--r--test/functional/ui/decorations_spec.lua20
-rw-r--r--test/old/testdir/test_vartabs.vim73
5 files changed, 149 insertions, 2 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index d4af7e4732..6b575ad0ef 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -379,6 +379,25 @@ describe('lua buffer event callbacks: on_lines', function()
]],
})
end)
+
+ it('line lengths are correct when pressing TAB with folding #29119', function()
+ api.nvim_buf_set_lines(0, 0, -1, true, { 'a', 'b' })
+
+ exec_lua([[
+ _G.res = {}
+ vim.o.foldmethod = 'indent'
+ vim.o.softtabstop = -1
+ vim.api.nvim_buf_attach(0, false, {
+ on_lines = function(_, bufnr, _, row, _, end_row)
+ local lines = vim.api.nvim_buf_get_lines(bufnr, row, end_row, true)
+ table.insert(_G.res, lines)
+ end
+ })
+ ]])
+
+ feed('i<Tab>')
+ eq({ '\ta' }, exec_lua('return _G.res[#_G.res]'))
+ end)
end)
describe('lua: nvim_buf_attach on_bytes', function()
diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua
index d7755dd0c4..d8a3e0acbd 100644
--- a/test/functional/plugin/lsp/completion_spec.lua
+++ b/test/functional/plugin/lsp/completion_spec.lua
@@ -126,6 +126,41 @@ describe('vim.lsp.completion: item conversion', function()
eq(expected, result)
end)
+ it('trims trailing newline or tab from textEdit', function()
+ local range0 = {
+ start = { line = 0, character = 0 },
+ ['end'] = { line = 0, character = 0 },
+ }
+ local items = {
+ {
+ detail = 'ansible.builtin',
+ filterText = 'lineinfile ansible.builtin.lineinfile builtin ansible',
+ kind = 7,
+ label = 'ansible.builtin.lineinfile',
+ sortText = '2_ansible.builtin.lineinfile',
+ textEdit = {
+ newText = 'ansible.builtin.lineinfile:\n ',
+ range = range0,
+ },
+ },
+ }
+ local result = complete('|', items)
+ result = vim.tbl_map(function(x)
+ return {
+ abbr = x.abbr,
+ word = x.word,
+ }
+ end, result.items)
+
+ local expected = {
+ {
+ abbr = 'ansible.builtin.lineinfile',
+ word = 'ansible.builtin.lineinfile:',
+ },
+ }
+ eq(expected, result)
+ end)
+
it('prefers wordlike components for snippets', function()
-- There are two goals here:
--
diff --git a/test/functional/script/luacats_grammar_spec.lua b/test/functional/script/luacats_grammar_spec.lua
index d6fff3f409..9c6417f7bf 100644
--- a/test/functional/script/luacats_grammar_spec.lua
+++ b/test/functional/script/luacats_grammar_spec.lua
@@ -160,10 +160,10 @@ describe('luacats grammar', function()
type = '`T`',
})
- test('@param type [number,string] this is a tuple type', {
+ test('@param type [number,string,"good"|"bad"] this is a tuple type', {
desc = 'this is a tuple type',
kind = 'param',
name = 'type',
- type = '[number,string]',
+ type = '[number,string,"good"|"bad"]',
})
end)
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 746bfb3262..3e67e33ddb 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -5497,6 +5497,26 @@ l5
api.nvim_buf_clear_namespace(0, ns, 0, -1)
end)
+
+ it([[correct numberwidth with 'signcolumn' set to "number" #28984]], function()
+ command('set number numberwidth=1 signcolumn=number')
+ api.nvim_buf_set_extmark(0, ns, 0, 0, { sign_text = 'S1' })
+ screen:expect({
+ grid = [[
+ S1 ^ |
+ {1:~ }|*8
+ |
+ ]]
+ })
+ api.nvim_buf_del_extmark(0, ns, 1)
+ screen:expect({
+ grid = [[
+ {8:1 }^ |
+ {1:~ }|*8
+ |
+ ]]
+ })
+ end)
end)
describe('decorations: virt_text', function()
diff --git a/test/old/testdir/test_vartabs.vim b/test/old/testdir/test_vartabs.vim
index e12c71d521..82c3a513f9 100644
--- a/test/old/testdir/test_vartabs.vim
+++ b/test/old/testdir/test_vartabs.vim
@@ -445,4 +445,77 @@ func Test_shiftwidth_vartabstop()
setlocal shiftwidth& vartabstop& tabstop&
endfunc
+func Test_vartabstop_latin1()
+ throw "Skipped: Nvim does not support 'compatible'"
+ let save_encoding = &encoding
+ new
+ set encoding=iso8859-1
+ set compatible linebreak list revins smarttab
+ set vartabstop=400
+ exe "norm i00\t\<C-D>"
+ bwipe!
+ let &encoding = save_encoding
+ set nocompatible linebreak& list& revins& smarttab& vartabstop&
+endfunc
+
+" Verify that right-shifting and left-shifting adjust lines to the proper
+" tabstops.
+func Test_vartabstop_shift_right_left()
+ new
+ set expandtab
+ set shiftwidth=0
+ set vartabstop=17,11,7
+ exe "norm! aword"
+ let expect = "word"
+ call assert_equal(expect, getline(1))
+
+ " Shift to first tabstop.
+ norm! >>
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift to second tabstop.
+ norm! >>
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift to third tabstop.
+ norm! >>
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift to fourth tabstop, repeating the third shift width.
+ norm! >>
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift back to the third tabstop.
+ norm! <<
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift back to the second tabstop.
+ norm! <<
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift back to the first tabstop.
+ norm! <<
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift back to the left margin.
+ norm! <<
+ let expect = "word"
+ call assert_equal(expect, getline(1))
+
+ " Shift again back to the left margin.
+ norm! <<
+ let expect = "word"
+ call assert_equal(expect, getline(1))
+
+ bwipeout!
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab