diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/window_spec.lua | 141 | ||||
-rw-r--r-- | test/functional/core/fileio_spec.lua | 28 | ||||
-rw-r--r-- | test/functional/legacy/autocmd_option_spec.lua | 7 | ||||
-rw-r--r-- | test/functional/lua/watch_spec.lua | 9 | ||||
-rw-r--r-- | test/functional/plugin/lsp/utils_spec.lua | 13 | ||||
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 16 | ||||
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 24 | ||||
-rw-r--r-- | test/functional/ui/inccommand_spec.lua | 18 | ||||
-rw-r--r-- | test/old/testdir/test_backspace_opt.vim | 18 | ||||
-rw-r--r-- | test/old/testdir/test_options.vim | 28 |
10 files changed, 182 insertions, 120 deletions
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 8038a84139..19511f30f1 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -687,42 +687,42 @@ describe('API/win', function() {8:[No Name] [+] }{9:[No Name] [+] }| | ]]} - eq(20, meths.win_text_height(1000, {})) - eq(20, meths.win_text_height(1001, {})) - eq(20, meths.win_text_height(1000, { start_row = 0 })) - eq(20, meths.win_text_height(1001, { start_row = 0 })) - eq(15, meths.win_text_height(1000, { end_row = -1 })) - eq(20, meths.win_text_height(1001, { end_row = -1 })) - eq(15, meths.win_text_height(1000, { end_row = 40 })) - eq(20, meths.win_text_height(1001, { end_row = 40 })) - eq(10, meths.win_text_height(1000, { start_row = 23 })) - eq(13, meths.win_text_height(1001, { start_row = 18 })) - eq(11, meths.win_text_height(1000, { end_row = 23 })) - eq(11, meths.win_text_height(1001, { end_row = 18 })) - eq(11, meths.win_text_height(1000, { start_row = 3, end_row = 39 })) - eq(11, meths.win_text_height(1001, { start_row = 1, end_row = 34 })) - eq(9, meths.win_text_height(1000, { start_row = 4, end_row = 38 })) - eq(9, meths.win_text_height(1001, { start_row = 2, end_row = 33 })) - eq(9, meths.win_text_height(1000, { start_row = 5, end_row = 37 })) - eq(9, meths.win_text_height(1001, { start_row = 3, end_row = 32 })) - eq(9, meths.win_text_height(1000, { start_row = 17, end_row = 25 })) - eq(9, meths.win_text_height(1001, { start_row = 15, end_row = 20 })) - eq(7, meths.win_text_height(1000, { start_row = 18, end_row = 24 })) - eq(7, meths.win_text_height(1001, { start_row = 16, end_row = 19 })) - eq(6, meths.win_text_height(1000, { start_row = -1 })) - eq(5, meths.win_text_height(1000, { start_row = -1, start_vcol = X })) - eq(0, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1 })) - eq(0, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1, end_vcol = X })) - eq(1, meths.win_text_height(1000, { start_row = -1, start_vcol = 0, end_row = -1, end_vcol = X })) - eq(3, meths.win_text_height(1001, { end_row = 0 })) - eq(2, meths.win_text_height(1001, { end_row = 0, end_vcol = 0 })) - eq(2, meths.win_text_height(1001, { start_row = 0, end_row = 0, end_vcol = 0 })) - eq(0, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = 0 })) - eq(1, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = X })) - eq(11, meths.win_text_height(1001, { end_row = 18 })) - eq(9, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18 })) - eq(10, meths.win_text_height(1001, { end_row = 18, end_vcol = 0 })) - eq(8, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18, end_vcol = 0 })) + eq({ all = 20, fill = 5 }, meths.win_text_height(1000, {})) + eq({ all = 20, fill = 5 }, meths.win_text_height(1001, {})) + eq({ all = 20, fill = 5 }, meths.win_text_height(1000, { start_row = 0 })) + eq({ all = 20, fill = 5 }, meths.win_text_height(1001, { start_row = 0 })) + eq({ all = 15, fill = 0 }, meths.win_text_height(1000, { end_row = -1 })) + eq({ all = 15, fill = 0 }, meths.win_text_height(1000, { end_row = 40 })) + eq({ all = 20, fill = 5 }, meths.win_text_height(1001, { end_row = -1 })) + eq({ all = 20, fill = 5 }, meths.win_text_height(1001, { end_row = 40 })) + eq({ all = 10, fill = 5 }, meths.win_text_height(1000, { start_row = 23 })) + eq({ all = 13, fill = 3 }, meths.win_text_height(1001, { start_row = 18 })) + eq({ all = 11, fill = 0 }, meths.win_text_height(1000, { end_row = 23 })) + eq({ all = 11, fill = 5 }, meths.win_text_height(1001, { end_row = 18 })) + eq({ all = 11, fill = 0 }, meths.win_text_height(1000, { start_row = 3, end_row = 39 })) + eq({ all = 11, fill = 3 }, meths.win_text_height(1001, { start_row = 1, end_row = 34 })) + eq({ all = 9, fill = 0 }, meths.win_text_height(1000, { start_row = 4, end_row = 38 })) + eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 2, end_row = 33 })) + eq({ all = 9, fill = 0 }, meths.win_text_height(1000, { start_row = 5, end_row = 37 })) + eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 3, end_row = 32 })) + eq({ all = 9, fill = 0 }, meths.win_text_height(1000, { start_row = 17, end_row = 25 })) + eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 15, end_row = 20 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(1000, { start_row = 18, end_row = 24 })) + eq({ all = 7, fill = 3 }, meths.win_text_height(1001, { start_row = 16, end_row = 19 })) + eq({ all = 6, fill = 5 }, meths.win_text_height(1000, { start_row = -1 })) + eq({ all = 5, fill = 5 }, meths.win_text_height(1000, { start_row = -1, start_vcol = X })) + eq({ all = 0, fill = 0 }, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1 })) + eq({ all = 0, fill = 0 }, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1, end_vcol = X })) + eq({ all = 1, fill = 0 }, meths.win_text_height(1000, { start_row = -1, start_vcol = 0, end_row = -1, end_vcol = X })) + eq({ all = 3, fill = 2 }, meths.win_text_height(1001, { end_row = 0 })) + eq({ all = 2, fill = 2 }, meths.win_text_height(1001, { end_row = 0, end_vcol = 0 })) + eq({ all = 2, fill = 2 }, meths.win_text_height(1001, { start_row = 0, end_row = 0, end_vcol = 0 })) + eq({ all = 0, fill = 0 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = 0 })) + eq({ all = 1, fill = 0 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = X })) + eq({ all = 11, fill = 5 }, meths.win_text_height(1001, { end_row = 18 })) + eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18 })) + eq({ all = 10, fill = 5 }, meths.win_text_height(1001, { end_row = 18, end_vcol = 0 })) + eq({ all = 8, fill = 3 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18, end_vcol = 0 })) end) it('with wrapped lines', function() @@ -770,39 +770,42 @@ describe('API/win', function() {1: 1 }^foobar-foobar-foobar-foobar-foobar-foobar| | ]]} - eq(21, meths.win_text_height(0, {})) - eq(6, meths.win_text_height(0, { start_row = 0, end_row = 0 })) - eq(7, meths.win_text_height(0, { start_row = 1, end_row = 1 })) - eq(8, meths.win_text_height(0, { start_row = 2, end_row = 2 })) - eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 41 })) - eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 42 })) - eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 86 })) - eq(3, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 87 })) - eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 266 })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 267 })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 311 })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 312 })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = X })) - eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 40, end_row = 1, end_vcol = X })) - eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 41, end_row = 1, end_vcol = X })) - eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 85, end_row = 1, end_vcol = X })) - eq(5, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = X })) - eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 265, end_row = 1, end_vcol = X })) - eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 266, end_row = 1, end_vcol = X })) - eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 310, end_row = 1, end_vcol = X })) - eq(0, meths.win_text_height(0, { start_row = 1, start_vcol = 311, end_row = 1, end_vcol = X })) - eq(18, meths.win_text_height(0, { start_row = 0, start_vcol = 131 })) - eq(19, meths.win_text_height(0, { start_row = 0, start_vcol = 130 })) - eq(20, meths.win_text_height(0, { end_row = 2, end_vcol = 311 })) - eq(21, meths.win_text_height(0, { end_row = 2, end_vcol = 312 })) - eq(17, meths.win_text_height(0, { start_row = 0, start_vcol = 131, end_row = 2, end_vcol = 311 })) - eq(19, meths.win_text_height(0, { start_row = 0, start_vcol = 130, end_row = 2, end_vcol = 312 })) - eq(16, meths.win_text_height(0, { start_row = 0, start_vcol = 221 })) - eq(17, meths.win_text_height(0, { start_row = 0, start_vcol = 220 })) - eq(14, meths.win_text_height(0, { end_row = 2, end_vcol = 41 })) - eq(15, meths.win_text_height(0, { end_row = 2, end_vcol = 42 })) - eq(9, meths.win_text_height(0, { start_row = 0, start_vcol = 221, end_row = 2, end_vcol = 41 })) - eq(11, meths.win_text_height(0, { start_row = 0, start_vcol = 220, end_row = 2, end_vcol = 42 })) + eq({ all = 21, fill = 0 }, meths.win_text_height(0, {})) + eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 0, end_row = 0 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, end_row = 1 })) + eq({ all = 8, fill = 0 }, meths.win_text_height(0, { start_row = 2, end_row = 2 })) + eq({ all = 0, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 0 })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 41 })) + eq({ all = 2, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 42 })) + eq({ all = 2, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 86 })) + eq({ all = 3, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 87 })) + eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 266 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 267 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 311 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 312 })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = X })) + eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 40, end_row = 1, end_vcol = X })) + eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 41, end_row = 1, end_vcol = X })) + eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 85, end_row = 1, end_vcol = X })) + eq({ all = 5, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = X })) + eq({ all = 2, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 265, end_row = 1, end_vcol = X })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 266, end_row = 1, end_vcol = X })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 310, end_row = 1, end_vcol = X })) + eq({ all = 0, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 311, end_row = 1, end_vcol = X })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = 131 })) + eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 221, end_row = 1, end_vcol = 266 })) + eq({ all = 18, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 131 })) + eq({ all = 19, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 130 })) + eq({ all = 20, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 311 })) + eq({ all = 21, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 312 })) + eq({ all = 17, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 131, end_row = 2, end_vcol = 311 })) + eq({ all = 19, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 130, end_row = 2, end_vcol = 312 })) + eq({ all = 16, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 221 })) + eq({ all = 17, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 220 })) + eq({ all = 14, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 41 })) + eq({ all = 15, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 42 })) + eq({ all = 9, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 221, end_row = 2, end_vcol = 41 })) + eq({ all = 11, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 220, end_row = 2, end_vcol = 42 })) end) end) diff --git a/test/functional/core/fileio_spec.lua b/test/functional/core/fileio_spec.lua index 4236a4ff47..8de78234ce 100644 --- a/test/functional/core/fileio_spec.lua +++ b/test/functional/core/fileio_spec.lua @@ -19,7 +19,6 @@ local meths = helpers.meths local mkdir = helpers.mkdir local sleep = helpers.sleep local read_file = helpers.read_file -local tmpname = helpers.tmpname local trim = helpers.trim local currentdir = helpers.funcs.getcwd local assert_alive = helpers.assert_alive @@ -46,6 +45,7 @@ describe('fileio', function() os.remove('Xtest-overwrite-forced') rmdir('Xtest_startup_swapdir') rmdir('Xtest_backupdir') + rmdir('Xtest_backupdir with spaces') end) it('fsync() codepaths #8304', function() @@ -133,6 +133,28 @@ describe('fileio', function() eq('foo', foo_contents); end) + it('backup with full path with spaces', function() + skip(is_ci('cirrus')) + clear() + mkdir('Xtest_backup with spaces') + command('set backup') + command('set backupdir=Xtest_backupdir\\ with\\ spaces//') + command('write Xtest_startup_file1') + feed('ifoo<esc>') + command('write') + feed('Abar<esc>') + command('write') + + -- Backup filename = fullpath, separators replaced with "%". + local backup_file_name = string.gsub(currentdir()..'/Xtest_startup_file1', + is_os('win') and '[:/\\]' or '/', '%%') .. '~' + local foo_contents = trim(read_file('Xtest_backupdir with spaces/'..backup_file_name)) + local foobar_contents = trim(read_file('Xtest_startup_file1')) + + eq('foobar', foobar_contents); + eq('foo', foo_contents); + end) + it('backup symlinked files #11349', function() skip(is_ci('cirrus')) clear() @@ -266,9 +288,7 @@ describe('tmpdir', function() before_each(function() -- Fake /tmp dir so that we can mess it up. - os_tmpdir = tmpname() - os.remove(os_tmpdir) - mkdir(os_tmpdir) + os_tmpdir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX') end) after_each(function() diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua index 8f17f509f5..2d17439a78 100644 --- a/test/functional/legacy/autocmd_option_spec.lua +++ b/test/functional/legacy/autocmd_option_spec.lua @@ -542,13 +542,6 @@ describe('au OptionSet', function() expected_combination({'cursorcolumn', 0, 0, 0, 1, 'global', 'set'}) end) - it('with option value converted internally', function() - command('noa set backspace=1') - command('set backspace=2') - expected_combination(({ - 'backspace', 'indent,eol', 'indent,eol', 'indent,eol', '2', 'global', 'set' - })) - end) end) describe('with specific option', function() diff --git a/test/functional/lua/watch_spec.lua b/test/functional/lua/watch_spec.lua index f041f4f1b6..ee31975063 100644 --- a/test/functional/lua/watch_spec.lua +++ b/test/functional/lua/watch_spec.lua @@ -3,7 +3,6 @@ local eq = helpers.eq local exec_lua = helpers.exec_lua local clear = helpers.clear local is_os = helpers.is_os -local mkdir = helpers.mkdir describe('vim._watch', function() before_each(function() @@ -12,9 +11,7 @@ describe('vim._watch', function() describe('watch', function() it('detects file changes', function() - local root_dir = helpers.tmpname() - os.remove(root_dir) - mkdir(root_dir) + local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX') local result = exec_lua( [[ @@ -100,9 +97,7 @@ describe('vim._watch', function() describe('poll', function() it('detects file changes', function() - local root_dir = helpers.tmpname() - os.remove(root_dir) - mkdir(root_dir) + local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX') local result = exec_lua( [[ diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua index 3e53b6d574..c91fffa90f 100644 --- a/test/functional/plugin/lsp/utils_spec.lua +++ b/test/functional/plugin/lsp/utils_spec.lua @@ -34,6 +34,19 @@ describe('vim.lsp.util', function() eq(expected, stylize_markdown(lines, opts)) end) + it('code fences with whitespace surrounded info string', function() + local lines = { + "``` lua ", + "local hello = 'world'", + "```", + } + local expected = { + "local hello = 'world'", + } + local opts = {} + eq(expected, stylize_markdown(lines, opts)) + end) + it('adds separator after code block', function() local lines = { "```lua", diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 38176c8749..9a777e2742 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -82,7 +82,7 @@ describe('LSP', function() describe('server_name specified', function() it('start_client(), stop_client()', function() retry(nil, 4000, function() - eq(1, exec_lua('return #lsp.get_active_clients()')) + eq(1, exec_lua('return #lsp.get_clients()')) end) eq(2, exec_lua([[ TEST_CLIENT2 = test__start_client() @@ -93,20 +93,20 @@ describe('LSP', function() return TEST_CLIENT3 ]])) retry(nil, 4000, function() - eq(3, exec_lua('return #lsp.get_active_clients()')) + eq(3, exec_lua('return #lsp.get_clients()')) end) eq(false, exec_lua('return lsp.get_client_by_id(TEST_CLIENT1) == nil')) eq(false, exec_lua('return lsp.get_client_by_id(TEST_CLIENT1).is_stopped()')) exec_lua('return lsp.get_client_by_id(TEST_CLIENT1).stop()') retry(nil, 4000, function() - eq(2, exec_lua('return #lsp.get_active_clients()')) + eq(2, exec_lua('return #lsp.get_clients()')) end) eq(true, exec_lua('return lsp.get_client_by_id(TEST_CLIENT1) == nil')) exec_lua('lsp.stop_client({TEST_CLIENT2, TEST_CLIENT3})') retry(nil, 4000, function() - eq(0, exec_lua('return #lsp.get_active_clients()')) + eq(0, exec_lua('return #lsp.get_clients()')) end) end) @@ -116,12 +116,12 @@ describe('LSP', function() TEST_CLIENT3 = test__start_client() ]]) retry(nil, 4000, function() - eq(3, exec_lua('return #lsp.get_active_clients()')) + eq(3, exec_lua('return #lsp.get_clients()')) end) -- Stop all clients. - exec_lua('lsp.stop_client(lsp.get_active_clients())') + exec_lua('lsp.stop_client(lsp.get_clients())') retry(nil, 4000, function() - eq(0, exec_lua('return #lsp.get_active_clients()')) + eq(0, exec_lua('return #lsp.get_clients()')) end) end) end) @@ -151,7 +151,7 @@ describe('LSP', function() describe('basic_init test', function() after_each(function() stop() - exec_lua("lsp.stop_client(lsp.get_active_clients(), true)") + exec_lua("lsp.stop_client(lsp.get_clients(), true)") exec_lua("vim.api.nvim_exec_autocmds('VimLeavePre', { modeline = false })") end) diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index bd898ba99e..8b43f5cf9c 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -431,6 +431,30 @@ it('terminal truncates number of composing characters to 5', function() retry(nil, nil, function() eq('a' .. composing:rep(5), meths.get_current_line()) end) end) +describe('terminal input', function() + before_each(function() + clear() + exec_lua([[ + _G.input_data = '' + vim.api.nvim_open_term(0, { on_input = function(_, _, _, data) + _G.input_data = _G.input_data .. data + end }) + ]]) + command('startinsert') + poke_eventloop() + end) + + it('<C-Space> is sent as NUL byte', function() + feed('aaa<C-Space>bbb') + eq('aaa\0bbb', exec_lua([[return _G.input_data]])) + end) + + it('unknown special keys are not sent', function() + feed('aaa<Help>bbb') + eq('aaabbb', exec_lua([[return _G.input_data]])) + end) +end) + if is_os('win') then describe(':terminal in Windows', function() local screen diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 23b200bd24..dc4aeb9c83 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -3086,8 +3086,7 @@ end) it('long :%s/ with inccommand does not collapse cmdline', function() clear() local screen = Screen.new(10,5) - common_setup(screen) - command('set inccommand=nosplit') + common_setup(screen, 'nosplit') feed(':%s/AAAAAAA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A') screen:expect([[ @@ -3099,6 +3098,21 @@ it('long :%s/ with inccommand does not collapse cmdline', function() ]]) end) +it("with 'inccommand' typing invalid `={expr}` does not show error", function() + clear() + local screen = Screen.new(30, 6) + common_setup(screen, 'nosplit') + feed(':edit `=`') + screen:expect([[ + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :edit `=`^ | + ]]) +end) + it("with 'inccommand' typing :filter doesn't segfault or leak memory #19057", function() clear() common_setup(nil, 'nosplit') diff --git a/test/old/testdir/test_backspace_opt.vim b/test/old/testdir/test_backspace_opt.vim index 59e94d2898..78c51cb874 100644 --- a/test/old/testdir/test_backspace_opt.vim +++ b/test/old/testdir/test_backspace_opt.vim @@ -36,15 +36,15 @@ func Test_backspace_option() " NOTE: Vim doesn't check following error... "call assert_fails('set backspace-=ghi', 'E474:') - " Check backwards compatibility with version 5.4 and earlier - set backspace=0 - call assert_equal('0', &backspace) - set backspace=1 - call assert_equal('1', &backspace) - set backspace=2 - call assert_equal('2', &backspace) - set backspace=3 - call assert_equal('3', &backspace) + " " Check backwards compatibility with version 5.4 and earlier + " set backspace=0 + " call assert_equal('0', &backspace) + " set backspace=1 + " call assert_equal('1', &backspace) + " set backspace=2 + " call assert_equal('2', &backspace) + " set backspace=3 + " call assert_equal('3', &backspace) call assert_fails('set backspace=4', 'E474:') call assert_fails('set backspace=10', 'E474:') diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index 6390b9c37a..aabb11a76a 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -22,20 +22,20 @@ func Test_whichwrap() set whichwrap=h,h,h call assert_equal('h', &whichwrap) - " For compatibility with Vim 3.0 and before, number values are also - " supported for 'whichwrap' - set whichwrap=1 - call assert_equal('b', &whichwrap) - set whichwrap=2 - call assert_equal('s', &whichwrap) - set whichwrap=4 - call assert_equal('h,l', &whichwrap) - set whichwrap=8 - call assert_equal('<,>', &whichwrap) - set whichwrap=16 - call assert_equal('[,]', &whichwrap) - set whichwrap=31 - call assert_equal('b,s,h,l,<,>,[,]', &whichwrap) + " " For compatibility with Vim 3.0 and before, number values are also + " " supported for 'whichwrap' + " set whichwrap=1 + " call assert_equal('b', &whichwrap) + " set whichwrap=2 + " call assert_equal('s', &whichwrap) + " set whichwrap=4 + " call assert_equal('h,l', &whichwrap) + " set whichwrap=8 + " call assert_equal('<,>', &whichwrap) + " set whichwrap=16 + " call assert_equal('[,]', &whichwrap) + " set whichwrap=31 + " call assert_equal('b,s,h,l,<,>,[,]', &whichwrap) set whichwrap& endfunc |