aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/editor/completion_spec.lua44
-rw-r--r--test/functional/terminal/buffer_spec.lua1
-rw-r--r--test/functional/terminal/ex_terminal_spec.lua95
-rw-r--r--test/functional/terminal/scrollback_spec.lua17
-rw-r--r--test/functional/terminal/tui_spec.lua25
-rw-r--r--test/functional/ui/highlight_spec.lua7
-rw-r--r--test/old/testdir/test_filetype.vim2
7 files changed, 132 insertions, 59 deletions
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua
index cbaf401f06..84af90a298 100644
--- a/test/functional/editor/completion_spec.lua
+++ b/test/functional/editor/completion_spec.lua
@@ -1257,4 +1257,48 @@ describe('completion', function()
{3:-- }{4:match 1 of 2} |
]]}
end)
+
+ it('restores extmarks if original text is restored #23653', function()
+ screen:try_resize(screen._width, 4)
+ command([[
+ call setline(1, ['aaaa'])
+ let ns_id = nvim_create_namespace('extmark')
+ let mark_id = nvim_buf_set_extmark(0, ns_id, 0, 0, { 'end_col':2, 'hl_group':'Error'})
+ let mark = nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })
+ inoremap <C-x> <C-r>=Complete()<CR>
+ function Complete() abort
+ call complete(1, [{ 'word': 'aaaaa' }])
+ return ''
+ endfunction
+ ]])
+ feed('A<C-X><C-E><Esc>')
+ eq(eval('mark'), eval("nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })"))
+ feed('A<C-N>')
+ eq(eval('mark'), eval("nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })"))
+ feed('<Esc>0Yppia<Esc>ggI<C-N>')
+ screen:expect([[
+ aaaa{7:^aa}aa |
+ {2:aaaa } |
+ {1:aaaaa } |
+ {3:-- Keyword completion (^N^P) }{4:match 1 of 2} |
+ ]])
+ feed('<C-N><C-N><Esc>')
+ eq(eval('mark'), eval("nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })"))
+ feed('A<C-N>')
+ eq(eval('mark'), eval("nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })"))
+ feed('<C-N>')
+ screen:expect([[
+ aaaaa^ |
+ {1:aaaa } |
+ {2:aaaaa } |
+ {3:-- Keyword completion (^N^P) }{4:match 2 of 2} |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ {7:aa}aa^ |
+ aaaa |
+ aaaaa |
+ {3:-- INSERT --} |
+ ]])
+ end)
end)
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index 6fcd029a5b..6d8c214d87 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -261,7 +261,6 @@ describe(':terminal buffer', function()
end)
it('it works with set rightleft #11438', function()
- skip(is_os('win'))
local columns = eval('&columns')
feed(string.rep('a', columns))
command('set rightleft')
diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua
index f628e261a2..77fe57dd94 100644
--- a/test/functional/terminal/ex_terminal_spec.lua
+++ b/test/functional/terminal/ex_terminal_spec.lua
@@ -141,46 +141,40 @@ describe(':terminal', function()
end)
end)
-describe(':terminal (with fake shell)', function()
+local function test_terminal_with_fake_shell(backslash)
+ -- shell-test.c is a fake shell that prints its arguments and exits.
+ local shell_path = testprg('shell-test')
+ if backslash then
+ shell_path = shell_path:gsub('/', [[\]])
+ end
+
local screen
before_each(function()
clear()
screen = Screen.new(50, 4)
screen:attach({rgb=false})
- -- shell-test.c is a fake shell that prints its arguments and exits.
- nvim('set_option_value', 'shell', testprg('shell-test'), {})
+ nvim('set_option_value', 'shell', shell_path, {})
nvim('set_option_value', 'shellcmdflag', 'EXE', {})
nvim('set_option_value', 'shellxquote', '', {})
end)
- -- Invokes `:terminal {cmd}` using a fake shell (shell-test.c) which prints
- -- the {cmd} and exits immediately.
- -- When no argument is given and the exit code is zero, the terminal buffer
- -- closes automatically.
- local function terminal_with_fake_shell(cmd)
- feed_command("terminal "..(cmd and cmd or ""))
- end
-
it('with no argument, acts like termopen()', function()
- skip(is_os('win'))
- -- Use the EXIT subcommand to end the process with a non-zero exit code to
- -- prevent the buffer from closing automatically
- nvim('set_option_value', 'shellcmdflag', 'EXIT', {})
- terminal_with_fake_shell(1)
+ command('autocmd! nvim_terminal TermClose')
+ feed_command('terminal')
retry(nil, 4 * screen.timeout, function()
screen:expect([[
- ^ |
- [Process exited 1] |
+ ^ready $ |
+ [Process exited 0] |
|
- :terminal 1 |
+ :terminal |
]])
end)
end)
it("with no argument, and 'shell' is set to empty string", function()
nvim('set_option_value', 'shell', '', {})
- terminal_with_fake_shell()
+ feed_command('terminal')
screen:expect([[
^ |
~ |
@@ -190,21 +184,19 @@ describe(':terminal (with fake shell)', function()
end)
it("with no argument, but 'shell' has arguments, acts like termopen()", function()
- skip(is_os('win'))
- nvim('set_option_value', 'shell', testprg('shell-test')..' -t jeff', {})
- terminal_with_fake_shell()
+ nvim('set_option_value', 'shell', shell_path ..' INTERACT', {})
+ feed_command('terminal')
screen:expect([[
- ^jeff $ |
- [Process exited 0] |
+ ^interact $ |
+ |
|
:terminal |
]])
end)
it('executes a given command through the shell', function()
- skip(is_os('win'))
command('set shellxquote=') -- win: avoid extra quotes
- terminal_with_fake_shell('echo hi')
+ feed_command('terminal echo hi')
screen:expect([[
^ready $ echo hi |
|
@@ -214,10 +206,9 @@ describe(':terminal (with fake shell)', function()
end)
it("executes a given command through the shell, when 'shell' has arguments", function()
- skip(is_os('win'))
- nvim('set_option_value', 'shell', testprg('shell-test')..' -t jeff', {})
+ nvim('set_option_value', 'shell', shell_path ..' -t jeff', {})
command('set shellxquote=') -- win: avoid extra quotes
- terminal_with_fake_shell('echo hi')
+ feed_command('terminal echo hi')
screen:expect([[
^jeff $ echo hi |
|
@@ -227,9 +218,8 @@ describe(':terminal (with fake shell)', function()
end)
it('allows quotes and slashes', function()
- skip(is_os('win'))
command('set shellxquote=') -- win: avoid extra quotes
- terminal_with_fake_shell([[echo 'hello' \ "world"]])
+ feed_command([[terminal echo 'hello' \ "world"]])
screen:expect([[
^ready $ echo 'hello' \ "world" |
|
@@ -247,31 +237,32 @@ describe(':terminal (with fake shell)', function()
end)
it('ignores writes if the backing stream closes', function()
- terminal_with_fake_shell()
- feed('iiXXXXXXX')
- poke_eventloop()
- -- Race: Though the shell exited (and streams were closed by SIGCHLD
- -- handler), :terminal cleanup is pending on the main-loop.
- -- This write should be ignored (not crash, #5445).
- feed('iiYYYYYYY')
- assert_alive()
+ command('autocmd! nvim_terminal TermClose')
+ feed_command('terminal')
+ feed('iiXXXXXXX')
+ poke_eventloop()
+ -- Race: Though the shell exited (and streams were closed by SIGCHLD
+ -- handler), :terminal cleanup is pending on the main-loop.
+ -- This write should be ignored (not crash, #5445).
+ feed('iiYYYYYYY')
+ assert_alive()
end)
it('works with findfile()', function()
+ command('autocmd! nvim_terminal TermClose')
feed_command('terminal')
eq('term://', string.match(eval('bufname("%")'), "^term://"))
eq('scripts/shadacat.py', eval('findfile("scripts/shadacat.py", ".")'))
end)
it('works with :find', function()
- skip(is_os('win'))
- nvim('set_option_value', 'shellcmdflag', 'EXIT', {})
- terminal_with_fake_shell(1)
+ command('autocmd! nvim_terminal TermClose')
+ feed_command('terminal')
screen:expect([[
- ^ |
- [Process exited 1] |
+ ^ready $ |
+ [Process exited 0] |
|
- :terminal 1 |
+ :terminal |
]])
eq('term://', string.match(eval('bufname("%")'), "^term://"))
feed([[<C-\><C-N>]])
@@ -284,9 +275,8 @@ describe(':terminal (with fake shell)', function()
end)
it('works with gf', function()
- skip(is_os('win'))
command('set shellxquote=') -- win: avoid extra quotes
- terminal_with_fake_shell([[echo "scripts/shadacat.py"]])
+ feed_command([[terminal echo "scripts/shadacat.py"]])
retry(nil, 4 * screen.timeout, function()
screen:expect([[
^ready $ echo "scripts/shadacat.py" |
@@ -311,4 +301,13 @@ describe(':terminal (with fake shell)', function()
terminal]])
end
end)
+end
+
+describe(':terminal (with fake shell)', function()
+ test_terminal_with_fake_shell(false)
+ if is_os('win') then
+ describe("when 'shell' uses backslashes", function()
+ test_terminal_with_fake_shell(true)
+ end)
+ end
end)
diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua
index 1e278e4cff..d687dff230 100644
--- a/test/functional/terminal/scrollback_spec.lua
+++ b/test/functional/terminal/scrollback_spec.lua
@@ -600,21 +600,24 @@ describe("pending scrollback line handling", function()
assert_alive()
end)
- it("does not crash after nvim_buf_call #14891", function()
- skip(is_os('win'))
- exec_lua [[
+ it('does not crash after nvim_buf_call #14891', function()
+ exec_lua([[
local bufnr = vim.api.nvim_create_buf(false, true)
+ local args = ...
vim.api.nvim_buf_call(bufnr, function()
- vim.fn.termopen({"echo", ("hi\n"):rep(11)})
+ vim.fn.termopen(args)
end)
vim.api.nvim_win_set_buf(0, bufnr)
- vim.cmd("startinsert")
- ]]
+ vim.cmd('startinsert')
+ ]], is_os('win')
+ and {'cmd.exe', '/c', 'for /L %I in (1,1,12) do @echo hi'}
+ or {'printf', ('hi\n'):rep(12)}
+ )
screen:expect [[
hi |
hi |
hi |
- |
+ hi |
|
[Process exited 0]{2: } |
{3:-- TERMINAL --} |
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index b17eed00f9..96ae0c4662 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -2557,6 +2557,31 @@ describe("TUI", function()
end)
end)
+ it('does not crash on large inputs #26099', function()
+ nvim_tui()
+
+ screen:expect([[
+ {1: } |
+ {4:~ }|
+ {4:~ }|
+ {4:~ }|
+ {4:~ }|
+ |
+ {3:-- TERMINAL --} |
+ ]])
+
+ feed_data(string.format('\027]52;c;%s\027\\', string.rep('A', 8192)))
+
+ screen:expect{grid=[[
+ {1: } |
+ {4:~ }|
+ {4:~ }|
+ {4:~ }|
+ {4:~ }|
+ |
+ {3:-- TERMINAL --} |
+ ]], unchanged=true}
+ end)
end)
-- See test/unit/tui_spec.lua for unit tests.
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 7776e024b0..cc66345850 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -894,13 +894,14 @@ describe('CursorLine and CursorLineNr highlights', function()
|
]])
+ command('set fillchars=colorcol:.')
command('set colorcolumn=3')
feed('i <esc>')
screen:expect([[
- {1:{} {7: } |
+ {1:{} {7:.} |
"{2:a}{7:"} : {3:abc} {3:// 10;} |
- {1:}} {7: } |
- {5: ^ }{7: }{5: }|
+ {1:}} {7:.} |
+ {5: ^ }{7:.}{5: }|
|
]])
end)
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
index 87044a06b5..18e878e04e 100644
--- a/test/old/testdir/test_filetype.vim
+++ b/test/old/testdir/test_filetype.vim
@@ -309,6 +309,7 @@ func s:GetFilenameChecks() abort
\ 'hostconf': ['/etc/host.conf', 'any/etc/host.conf'],
\ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'],
\ 'html': ['file.html', 'file.htm', 'file.cshtml'],
+ \ 'html.angular': ['file.component.html'],
\ 'htmlm4': ['file.html.m4'],
\ 'httest': ['file.htt', 'file.htb'],
\ 'hurl': ['file.hurl'],
@@ -437,6 +438,7 @@ func s:GetFilenameChecks() abort
\ 'mojo': ['file.mojo', 'file.🔥'],
\ 'mupad': ['file.mu'],
\ 'mush': ['file.mush'],
+ \ 'mustache': ['file.mustache'],
\ 'muttrc': ['Muttngrc', 'Muttrc', '.muttngrc', '.muttngrc-file', '.muttrc', '.muttrc-file', '/.mutt/muttngrc', '/.mutt/muttngrc-file', '/.mutt/muttrc', '/.mutt/muttrc-file', '/.muttng/muttngrc', '/.muttng/muttngrc-file', '/.muttng/muttrc', '/.muttng/muttrc-file', '/etc/Muttrc.d/file', '/etc/Muttrc.d/file.rc', 'Muttngrc-file', 'Muttrc-file', 'any/.mutt/muttngrc', 'any/.mutt/muttngrc-file', 'any/.mutt/muttrc', 'any/.mutt/muttrc-file', 'any/.muttng/muttngrc', 'any/.muttng/muttngrc-file', 'any/.muttng/muttrc', 'any/.muttng/muttrc-file', 'any/etc/Muttrc.d/file', 'muttngrc', 'muttngrc-file', 'muttrc', 'muttrc-file'],
\ 'mysql': ['file.mysql'],
\ 'n1ql': ['file.n1ql', 'file.nql'],