aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/008_autocommands_spec.lua18
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua52
-rw-r--r--test/functional/legacy/012_directory_spec.lua33
-rw-r--r--test/functional/legacy/023_edit_arguments_spec.lua2
-rw-r--r--test/functional/legacy/025_jump_tag_hidden_spec.lua2
-rw-r--r--test/functional/legacy/029_join_spec.lua4
-rw-r--r--test/functional/legacy/031_close_commands_spec.lua7
-rw-r--r--test/functional/legacy/034_user_function_spec.lua73
-rw-r--r--test/functional/legacy/036_regexp_character_classes_spec.lua83
-rw-r--r--test/functional/legacy/038_virtual_replace_spec.lua4
-rw-r--r--test/functional/legacy/039_visual_block_mode_commands_spec.lua21
-rw-r--r--test/functional/legacy/055_list_and_dict_types_spec.lua6
-rw-r--r--test/functional/legacy/057_sort_spec.lua4
-rw-r--r--test/functional/legacy/060_exists_and_has_functions_spec.lua9
-rw-r--r--test/functional/legacy/063_match_and_matchadd_spec.lua21
-rw-r--r--test/functional/legacy/069_multibyte_formatting_spec.lua9
-rw-r--r--test/functional/legacy/074_global_var_in_viminfo_spec.lua120
-rw-r--r--test/functional/legacy/078_swapfile_recover_spec.lua4
-rw-r--r--test/functional/legacy/083_tag_search_with_file_encoding_spec.lua22
-rw-r--r--test/functional/legacy/090_sha256_spec.lua2
-rw-r--r--test/functional/legacy/091_context_variables_spec.lua2
-rw-r--r--test/functional/legacy/096_location_list_spec.lua37
-rw-r--r--test/functional/legacy/097_glob_path_spec.lua14
-rw-r--r--test/functional/legacy/102_fnameescape_spec.lua4
-rw-r--r--test/functional/legacy/106_errorformat_spec.lua2
-rw-r--r--test/functional/legacy/107_adjust_window_and_contents_spec.lua10
-rw-r--r--test/functional/legacy/108_backtrace_debug_commands_spec.lua2
-rw-r--r--test/functional/legacy/arglist_spec.lua5
-rw-r--r--test/functional/legacy/assert_spec.lua37
-rw-r--r--test/functional/legacy/autochdir_spec.lua60
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua316
-rw-r--r--test/functional/legacy/autocmd_spec.lua40
-rw-r--r--test/functional/legacy/breakindent_spec.lua78
-rw-r--r--test/functional/legacy/buffer_spec.lua8
-rw-r--r--test/functional/legacy/changelist_spec.lua2
-rw-r--r--test/functional/legacy/close_count_spec.lua40
-rw-r--r--test/functional/legacy/cmdline_spec.lua177
-rw-r--r--test/functional/legacy/conceal_spec.lua46
-rw-r--r--test/functional/legacy/cpoptions_spec.lua10
-rw-r--r--test/functional/legacy/crash_spec.lua19
-rw-r--r--test/functional/legacy/debugger_spec.lua46
-rw-r--r--test/functional/legacy/delete_spec.lua4
-rw-r--r--test/functional/legacy/digraph_spec.lua21
-rw-r--r--test/functional/legacy/display_spec.lua111
-rw-r--r--test/functional/legacy/edit_spec.lua52
-rw-r--r--test/functional/legacy/erasebackword_spec.lua1
-rw-r--r--test/functional/legacy/eval_spec.lua386
-rw-r--r--test/functional/legacy/ex_mode_spec.lua26
-rw-r--r--test/functional/legacy/excmd_spec.lua136
-rw-r--r--test/functional/legacy/filechanged_spec.lua10
-rw-r--r--test/functional/legacy/fixeol_spec.lua10
-rw-r--r--test/functional/legacy/fnamemodify_spec.lua4
-rw-r--r--test/functional/legacy/fold_spec.lua69
-rw-r--r--test/functional/legacy/function_sort_spec.lua26
-rw-r--r--test/functional/legacy/gf_spec.lua6
-rw-r--r--test/functional/legacy/global_spec.lua13
-rw-r--r--test/functional/legacy/highlight_spec.lua18
-rw-r--r--test/functional/legacy/increment_spec.lua9
-rw-r--r--test/functional/legacy/lispwords_spec.lua2
-rw-r--r--test/functional/legacy/listchars_spec.lua48
-rw-r--r--test/functional/legacy/listlbr_spec.lua46
-rw-r--r--test/functional/legacy/listlbr_utf8_spec.lua29
-rw-r--r--test/functional/legacy/mapping_spec.lua20
-rw-r--r--test/functional/legacy/match_spec.lua35
-rw-r--r--test/functional/legacy/matchparen_spec.lua32
-rw-r--r--test/functional/legacy/memory_usage_spec.lua68
-rw-r--r--test/functional/legacy/messages_spec.lua187
-rw-r--r--test/functional/legacy/mksession_spec.lua6
-rw-r--r--test/functional/legacy/move_spec.lua18
-rw-r--r--test/functional/legacy/normal_spec.lua32
-rw-r--r--test/functional/legacy/number_spec.lua306
-rw-r--r--test/functional/legacy/options_spec.lua16
-rw-r--r--test/functional/legacy/prompt_buffer_spec.lua165
-rw-r--r--test/functional/legacy/put_spec.lua9
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua256
-rw-r--r--test/functional/legacy/search_spec.lua133
-rw-r--r--test/functional/legacy/search_stat_spec.lua78
-rw-r--r--test/functional/legacy/source_spec.lua16
-rw-r--r--test/functional/legacy/statusline_spec.lua43
-rw-r--r--test/functional/legacy/substitute_spec.lua138
-rw-r--r--test/functional/legacy/syn_attr_spec.lua4
-rw-r--r--test/functional/legacy/tabline_spec.lua28
-rw-r--r--test/functional/legacy/tagcase_spec.lua7
-rw-r--r--test/functional/legacy/undolevels_spec.lua4
-rw-r--r--test/functional/legacy/vimscript_spec.lua28
-rw-r--r--test/functional/legacy/visual_spec.lua16
-rw-r--r--test/functional/legacy/window_cmd_spec.lua10
-rw-r--r--test/functional/legacy/wordcount_spec.lua77
88 files changed, 2208 insertions, 2002 deletions
diff --git a/test/functional/legacy/008_autocommands_spec.lua b/test/functional/legacy/008_autocommands_spec.lua
index 4088cd1644..16f0216bc0 100644
--- a/test/functional/legacy/008_autocommands_spec.lua
+++ b/test/functional/legacy/008_autocommands_spec.lua
@@ -3,7 +3,8 @@
local helpers = require('test.functional.helpers')(after_each)
local source = helpers.source
-local clear, command, expect, eq, eval = helpers.clear, helpers.command, helpers.expect, helpers.eq, helpers.eval
+local clear, command, expect, eq, eval =
+ helpers.clear, helpers.command, helpers.expect, helpers.eq, helpers.eval
local write_file, dedent = helpers.write_file, helpers.dedent
local read_file = helpers.read_file
local expect_exit = helpers.expect_exit
@@ -16,8 +17,8 @@ describe('autocommands that delete and unload buffers:', function()
end of Xxx]])
local text2 = text1:gsub('1', '2')
setup(function()
- write_file('Xxx1', text1..'\n')
- write_file('Xxx2', text2..'\n')
+ write_file('Xxx1', text1 .. '\n')
+ write_file('Xxx2', text2 .. '\n')
end)
teardown(function()
os.remove(test_file)
@@ -36,8 +37,7 @@ describe('autocommands that delete and unload buffers:', function()
-- The legacy test file did not check the error message.
command('let v:errmsg = "no error"')
command('silent! write')
- eq('E203: Autocommands deleted or unloaded buffer to be written',
- eval('v:errmsg'))
+ eq('E203: Autocommands deleted or unloaded buffer to be written', eval('v:errmsg'))
eq('Xxx2', eval('bufname("%")'))
expect(text2)
-- Start editing Xxx2.
@@ -46,8 +46,7 @@ describe('autocommands that delete and unload buffers:', function()
command('let v:errmsg = "no error"')
-- Write Xxx2, will delete the buffer and give an error msg.
command('silent! write')
- eq('E203: Autocommands deleted or unloaded buffer to be written',
- eval('v:errmsg'))
+ eq('E203: Autocommands deleted or unloaded buffer to be written', eval('v:errmsg'))
eq('Xxx1', eval('bufname("%")'))
expect(text1)
end)
@@ -63,7 +62,7 @@ describe('autocommands that delete and unload buffers:', function()
endwhile
endfunc
func WriteToOut()
- edit! ]]..test_file..[[
+ edit! ]] .. test_file .. [[
$put ='VimLeave done'
write
@@ -80,7 +79,6 @@ describe('autocommands that delete and unload buffers:', function()
command('silent! edit Makefile') -- an existing file
command('silent! split new2')
expect_exit(command, 'silent! quit')
- eq('VimLeave done',
- string.match(read_file(test_file), "^%s*(.-)%s*$"))
+ eq('VimLeave done', string.match(read_file(test_file), '^%s*(.-)%s*$'))
end)
end)
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index 5b6d030567..eba878b99a 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -12,11 +12,16 @@
-- Use a FileChangedShell autocommand to avoid a prompt for "Xtestfile.gz"
-- being modified outside of Vim (noticed on Solaris).
-local helpers= require('test.functional.helpers')(after_each)
-local luv = require('luv')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed_command, expect, eq, neq, dedent, write_file, feed =
- helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.neq,
- helpers.dedent, helpers.write_file, helpers.feed
+ helpers.clear,
+ helpers.feed_command,
+ helpers.expect,
+ helpers.eq,
+ helpers.neq,
+ helpers.dedent,
+ helpers.write_file,
+ helpers.feed
local command = helpers.command
local read_file = helpers.read_file
local is_os = helpers.is_os
@@ -27,12 +32,12 @@ local function has_gzip()
end
local function prepare_gz_file(name, text)
- write_file(name, text..'\n')
+ write_file(name, text .. '\n')
-- Compress the file with gzip.
- command([[call system(['gzip', '--force', ']]..name..[['])]])
+ command([[call system(['gzip', '--force', ']] .. name .. [['])]])
-- This should create the .gz file and delete the original.
- neq(nil, luv.fs_stat(name..'.gz'))
- eq(nil, luv.fs_stat(name))
+ neq(nil, vim.uv.fs_stat(name .. '.gz'))
+ eq(nil, vim.uv.fs_stat(name))
end
describe('file reading, writing and bufnew and filter autocommands', function()
@@ -49,14 +54,17 @@ describe('file reading, writing and bufnew and filter autocommands', function()
line 10 Abcdefghijklmnopqrstuvwxyz
end of testfile]])
setup(function()
- write_file('Xtest.c', [[
+ write_file(
+ 'Xtest.c',
+ [[
/*
* Here is a new .c file
*/
- ]])
+ ]]
+ )
end)
- before_each(function ()
- clear({env={GZIP=nil}})
+ before_each(function()
+ clear({ env = { GZIP = nil } })
end)
teardown(function()
os.remove('Xtestfile.gz')
@@ -67,7 +75,6 @@ describe('file reading, writing and bufnew and filter autocommands', function()
if not has_gzip() then
pending('skipped (missing `gzip` utility)', function() end)
else
-
it('FileReadPost (using gzip)', function()
prepare_gz_file('Xtestfile', text1)
--execute('au FileChangedShell * echo "caught FileChangedShell"')
@@ -75,7 +82,7 @@ describe('file reading, writing and bufnew and filter autocommands', function()
feed_command("au FileReadPost *.gz '[,']!gzip -d")
-- Read and decompress the testfile.
feed_command('$r Xtestfile.gz')
- expect('\n'..text1)
+ expect('\n' .. text1)
end)
it('BufReadPre, BufReadPost (using gzip)', function()
@@ -100,7 +107,9 @@ describe('file reading, writing and bufnew and filter autocommands', function()
-- luacheck: ignore 611 (Line contains only whitespaces)
it('FileReadPre, FileReadPost', function()
prepare_gz_file('Xtestfile', text1)
- feed_command('au! FileReadPre *.gz exe "silent !gzip -d " . shellescape(expand("<afile>"))')
+ feed_command(
+ 'au! FileReadPre *.gz exe "silent !gzip -d " . shellescape(expand("<afile>"))'
+ )
feed_command('au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>"))')
feed_command("au! FileReadPost *.gz '[,']s/l/L/")
-- Read compressed file.
@@ -121,7 +130,6 @@ describe('file reading, writing and bufnew and filter autocommands', function()
Line 10 Abcdefghijklmnopqrstuvwxyz
end of testfiLe]])
end)
-
end
it('FileAppendPre, FileAppendPost', function()
@@ -169,9 +177,15 @@ describe('file reading, writing and bufnew and filter autocommands', function()
*/]]))
-- Need temp files here.
feed_command('set shelltemp')
- feed_command('au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t")')
- feed_command('au FilterReadPre *.out exe "silent !sed s/e/E/ " . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))')
- feed_command('au FilterReadPre *.out exe "silent !rm " . shellescape(expand("<afile>")) . ".t"')
+ feed_command(
+ 'au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t")'
+ )
+ feed_command(
+ 'au FilterReadPre *.out exe "silent !sed s/e/E/ " . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))'
+ )
+ feed_command(
+ 'au FilterReadPre *.out exe "silent !rm " . shellescape(expand("<afile>")) . ".t"'
+ )
feed_command("au FilterReadPost *.out '[,']s/x/X/g")
-- Edit the output file.
feed_command('e! test.out')
diff --git a/test/functional/legacy/012_directory_spec.lua b/test/functional/legacy/012_directory_spec.lua
index 25d0dcb81e..b428318e3f 100644
--- a/test/functional/legacy/012_directory_spec.lua
+++ b/test/functional/legacy/012_directory_spec.lua
@@ -4,13 +4,12 @@
-- - "dir", in directory relative to current dir
local helpers = require('test.functional.helpers')(after_each)
-local luv = require('luv')
local eq = helpers.eq
local neq = helpers.neq
local poke_eventloop = helpers.poke_eventloop
-local funcs = helpers.funcs
-local meths = helpers.meths
+local fn = helpers.fn
+local api = helpers.api
local clear = helpers.clear
local insert = helpers.insert
local command = helpers.command
@@ -21,7 +20,7 @@ local mkdir = helpers.mkdir
local function ls_dir_sorted(dirname)
local files = {}
for f in vim.fs.dir(dirname) do
- if f ~= "." and f~= ".." then
+ if f ~= '.' and f ~= '..' then
table.insert(files, f)
end
end
@@ -57,36 +56,36 @@ describe("'directory' option", function()
line 3 Abcdefghij
end of testfile]])
- meths.set_option_value('swapfile', true, {})
- meths.set_option_value('swapfile', true, {})
- meths.set_option_value('directory', '.', {})
+ api.nvim_set_option_value('swapfile', true, {})
+ api.nvim_set_option_value('swapfile', true, {})
+ api.nvim_set_option_value('directory', '.', {})
-- sanity check: files should not exist yet.
- eq(nil, luv.fs_stat('.Xtest1.swp'))
+ eq(nil, vim.uv.fs_stat('.Xtest1.swp'))
command('edit! Xtest1')
poke_eventloop()
- eq('Xtest1', funcs.buffer_name('%'))
+ eq('Xtest1', fn.buffer_name('%'))
-- Verify that the swapfile exists. In the legacy test this was done by
-- reading the output from :!ls.
- neq(nil, luv.fs_stat('.Xtest1.swp'))
+ neq(nil, vim.uv.fs_stat('.Xtest1.swp'))
- meths.set_option_value('directory', './Xtest2,.', {})
+ api.nvim_set_option_value('directory', './Xtest2,.', {})
command('edit Xtest1')
poke_eventloop()
-- swapfile should no longer exist in CWD.
- eq(nil, luv.fs_stat('.Xtest1.swp'))
+ eq(nil, vim.uv.fs_stat('.Xtest1.swp'))
- eq({ "Xtest1.swp", "Xtest3" }, ls_dir_sorted("Xtest2"))
+ eq({ 'Xtest1.swp', 'Xtest3' }, ls_dir_sorted('Xtest2'))
- meths.set_option_value('directory', 'Xtest.je', {})
+ api.nvim_set_option_value('directory', 'Xtest.je', {})
command('bdelete')
command('edit Xtest2/Xtest3')
- eq(true, meths.get_option_value('swapfile', {}))
+ eq(true, api.nvim_get_option_value('swapfile', {}))
poke_eventloop()
- eq({ "Xtest3" }, ls_dir_sorted("Xtest2"))
- eq({ "Xtest3.swp" }, ls_dir_sorted("Xtest.je"))
+ eq({ 'Xtest3' }, ls_dir_sorted('Xtest2'))
+ eq({ 'Xtest3.swp' }, ls_dir_sorted('Xtest.je'))
end)
end)
diff --git a/test/functional/legacy/023_edit_arguments_spec.lua b/test/functional/legacy/023_edit_arguments_spec.lua
index f59d192c1e..64b2f6fa95 100644
--- a/test/functional/legacy/023_edit_arguments_spec.lua
+++ b/test/functional/legacy/023_edit_arguments_spec.lua
@@ -28,7 +28,7 @@ describe(':edit', function()
-- Open Xfile2 using '|' range
command('edit Xfile2|1')
- command("s/\\//SLASH/")
+ command('s/\\//SLASH/')
command('yank A')
command('w! Xfile2')
diff --git a/test/functional/legacy/025_jump_tag_hidden_spec.lua b/test/functional/legacy/025_jump_tag_hidden_spec.lua
index 15bd56a601..33bab05404 100644
--- a/test/functional/legacy/025_jump_tag_hidden_spec.lua
+++ b/test/functional/legacy/025_jump_tag_hidden_spec.lua
@@ -56,6 +56,6 @@ describe('jump to a tag with hidden set', function()
feed_command('$d')
-- Assert buffer contents.
- expect("#efine SECTION_OFF 3")
+ expect('#efine SECTION_OFF 3')
end)
end)
diff --git a/test/functional/legacy/029_join_spec.lua b/test/functional/legacy/029_join_spec.lua
index b28f276a7c..c808a21afc 100644
--- a/test/functional/legacy/029_join_spec.lua
+++ b/test/functional/legacy/029_join_spec.lua
@@ -313,7 +313,9 @@ describe('joining lines', function()
feed('j')
feed_command('.,+5join')
feed('j6J<cr>')
- feed('oSome code!<cr>// Make sure backspacing does not remove this comment leader.<esc>0i<bs><esc>')
+ feed(
+ 'oSome code!<cr>// Make sure backspacing does not remove this comment leader.<esc>0i<bs><esc>'
+ )
expect([[
{
diff --git a/test/functional/legacy/031_close_commands_spec.lua b/test/functional/legacy/031_close_commands_spec.lua
index d02b1a2049..173ebf1cf4 100644
--- a/test/functional/legacy/031_close_commands_spec.lua
+++ b/test/functional/legacy/031_close_commands_spec.lua
@@ -119,9 +119,12 @@ describe('Commands that close windows and/or buffers', function()
feed_command('q!')
feed('<CR>')
expect('testtext 1')
- expect_exit(source, [[
+ expect_exit(
+ source,
+ [[
q!
" Now nvim should have exited
- throw "Oh, Not finished yet."]])
+ throw "Oh, Not finished yet."]]
+ )
end)
end)
diff --git a/test/functional/legacy/034_user_function_spec.lua b/test/functional/legacy/034_user_function_spec.lua
index 0b7dfc4f0e..c30c7275f2 100644
--- a/test/functional/legacy/034_user_function_spec.lua
+++ b/test/functional/legacy/034_user_function_spec.lua
@@ -7,13 +7,15 @@ local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
-describe('user functions, expr-mappings, overwrite protected builtin functions and regression on calling expressions', function()
- setup(clear)
+describe(
+ 'user functions, expr-mappings, overwrite protected builtin functions and regression on calling expressions',
+ function()
+ setup(clear)
- it('are working', function()
- insert('here')
+ it('are working', function()
+ insert('here')
- source([[
+ source([[
function Table(title, ...)
let ret = a:title
let idx = 1
@@ -59,35 +61,35 @@ describe('user functions, expr-mappings, overwrite protected builtin functions a
let retval = "nop"
/^here
]])
- feed('C<C-R>=Table("xxx", 4, "asdf")<cr>')
- -- Using a actual space will not work as feed() calls dedent on the input.
- feed('<space><C-R>=Compute(45, 0, "retval")<cr>')
- feed('<space><C-R>=retval<cr>')
- feed('<space><C-R>=Compute(45, 5, "retval")<cr>')
- feed('<space><C-R>=retval<cr>')
- feed('<space><C-R>=g:FuncRef(333)<cr>')
- feed('<cr>')
- feed('XX+-XX<cr>')
- feed('---*---<cr>')
- feed('(one<cr>')
- feed('(two<cr>')
- feed('[(one again<esc>')
- feed_command('call append(line("$"), max([1, 2, 3]))')
- feed_command('call extend(g:, {"max": function("min")})')
- feed_command('call append(line("$"), max([1, 2, 3]))')
- feed_command('try')
- -- Regression: the first line below used to throw "E110: Missing ')'"
- -- Second is here just to prove that this line is correct when not
- -- skipping rhs of &&.
- feed_command([[ $put =(0&&(function('tr'))(1, 2, 3))]])
- feed_command([[ $put =(1&&(function('tr'))(1, 2, 3))]])
- feed_command('catch')
- feed_command([[ $put ='!!! Unexpected exception:']])
- feed_command(' $put =v:exception')
- feed_command('endtry')
+ feed('C<C-R>=Table("xxx", 4, "asdf")<cr>')
+ -- Using a actual space will not work as feed() calls dedent on the input.
+ feed('<space><C-R>=Compute(45, 0, "retval")<cr>')
+ feed('<space><C-R>=retval<cr>')
+ feed('<space><C-R>=Compute(45, 5, "retval")<cr>')
+ feed('<space><C-R>=retval<cr>')
+ feed('<space><C-R>=g:FuncRef(333)<cr>')
+ feed('<cr>')
+ feed('XX+-XX<cr>')
+ feed('---*---<cr>')
+ feed('(one<cr>')
+ feed('(two<cr>')
+ feed('[(one again<esc>')
+ feed_command('call append(line("$"), max([1, 2, 3]))')
+ feed_command('call extend(g:, {"max": function("min")})')
+ feed_command('call append(line("$"), max([1, 2, 3]))')
+ feed_command('try')
+ -- Regression: the first line below used to throw "E110: Missing ')'"
+ -- Second is here just to prove that this line is correct when not
+ -- skipping rhs of &&.
+ feed_command([[ $put =(0&&(function('tr'))(1, 2, 3))]])
+ feed_command([[ $put =(1&&(function('tr'))(1, 2, 3))]])
+ feed_command('catch')
+ feed_command([[ $put ='!!! Unexpected exception:']])
+ feed_command(' $put =v:exception')
+ feed_command('endtry')
- -- Assert buffer contents.
- expect([[
+ -- Assert buffer contents.
+ expect([[
xxx4asdf fail nop ok 9 333
XX111-XX
---222---
@@ -98,5 +100,6 @@ describe('user functions, expr-mappings, overwrite protected builtin functions a
3
0
1]])
- end)
-end)
+ end)
+ end
+)
diff --git a/test/functional/legacy/036_regexp_character_classes_spec.lua b/test/functional/legacy/036_regexp_character_classes_spec.lua
index 6f66efcb67..ed35b2b245 100644
--- a/test/functional/legacy/036_regexp_character_classes_spec.lua
+++ b/test/functional/legacy/036_regexp_character_classes_spec.lua
@@ -5,16 +5,16 @@ local clear, command, expect = helpers.clear, helpers.command, helpers.expect
local source, write_file = helpers.source, helpers.write_file
local function sixlines(text)
- local result = ''
- for _ = 1, 6 do
- result = result .. text .. '\n'
- end
- return result
+ local result = ''
+ for _ = 1, 6 do
+ result = result .. text .. '\n'
+ end
+ return result
end
local function diff(text, nodedent)
local fname = helpers.tmpname()
- command('w! '..fname)
+ command('w! ' .. fname)
helpers.poke_eventloop()
local data = io.open(fname):read('*all')
if nodedent then
@@ -40,7 +40,16 @@ describe('character classes in regexp', function()
-- The original test32.in file was not in utf-8 encoding and did also
-- contain some control characters. We use lua escape sequences to write
-- them to the test file.
- local line = ctrl1..punct1..digits..punct2..upper..punct3..lower..punct4..ctrl2..iso_text
+ local line = ctrl1
+ .. punct1
+ .. digits
+ .. punct2
+ .. upper
+ .. punct3
+ .. lower
+ .. punct4
+ .. ctrl2
+ .. iso_text
write_file('test36.in', sixlines(line))
end)
before_each(function()
@@ -59,8 +68,9 @@ describe('character classes in regexp', function()
4 s/\%#=0[0-9]//g
5 s/\%#=1[0-9]//g
6 s/\%#=2[0-9]//g]])
- diff(sixlines(ctrl1..punct1..punct2..upper..punct3..lower..punct4..
- ctrl2..iso_text))
+ diff(
+ sixlines(ctrl1 .. punct1 .. punct2 .. upper .. punct3 .. lower .. punct4 .. ctrl2 .. iso_text)
+ )
end)
it('is working', function()
source([[
@@ -86,8 +96,11 @@ describe('character classes in regexp', function()
4 s/\%#=0[0-7]//g
5 s/\%#=1[0-7]//g
6 s/\%#=2[0-7]//g]])
- diff(sixlines(ctrl1..punct1..'89'..punct2..upper..punct3..lower..punct4..ctrl2..
- iso_text))
+ diff(
+ sixlines(
+ ctrl1 .. punct1 .. '89' .. punct2 .. upper .. punct3 .. lower .. punct4 .. ctrl2 .. iso_text
+ )
+ )
end)
it('is working', function()
source([[
@@ -113,7 +126,11 @@ describe('character classes in regexp', function()
4 s/\%#=0[0-9A-Fa-f]//g
5 s/\%#=1[0-9A-Fa-f]//g
6 s/\%#=2[0-9A-Fa-f]//g]])
- diff(sixlines(ctrl1..punct1..punct2..'GHIXYZ'..punct3..'ghiwxyz'..punct4..ctrl2..iso_text))
+ diff(
+ sixlines(
+ ctrl1 .. punct1 .. punct2 .. 'GHIXYZ' .. punct3 .. 'ghiwxyz' .. punct4 .. ctrl2 .. iso_text
+ )
+ )
end)
it('is working', function()
source([[
@@ -139,7 +156,7 @@ describe('character classes in regexp', function()
4 s/\%#=0[0-9A-Za-z_]//g
5 s/\%#=1[0-9A-Za-z_]//g
6 s/\%#=2[0-9A-Za-z_]//g]])
- diff(sixlines(ctrl1..punct1..punct2..'[\\]^`'..punct4..ctrl2..iso_text))
+ diff(sixlines(ctrl1 .. punct1 .. punct2 .. '[\\]^`' .. punct4 .. ctrl2 .. iso_text))
end)
it('is working', function()
source([[
@@ -165,8 +182,7 @@ describe('character classes in regexp', function()
4 s/\%#=0[A-Za-z_]//g
5 s/\%#=1[A-Za-z_]//g
6 s/\%#=2[A-Za-z_]//g]])
- diff(sixlines(ctrl1..punct1..digits..punct2..'[\\]^`'..punct4..ctrl2..
- iso_text))
+ diff(sixlines(ctrl1 .. punct1 .. digits .. punct2 .. '[\\]^`' .. punct4 .. ctrl2 .. iso_text))
end)
it('is working', function()
source([[
@@ -192,7 +208,7 @@ describe('character classes in regexp', function()
4 s/\%#=0[A-Za-z]//g
5 s/\%#=1[A-Za-z]//g
6 s/\%#=2[A-Za-z]//g]])
- diff(sixlines(ctrl1..punct1..digits..punct2..punct3..punct4..ctrl2..iso_text))
+ diff(sixlines(ctrl1 .. punct1 .. digits .. punct2 .. punct3 .. punct4 .. ctrl2 .. iso_text))
end)
it('is working', function()
source([[
@@ -218,8 +234,11 @@ describe('character classes in regexp', function()
4 s/\%#=0[a-z]//g
5 s/\%#=1[a-z]//g
6 s/\%#=2[a-z]//g]])
- diff(sixlines(ctrl1..punct1..digits..punct2..upper..punct3..punct4..
- ctrl2..iso_text))
+ diff(
+ sixlines(
+ ctrl1 .. punct1 .. digits .. punct2 .. upper .. punct3 .. punct4 .. ctrl2 .. iso_text
+ )
+ )
end)
it('is working', function()
source([[
@@ -245,8 +264,11 @@ describe('character classes in regexp', function()
4 s/\%#=0[A-Z]//g
5 s/\%#=1[A-Z]//g
6 s/\%#=2[A-Z]//g]])
- diff(sixlines(ctrl1..punct1..digits..punct2..punct3..lower..punct4..
- ctrl2..iso_text))
+ diff(
+ sixlines(
+ ctrl1 .. punct1 .. digits .. punct2 .. punct3 .. lower .. punct4 .. ctrl2 .. iso_text
+ )
+ )
end)
it('is working', function()
source([[
@@ -272,8 +294,19 @@ describe('character classes in regexp', function()
4 s/\%#=0\%4l^\t...//g
5 s/\%#=1\%5l^\t...//g
6 s/\%#=2\%6l^\t...//g]])
- diff(sixlines(string.sub(punct1, 1)..digits..punct2..upper..punct3..
- lower..punct4..ctrl2..iso_text))
+ diff(
+ sixlines(
+ string.sub(punct1, 1)
+ .. digits
+ .. punct2
+ .. upper
+ .. punct3
+ .. lower
+ .. punct4
+ .. ctrl2
+ .. iso_text
+ )
+ )
end)
it('does not convert character class ranges to an incorrect class', function()
source([[
@@ -284,7 +317,9 @@ describe('character classes in regexp', function()
5 s/\%#=1[^0-z]//g
6 s/\%#=2[^0-z]//g
]])
- diff(string.rep(ctrl1..punct1..punct4..ctrl2..iso_text..'\n', 3)
- ..string.rep(digits..punct2..upper..punct3..lower..'\n', 3))
+ diff(
+ string.rep(ctrl1 .. punct1 .. punct4 .. ctrl2 .. iso_text .. '\n', 3)
+ .. string.rep(digits .. punct2 .. upper .. punct3 .. lower .. '\n', 3)
+ )
end)
end)
diff --git a/test/functional/legacy/038_virtual_replace_spec.lua b/test/functional/legacy/038_virtual_replace_spec.lua
index 8dd7bdda6e..2f85e7d5a3 100644
--- a/test/functional/legacy/038_virtual_replace_spec.lua
+++ b/test/functional/legacy/038_virtual_replace_spec.lua
@@ -38,7 +38,9 @@ describe('Virtual replace mode', function()
feed('BCDEFGHIJ<cr>')
feed('<tab>KL<cr>')
feed('MNO<cr>')
- feed('PQR<C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><esc>:$<cr>')
+ feed(
+ 'PQR<C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><C-h><esc>:$<cr>'
+ )
feed('iab<tab>cdefghi<tab>jkl<esc>0gRAB......CDEFGHI.J<esc>o<esc>:<cr>')
feed('iabcdefghijklmnopqrst<esc>0gRAB<tab>IJKLMNO<tab>QR<esc>')
diff --git a/test/functional/legacy/039_visual_block_mode_commands_spec.lua b/test/functional/legacy/039_visual_block_mode_commands_spec.lua
index 135058c579..bc3fea765c 100644
--- a/test/functional/legacy/039_visual_block_mode_commands_spec.lua
+++ b/test/functional/legacy/039_visual_block_mode_commands_spec.lua
@@ -2,13 +2,12 @@
-- And test "U" in Visual mode, also on German sharp S.
local helpers = require('test.functional.helpers')(after_each)
-local nvim, eq = helpers.meths, helpers.eq
+local nvim, eq = helpers.api, helpers.eq
local insert, feed = helpers.insert, helpers.feed
local clear, expect = helpers.clear, helpers.expect
local feed_command = helpers.feed_command
describe('Visual block mode', function()
-
before_each(function()
clear()
@@ -135,7 +134,7 @@ describe('Visual block mode', function()
end)
it('should make a selected part uppercase', function()
- -- GUe must uppercase a whole word, also when ß changes to SS.
+ -- GUe must uppercase a whole word, also when ß changes to ẞ.
feed('Gothe youtußeuu end<ESC>Ypk0wgUe<CR>')
-- GUfx must uppercase until x, inclusive.
feed('O- youßtußexu -<ESC>0fogUfx<CR>')
@@ -151,13 +150,13 @@ describe('Visual block mode', function()
expect([[
- the YOUTUSSEUU end
- - yOUSSTUSSEXu -
- THE YOUTUSSEUU END
- 111THE YOUTUSSEUU END
+ the YOUTUẞEUU end
+ - yOUẞTUẞEXu -
+ THE YOUTUẞEUU END
+ 111THE YOUTUẞEUU END
BLAH DI
DOH DUT
- 222the yoUTUSSEUU END
+ 222the yoUTUẞEUU END
333THE YOUTUßeuu end]])
end)
@@ -205,14 +204,14 @@ describe('Visual block mode', function()
feed('G2l')
feed('2k<C-v>$gj<ESC>')
feed_command([[let cpos=getpos("'>")]])
- local cpos = nvim.get_var('cpos')
+ local cpos = nvim.nvim_get_var('cpos')
local expected = {
col = 4,
- off = 0
+ off = 0,
}
local actual = {
col = cpos[3],
- off = cpos[4]
+ off = cpos[4],
}
eq(expected, actual)
diff --git a/test/functional/legacy/055_list_and_dict_types_spec.lua b/test/functional/legacy/055_list_and_dict_types_spec.lua
index 75294b3786..e8ae60e350 100644
--- a/test/functional/legacy/055_list_and_dict_types_spec.lua
+++ b/test/functional/legacy/055_list_and_dict_types_spec.lua
@@ -547,7 +547,8 @@ describe('list and dictionary types', function()
$put =string(sort(copy(l), 1))
$put =string(sort(copy(l), 'i'))
$put =string(sort(copy(l)))]=])
- expect([=[
+ expect(
+ [=[
['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5]
[1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0']
@@ -559,7 +560,8 @@ describe('list and dictionary types', function()
[-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255]
['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]
['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]
- ['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]]=])
+ ['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]]=]
+ )
end)
it('splitting a string to a list', function()
diff --git a/test/functional/legacy/057_sort_spec.lua b/test/functional/legacy/057_sort_spec.lua
index 328d6f6fa0..9b4746591f 100644
--- a/test/functional/legacy/057_sort_spec.lua
+++ b/test/functional/legacy/057_sort_spec.lua
@@ -2,8 +2,8 @@
local helpers = require('test.functional.helpers')(after_each)
-local insert, command, clear, expect, eq, poke_eventloop = helpers.insert,
- helpers.command, helpers.clear, helpers.expect, helpers.eq, helpers.poke_eventloop
+local insert, command, clear, expect, eq, poke_eventloop =
+ helpers.insert, helpers.command, helpers.clear, helpers.expect, helpers.eq, helpers.poke_eventloop
local exc_exec = helpers.exc_exec
describe(':sort', function()
diff --git a/test/functional/legacy/060_exists_and_has_functions_spec.lua b/test/functional/legacy/060_exists_and_has_functions_spec.lua
index 1794f23b3a..82fece3e84 100644
--- a/test/functional/legacy/060_exists_and_has_functions_spec.lua
+++ b/test/functional/legacy/060_exists_and_has_functions_spec.lua
@@ -9,7 +9,9 @@ describe('exists() and has() functions', function()
setup(function()
clear()
-- Create a temporary script needed for the test.
- write_file('test60.vim', [[
+ write_file(
+ 'test60.vim',
+ [[
" Vim script for exists() function test
" Script-local variables are checked here
@@ -107,7 +109,8 @@ describe('exists() and has() functions', function()
echo "FAILED"
endif
unlet str
- ]])
+ ]]
+ )
end)
teardown(function()
os.remove('test.out')
@@ -115,7 +118,6 @@ describe('exists() and has() functions', function()
end)
it('is working', function()
-
source([=[
" Add the special directory with test scripts to &rtp
set rtp+=test/functional/fixtures
@@ -850,6 +852,5 @@ describe('exists() and has() functions', function()
g:footest#x = 1
footest#F() 0
UndefFun() 0]])
-
end)
end)
diff --git a/test/functional/legacy/063_match_and_matchadd_spec.lua b/test/functional/legacy/063_match_and_matchadd_spec.lua
index 235a826640..0c2b59932b 100644
--- a/test/functional/legacy/063_match_and_matchadd_spec.lua
+++ b/test/functional/legacy/063_match_and_matchadd_spec.lua
@@ -13,35 +13,30 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
local screen = Screen.new(40, 5)
screen:attach()
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue},
- [1] = {background = Screen.colors.Red},
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { background = Screen.colors.Red },
})
- command("highlight MyGroup1 term=bold ctermbg=red guibg=red")
- command("highlight MyGroup2 term=italic ctermbg=green guibg=green")
- command("highlight MyGroup3 term=underline ctermbg=blue guibg=blue")
+ command('highlight MyGroup1 term=bold ctermbg=red guibg=red')
+ command('highlight MyGroup2 term=italic ctermbg=green guibg=green')
+ command('highlight MyGroup3 term=underline ctermbg=blue guibg=blue')
-- Check that "matchaddpos()" positions matches correctly
insert('abcdefghijklmnopq')
command("call matchaddpos('MyGroup1', [[1, 5], [1, 8, 3]], 10, 3)")
screen:expect([[
abcd{1:e}fg{1:hij}klmnop^q |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
|
]])
- command("call clearmatches()")
+ command('call clearmatches()')
command("call setline(1, 'abcdΣabcdef')")
command("call matchaddpos('MyGroup1', [[1, 4, 2], [1, 9, 2]])")
screen:expect([[
abc{1:dΣ}ab{1:cd}e^f |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
|
]])
end)
end)
-
diff --git a/test/functional/legacy/069_multibyte_formatting_spec.lua b/test/functional/legacy/069_multibyte_formatting_spec.lua
index 9c248e3aa8..05e6aa1435 100644
--- a/test/functional/legacy/069_multibyte_formatting_spec.lua
+++ b/test/functional/legacy/069_multibyte_formatting_spec.lua
@@ -4,8 +4,13 @@
-- Also test byteidx() and byteidxcomp()
local helpers = require('test.functional.helpers')(after_each)
-local feed, insert, eq, eval, clear, feed_command, expect = helpers.feed,
- helpers.insert, helpers.eq, helpers.eval, helpers.clear, helpers.feed_command,
+local feed, insert, eq, eval, clear, feed_command, expect =
+ helpers.feed,
+ helpers.insert,
+ helpers.eq,
+ helpers.eval,
+ helpers.clear,
+ helpers.feed_command,
helpers.expect
describe('multibyte text', function()
diff --git a/test/functional/legacy/074_global_var_in_viminfo_spec.lua b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
index 06d8b276d7..0a9ad330c2 100644
--- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua
+++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
@@ -1,10 +1,8 @@
-- Tests for storing global variables in the .shada file
local helpers = require('test.functional.helpers')(after_each)
-local luv = require('luv')
local clear, command, eq, neq, eval, poke_eventloop =
- helpers.clear, helpers.command, helpers.eq, helpers.neq, helpers.eval,
- helpers.poke_eventloop
+ helpers.clear, helpers.command, helpers.eq, helpers.neq, helpers.eval, helpers.poke_eventloop
describe('storing global variables in ShaDa files', function()
local tempname = 'Xtest-functional-legacy-074'
@@ -14,19 +12,115 @@ describe('storing global variables in ShaDa files', function()
end)
it('is working', function()
- clear{args_rm={'-i'}, args={'-i', 'Xviminfo'}}
+ clear { args_rm = { '-i' }, args = { '-i', 'Xviminfo' } }
- local test_dict = {foo = 1, bar = 0, longvarible = 1000}
- local test_list = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
- 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100}
+ local test_dict = { foo = 1, bar = 0, longvarible = 1000 }
+ local test_list = {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31,
+ 32,
+ 33,
+ 34,
+ 35,
+ 36,
+ 37,
+ 38,
+ 39,
+ 40,
+ 41,
+ 42,
+ 43,
+ 44,
+ 45,
+ 46,
+ 47,
+ 48,
+ 49,
+ 50,
+ 51,
+ 52,
+ 53,
+ 54,
+ 55,
+ 56,
+ 57,
+ 58,
+ 59,
+ 60,
+ 61,
+ 62,
+ 63,
+ 64,
+ 65,
+ 66,
+ 67,
+ 68,
+ 69,
+ 70,
+ 71,
+ 72,
+ 73,
+ 74,
+ 75,
+ 76,
+ 77,
+ 78,
+ 79,
+ 80,
+ 81,
+ 82,
+ 83,
+ 84,
+ 85,
+ 86,
+ 87,
+ 88,
+ 89,
+ 90,
+ 91,
+ 92,
+ 93,
+ 94,
+ 95,
+ 96,
+ 97,
+ 98,
+ 99,
+ 100,
+ }
command('set visualbell')
command('set shada+=!')
- command('let MY_GLOBAL_DICT={\'foo\': 1, \'bar\': 0, \'longvarible\': 1000}')
+ command("let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}")
-- Store a really long list. Initially this was testing line wrapping in
-- viminfo, but shada files has no line wrapping, no matter how long the
-- list is.
@@ -39,7 +133,7 @@ describe('storing global variables in ShaDa files', function()
poke_eventloop()
-- Assert that the shada file exists.
- neq(nil, luv.fs_stat(tempname))
+ neq(nil, vim.uv.fs_stat(tempname))
command('unlet MY_GLOBAL_DICT')
command('unlet MY_GLOBAL_LIST')
-- Assert that the variables where deleted.
diff --git a/test/functional/legacy/078_swapfile_recover_spec.lua b/test/functional/legacy/078_swapfile_recover_spec.lua
index 45f0aed37a..dc5b1a8540 100644
--- a/test/functional/legacy/078_swapfile_recover_spec.lua
+++ b/test/functional/legacy/078_swapfile_recover_spec.lua
@@ -9,8 +9,8 @@ local clear, expect, source = helpers.clear, helpers.expect, helpers.source
describe('78', function()
setup(clear)
teardown(function()
- os.remove(".Xtest.swp")
- os.remove(".Xtest.swo")
+ os.remove('.Xtest.swp')
+ os.remove('.Xtest.swo')
end)
it('is working', function()
diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
index 54620c7104..5e9c131c64 100644
--- a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
+++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
@@ -1,11 +1,11 @@
-- Tests for tag search with !_TAG_FILE_ENCODING.
local helpers = require('test.functional.helpers')(after_each)
-local insert, source, clear, expect, write_file = helpers.insert,
- helpers.source, helpers.clear, helpers.expect, helpers.write_file
+local insert, source, clear, expect, write_file =
+ helpers.insert, helpers.source, helpers.clear, helpers.expect, helpers.write_file
local function has_iconv()
- clear() -- ensures session
+ clear() -- ensures session
return 1 == helpers.eval('has("iconv")')
end
@@ -18,14 +18,17 @@ describe('tag search with !_TAG_FILE_ENCODING', function()
write_file('Xtags1.txt', 'text for tags1\nabcdefghijklmnopqrs\n')
write_file('Xtags2.txt', 'text for tags2\nABC\n')
write_file('Xtags3.txt', 'text for tags3\nABC\n')
- write_file('Xtags1', [[
+ write_file(
+ 'Xtags1',
+ [[
!_TAG_FILE_ENCODING utf-8 //
abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs
- ]])
- write_file('test83-tags2',
- '!_TAG_FILE_ENCODING cp932 //\n' ..
- '\130`\130a\130b Xtags2.txt /\130`\130a\130b\n'
- )
+ ]]
+ )
+ write_file(
+ 'test83-tags2',
+ '!_TAG_FILE_ENCODING cp932 //\n' .. '\130`\130a\130b Xtags2.txt /\130`\130a\130b\n'
+ )
-- The last file is very long but repetitive and can be generated on the
-- fly.
local text = helpers.dedent([[
@@ -51,7 +54,6 @@ describe('tag search with !_TAG_FILE_ENCODING', function()
pending('skipped (missing iconv)', function() end)
else
it('is working', function()
-
insert('Results of test83')
-- Case1:
diff --git a/test/functional/legacy/090_sha256_spec.lua b/test/functional/legacy/090_sha256_spec.lua
index e364af9400..701b777df1 100644
--- a/test/functional/legacy/090_sha256_spec.lua
+++ b/test/functional/legacy/090_sha256_spec.lua
@@ -8,7 +8,7 @@ describe('sha256()', function()
setup(clear)
it('is working', function()
- insert("start:")
+ insert('start:')
source([[
let testcase='test for empty string: '
diff --git a/test/functional/legacy/091_context_variables_spec.lua b/test/functional/legacy/091_context_variables_spec.lua
index c08a58e14b..3b9fdf740f 100644
--- a/test/functional/legacy/091_context_variables_spec.lua
+++ b/test/functional/legacy/091_context_variables_spec.lua
@@ -8,7 +8,7 @@ describe('context variables', function()
setup(clear)
it('is working', function()
- insert("start:")
+ insert('start:')
-- Test for getbufvar().
-- Use strings to test for memory leaks.
diff --git a/test/functional/legacy/096_location_list_spec.lua b/test/functional/legacy/096_location_list_spec.lua
index b21a2085f6..2817d5d240 100644
--- a/test/functional/legacy/096_location_list_spec.lua
+++ b/test/functional/legacy/096_location_list_spec.lua
@@ -45,20 +45,18 @@ describe('location list', function()
setl readonly
exe 'doautocmd BufRead ' . substitute(a:name, '\v^test://(.*)', '\1', '')
endfunction
- ]] ..
-
- -- Register the above buffer setup function to be executed before
- -- starting to edit a new "test protocol" buffer.
- [[
+ ]]
+ -- Register the above buffer setup function to be executed before
+ -- starting to edit a new "test protocol" buffer.
+ .. [[
augroup testgroup
au!
autocmd BufReadCmd test://* call ReadTestProtocol(expand("<amatch>"))
augroup END
- ]] ..
-
- -- Populate the location list of the current window with some test
- -- protocol file locations such as "test://foo.txt".
- [[
+ ]]
+ -- Populate the location list of the current window with some test
+ -- protocol file locations such as "test://foo.txt".
+ .. [[
let words = [ "foo", "bar", "baz", "quux", "shmoo", "spam", "eggs" ]
let qflist = []
for word in words
@@ -68,11 +66,12 @@ describe('location list', function()
" valid.
call setloclist(0, qflist, ' ')
endfor
- ]])
+ ]]
+ )
-- Set up the result buffer.
command('enew')
- command('w! '..test_file)
+ command('w! ' .. test_file)
command('b 1')
-- Test A.
@@ -99,14 +98,16 @@ describe('location list', function()
command([[let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')]])
command('wincmd n')
command('wincmd K')
- command('b '..test_file)
+ command('b ' .. test_file)
-- Prepare test output and write it to the result buffer.
command([[let fileName = substitute(fileName, '\\', '/', 'g')]])
command([[let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')]])
command([[call append(line('$'), "Test A:")]])
command([[call append(line('$'), " - file name displayed: " . fileName)]])
- command([[call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName)]])
+ command(
+ [[call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName)]]
+ )
command('w')
-- Clean slate for the next test.
@@ -132,7 +133,7 @@ describe('location list', function()
command('let numberOfWindowsOpen = winnr("$")')
command('wincmd n')
command('wincmd K')
- command('b '..test_file)
+ command('b ' .. test_file)
-- Prepare test output and write it to the result buffer.
command('call append(line("$"), "Test B:")')
@@ -170,12 +171,14 @@ describe('location list', function()
command('let bufferName = expand("%")')
command('wincmd n')
command('wincmd K')
- command('b '..test_file)
+ command('b ' .. test_file)
-- Prepare test output and write it to the result buffer.
command([[let bufferName = substitute(bufferName, '\\', '/', 'g')]])
command([[call append(line("$"), "Test C:")]])
- command([[call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType)]])
+ command(
+ [[call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType)]]
+ )
command([[call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName)]])
command('w')
command('wincmd o')
diff --git a/test/functional/legacy/097_glob_path_spec.lua b/test/functional/legacy/097_glob_path_spec.lua
index a62dc4d4c8..b335b3bf41 100644
--- a/test/functional/legacy/097_glob_path_spec.lua
+++ b/test/functional/legacy/097_glob_path_spec.lua
@@ -11,13 +11,13 @@ describe('glob() and globpath()', function()
setup(function()
if helpers.is_os('win') then
- os.execute("md sautest\\autoload")
- os.execute(".>sautest\\autoload\\Test104.vim 2>nul")
- os.execute(".>sautest\\autoload\\footest.vim 2>nul")
+ os.execute('md sautest\\autoload')
+ os.execute('.>sautest\\autoload\\Test104.vim 2>nul')
+ os.execute('.>sautest\\autoload\\footest.vim 2>nul')
else
- os.execute("mkdir -p sautest/autoload")
- os.execute("touch sautest/autoload/Test104.vim")
- os.execute("touch sautest/autoload/footest.vim")
+ os.execute('mkdir -p sautest/autoload')
+ os.execute('touch sautest/autoload/Test104.vim')
+ os.execute('touch sautest/autoload/footest.vim')
end
end)
@@ -76,7 +76,7 @@ describe('glob() and globpath()', function()
os.execute('del /q/f Xxx{ Xxx$')
os.execute('rd /q /s sautest')
else
- os.execute("rm -rf sautest Xxx{ Xxx$")
+ os.execute('rm -rf sautest Xxx{ Xxx$')
end
end)
end)
diff --git a/test/functional/legacy/102_fnameescape_spec.lua b/test/functional/legacy/102_fnameescape_spec.lua
index c8ee423ff3..11bdbd7c9c 100644
--- a/test/functional/legacy/102_fnameescape_spec.lua
+++ b/test/functional/legacy/102_fnameescape_spec.lua
@@ -20,7 +20,7 @@ describe('fnameescape', function()
end)
teardown(function()
- os.remove("Xspa ce")
- os.remove("Xemark!")
+ os.remove('Xspa ce')
+ os.remove('Xemark!')
end)
end)
diff --git a/test/functional/legacy/106_errorformat_spec.lua b/test/functional/legacy/106_errorformat_spec.lua
index 3f017a704f..2a83d48c07 100644
--- a/test/functional/legacy/106_errorformat_spec.lua
+++ b/test/functional/legacy/106_errorformat_spec.lua
@@ -8,7 +8,7 @@ describe('errorformat', function()
setup(clear)
it('is working', function()
- command("set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%#")
+ command('set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%#')
command("cgetexpr ['WWWW', 'EEEE', 'CCCC']")
command("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
command("cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC']")
diff --git a/test/functional/legacy/107_adjust_window_and_contents_spec.lua b/test/functional/legacy/107_adjust_window_and_contents_spec.lua
index 841eeef0af..5a8fdda32d 100644
--- a/test/functional/legacy/107_adjust_window_and_contents_spec.lua
+++ b/test/functional/legacy/107_adjust_window_and_contents_spec.lua
@@ -50,15 +50,7 @@ describe('107', function()
[1, '1 '] |
[50, '50 '] |
^[59, '59 '] |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*9
3 more lines |
]])
end)
diff --git a/test/functional/legacy/108_backtrace_debug_commands_spec.lua b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
index 1c1a2095d5..ccdd0cd2be 100644
--- a/test/functional/legacy/108_backtrace_debug_commands_spec.lua
+++ b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
@@ -9,7 +9,7 @@ describe('108', function()
before_each(clear)
it('is working', function()
- command("set shortmess-=F")
+ command('set shortmess-=F')
feed_command('lang mess C')
feed_command('function! Foo()')
feed_command(' let var1 = 1')
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua
index a15809907b..3e78d7ca5f 100644
--- a/test/functional/legacy/arglist_spec.lua
+++ b/test/functional/legacy/arglist_spec.lua
@@ -33,10 +33,7 @@ describe('argument list commands', function()
feed('N')
screen:expect([[
^ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
feed(':confirm quit\n')
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua
index d49d7d665a..04c90281a7 100644
--- a/test/functional/legacy/assert_spec.lua
+++ b/test/functional/legacy/assert_spec.lua
@@ -1,20 +1,19 @@
local helpers = require('test.functional.helpers')(after_each)
-local nvim, call = helpers.meths, helpers.call
+local nvim, call = helpers.api, helpers.call
local clear, eq = helpers.clear, helpers.eq
local source, command = helpers.source, helpers.command
local exc_exec = helpers.exc_exec
local eval = helpers.eval
local function expected_errors(errors)
- eq(errors, nvim.get_vvar('errors'))
+ eq(errors, nvim.nvim_get_vvar('errors'))
end
local function expected_empty()
- eq({}, nvim.get_vvar('errors'))
+ eq({}, nvim.nvim_get_vvar('errors'))
end
describe('assert function:', function()
-
before_each(function()
clear()
end)
@@ -39,24 +38,24 @@ describe('assert function:', function()
end)
it('should change v:errors when expected is not equal to actual', function()
- eq(1, call('assert_equal', 0, {0}))
- expected_errors({'Expected 0 but got [0]'})
+ eq(1, call('assert_equal', 0, { 0 }))
+ expected_errors({ 'Expected 0 but got [0]' })
end)
it('should change v:errors when expected is not equal to actual', function()
- eq(1, call('assert_equal', 0, "0"))
- expected_errors({"Expected 0 but got '0'"})
+ eq(1, call('assert_equal', 0, '0'))
+ expected_errors({ "Expected 0 but got '0'" })
end)
it('should change v:errors when expected is not equal to actual', function()
-- Lua does not tell integer from float.
command('call assert_equal(1, 1.0)')
- expected_errors({'Expected 1 but got 1.0'})
+ expected_errors({ 'Expected 1 but got 1.0' })
end)
it('should change v:errors when expected is not equal to actual', function()
call('assert_equal', 'true', 'false')
- expected_errors({"Expected 'true' but got 'false'"})
+ expected_errors({ "Expected 'true' but got 'false'" })
end)
it('should change v:errors when expected is not equal to actual', function()
@@ -69,8 +68,10 @@ describe('assert function:', function()
call assert_equal(s:w, '')
endfunction
]])
- eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
- exc_exec('call CheckAssert()'))
+ eq(
+ 'Vim(call):E724: unable to correctly dump variable with self-referencing container',
+ exc_exec('call CheckAssert()')
+ )
end)
end)
@@ -84,12 +85,12 @@ describe('assert function:', function()
it('should change v:errors when actual is not false', function()
eq(1, call('assert_false', 1))
- expected_errors({'Expected False but got 1'})
+ expected_errors({ 'Expected False but got 1' })
end)
it('should change v:errors when actual is not false', function()
call('assert_false', {})
- expected_errors({'Expected False but got []'})
+ expected_errors({ 'Expected False but got []' })
end)
end)
@@ -97,14 +98,14 @@ describe('assert function:', function()
describe('assert_true', function()
it('should not change v:errors when actual is true', function()
eq(0, call('assert_true', 1))
- eq(0, call('assert_true', -1)) -- In Vim script, non-zero Numbers are TRUE.
+ eq(0, call('assert_true', -1)) -- In Vim script, non-zero Numbers are TRUE.
eq(0, call('assert_true', true))
expected_empty()
end)
it('should change v:errors when actual is not true', function()
eq(1, call('assert_true', 1.5))
- expected_errors({'Expected True but got 1.5'})
+ expected_errors({ 'Expected True but got 1.5' })
end)
end)
@@ -145,7 +146,7 @@ describe('assert function:', function()
call assert_true('', 'file two')
]])
expected_errors({
- "nvim_exec2(): equal assertion failed: Expected 1 but got 100",
+ 'nvim_exec2(): equal assertion failed: Expected 1 but got 100',
"nvim_exec2(): true assertion failed: Expected False but got 'true'",
"nvim_exec2(): false assertion failed: Expected True but got 'false'",
"nvim_exec2(): file two: Expected True but got ''",
@@ -162,7 +163,7 @@ describe('assert function:', function()
it('should change v:errors when cmd succeeds', function()
eq(1, eval([[assert_fails('call empty("")', '')]]))
- expected_errors({'command did not fail: call empty("")'})
+ expected_errors({ 'command did not fail: call empty("")' })
end)
end)
end)
diff --git a/test/functional/legacy/autochdir_spec.lua b/test/functional/legacy/autochdir_spec.lua
index 5da54b4850..e5980f5942 100644
--- a/test/functional/legacy/autochdir_spec.lua
+++ b/test/functional/legacy/autochdir_spec.lua
@@ -1,11 +1,11 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, eq, matches = helpers.clear, helpers.eq, helpers.matches
-local eval, command, call, meths = helpers.eval, helpers.command, helpers.call, helpers.meths
+local eval, command, call, api = helpers.eval, helpers.command, helpers.call, helpers.api
local source, exec_capture = helpers.source, helpers.exec_capture
local mkdir = helpers.mkdir
local function expected_empty()
- eq({}, meths.get_vvar('errors'))
+ eq({}, api.nvim_get_vvar('errors'))
end
describe('autochdir behavior', function()
@@ -25,13 +25,13 @@ describe('autochdir behavior', function()
it('sets filename', function()
command('set acd')
command('new')
- command('w '..dir..'/Xtest')
+ command('w ' .. dir .. '/Xtest')
eq('Xtest', eval("expand('%')"))
eq(dir, eval([[substitute(getcwd(), '.*/\(\k*\)', '\1', '')]]))
end)
it(':file in win_execute() does not cause wrong directory', function()
- command('cd '..dir)
+ command('cd ' .. dir)
source([[
func Test_set_filename_other_window()
let cwd = getcwd()
@@ -64,53 +64,53 @@ describe('autochdir behavior', function()
it('win_execute() does not change directory', function()
local subdir = 'Xfile'
- command('cd '..dir)
+ command('cd ' .. dir)
command('set acd')
call('mkdir', subdir)
local winid = eval('win_getid()')
- command('new '..subdir..'/file')
- matches(dir..'/'..subdir..'$', eval('getcwd()'))
+ command('new ' .. subdir .. '/file')
+ matches(dir .. '/' .. subdir .. '$', eval('getcwd()'))
command('cd ..')
- matches(dir..'$', eval('getcwd()'))
+ matches(dir .. '$', eval('getcwd()'))
call('win_execute', winid, 'echo')
- matches(dir..'$', eval('getcwd()'))
+ matches(dir .. '$', eval('getcwd()'))
end)
it(':verbose pwd shows whether autochdir is used', function()
local subdir = 'Xautodir'
- command('cd '..dir)
+ command('cd ' .. dir)
local cwd = eval('getcwd()')
command('edit global.txt')
- matches('%[global%].*'..dir..'$', exec_capture('verbose pwd'))
+ matches('%[global%].*' .. dir .. '$', exec_capture('verbose pwd'))
call('mkdir', subdir)
- command('split '..subdir..'/local.txt')
- command('lcd '..subdir)
- matches('%[window%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd'))
+ command('split ' .. subdir .. '/local.txt')
+ command('lcd ' .. subdir)
+ matches('%[window%].*' .. dir .. '/' .. subdir .. '$', exec_capture('verbose pwd'))
command('set acd')
command('wincmd w')
- matches('%[autochdir%].*'..dir..'$', exec_capture('verbose pwd'))
- command('tcd '..cwd)
- matches('%[tabpage%].*'..dir..'$', exec_capture('verbose pwd'))
- command('cd '..cwd)
- matches('%[global%].*'..dir..'$', exec_capture('verbose pwd'))
- command('lcd '..cwd)
- matches('%[window%].*'..dir..'$', exec_capture('verbose pwd'))
+ matches('%[autochdir%].*' .. dir .. '$', exec_capture('verbose pwd'))
+ command('tcd ' .. cwd)
+ matches('%[tabpage%].*' .. dir .. '$', exec_capture('verbose pwd'))
+ command('cd ' .. cwd)
+ matches('%[global%].*' .. dir .. '$', exec_capture('verbose pwd'))
+ command('lcd ' .. cwd)
+ matches('%[window%].*' .. dir .. '$', exec_capture('verbose pwd'))
command('edit')
- matches('%[autochdir%].*'..dir..'$', exec_capture('verbose pwd'))
+ matches('%[autochdir%].*' .. dir .. '$', exec_capture('verbose pwd'))
command('enew')
command('wincmd w')
- matches('%[autochdir%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd'))
+ matches('%[autochdir%].*' .. dir .. '/' .. subdir .. '$', exec_capture('verbose pwd'))
command('wincmd w')
- matches('%[window%].*'..dir..'$', exec_capture('verbose pwd'))
+ matches('%[window%].*' .. dir .. '$', exec_capture('verbose pwd'))
command('wincmd w')
- matches('%[autochdir%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd'))
+ matches('%[autochdir%].*' .. dir .. '/' .. subdir .. '$', exec_capture('verbose pwd'))
command('set noacd')
- matches('%[autochdir%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd'))
+ matches('%[autochdir%].*' .. dir .. '/' .. subdir .. '$', exec_capture('verbose pwd'))
command('wincmd w')
- matches('%[window%].*'..dir..'$', exec_capture('verbose pwd'))
- command('cd '..cwd)
- matches('%[global%].*'..dir..'$', exec_capture('verbose pwd'))
+ matches('%[window%].*' .. dir .. '$', exec_capture('verbose pwd'))
+ command('cd ' .. cwd)
+ matches('%[global%].*' .. dir .. '$', exec_capture('verbose pwd'))
command('wincmd w')
- matches('%[window%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd'))
+ matches('%[window%].*' .. dir .. '/' .. subdir .. '$', exec_capture('verbose pwd'))
end)
end)
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index 6034d13e2a..9966df263b 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -1,8 +1,9 @@
local helpers = require('test.functional.helpers')(after_each)
-local nvim = helpers.meths
+local nvim = helpers.api
local clear, eq, neq, eval = helpers.clear, helpers.eq, helpers.neq, helpers.eval
-local curbuf, buf = helpers.curbuf, helpers.bufmeths
-local curwin = helpers.curwin
+local api = helpers.api
+local curbuf = helpers.api.nvim_get_current_buf
+local curwin = helpers.api.nvim_get_current_win
local exec_capture = helpers.exec_capture
local source, command = helpers.source, helpers.command
@@ -29,9 +30,7 @@ end
local function set_hook(pattern)
command(
- 'au OptionSet '
- .. pattern ..
- ' :call AutoCommand(expand("<amatch>"), bufnr("%"), winnr())'
+ 'au OptionSet ' .. pattern .. ' :call AutoCommand(expand("<amatch>"), bufnr("%"), winnr())'
)
end
@@ -40,26 +39,26 @@ local function init_var()
end
local function get_result()
- local ret = nvim.get_var('ret')
+ local ret = nvim.nvim_get_var('ret')
init_var()
return ret
end
local function expected_table(option, oldval, oldval_l, oldval_g, newval, scope, cmd, attr)
return {
- option = option,
- oldval = oldval,
+ option = option,
+ oldval = oldval,
oldval_l = oldval_l,
oldval_g = oldval_g,
- newval = newval,
- scope = scope,
- cmd = cmd,
- attr = attr,
+ newval = newval,
+ scope = scope,
+ cmd = cmd,
+ attr = attr,
}
end
local function expected_combination(...)
- local args = {...}
+ local args = { ... }
local ret = get_result()
if not (#args == #ret) then
@@ -119,7 +118,6 @@ end
describe('au OptionSet', function()
describe('with any option (*)', function()
-
before_each(function()
clear()
declare_hook_function()
@@ -129,44 +127,44 @@ describe('au OptionSet', function()
it('should be called in setting number option', function()
command('set nu')
- expected_combination({'number', false, false, false, true, 'global', 'set'})
+ expected_combination({ 'number', false, false, false, true, 'global', 'set' })
command('setlocal nonu')
- expected_combination({'number', true, true, '', false, 'local', 'setlocal'})
+ expected_combination({ 'number', true, true, '', false, 'local', 'setlocal' })
command('setglobal nonu')
- expected_combination({'number', true, '', true, false, 'global', 'setglobal'})
+ expected_combination({ 'number', true, '', true, false, 'global', 'setglobal' })
end)
- it('should be called in setting autoindent option',function()
+ it('should be called in setting autoindent option', function()
command('setlocal ai')
- expected_combination({'autoindent', false, false, '', true, 'local', 'setlocal'})
+ expected_combination({ 'autoindent', false, false, '', true, 'local', 'setlocal' })
command('setglobal ai')
- expected_combination({'autoindent', false, '', false, true, 'global', 'setglobal'})
+ expected_combination({ 'autoindent', false, '', false, true, 'global', 'setglobal' })
command('set noai')
- expected_combination({'autoindent', true, true, true, false, 'global', 'set'})
+ expected_combination({ 'autoindent', true, true, true, false, 'global', 'set' })
end)
- it('should be called in inverting global autoindent option',function()
+ it('should be called in inverting global autoindent option', function()
command('set ai!')
- expected_combination({'autoindent', false, false, false, true, 'global', 'set'})
+ expected_combination({ 'autoindent', false, false, false, true, 'global', 'set' })
end)
- it('should be called in being unset local autoindent option',function()
+ it('should be called in being unset local autoindent option', function()
command('setlocal ai')
- expected_combination({'autoindent', false, false, '', true, 'local', 'setlocal'})
+ expected_combination({ 'autoindent', false, false, '', true, 'local', 'setlocal' })
command('setlocal ai<')
- expected_combination({'autoindent', true, true, '', false, 'local', 'setlocal'})
+ expected_combination({ 'autoindent', true, true, '', false, 'local', 'setlocal' })
end)
- it('should be called in setting global list and number option at the same time',function()
+ it('should be called in setting global list and number option at the same time', function()
command('set list nu')
expected_combination(
- {'list', false, false, false, true, 'global', 'set'},
- {'number', false, false, false, true, 'global', 'set'}
+ { 'list', false, false, false, true, 'global', 'set' },
+ { 'number', false, false, false, true, 'global', 'set' }
)
end)
@@ -177,27 +175,27 @@ describe('au OptionSet', function()
it('should be called in setting local acd', function()
command('setlocal acd')
- expected_combination({'autochdir', false, false, '', true, 'local', 'setlocal'})
+ expected_combination({ 'autochdir', false, false, '', true, 'local', 'setlocal' })
end)
it('should be called in setting autoread', function()
command('set noar')
- expected_combination({'autoread', true, true, true, false, 'global', 'set'})
+ expected_combination({ 'autoread', true, true, true, false, 'global', 'set' })
command('setlocal ar')
- expected_combination({'autoread', false, false, '', true, 'local', 'setlocal'})
+ expected_combination({ 'autoread', false, false, '', true, 'local', 'setlocal' })
end)
it('should be called in inverting global autoread', function()
command('setglobal invar')
- expected_combination({'autoread', true, '', true, false, 'global', 'setglobal'})
+ expected_combination({ 'autoread', true, '', true, false, 'global', 'setglobal' })
end)
it('should be called in setting backspace option through :let', function()
local oldval = eval('&backspace')
command('let &bs=""')
- expected_combination({'backspace', oldval, oldval, oldval, '', 'global', 'set'})
+ expected_combination({ 'backspace', oldval, oldval, oldval, '', 'global', 'set' })
end)
describe('being set by setbufvar()', function()
@@ -208,15 +206,24 @@ describe('au OptionSet', function()
it('should trigger using correct option name', function()
command('call setbufvar(1, "&backup", 1)')
- expected_combination({'backup', false, false, '', true, 'local', 'setlocal'})
+ expected_combination({ 'backup', false, false, '', true, 'local', 'setlocal' })
end)
it('should trigger if the current buffer is different from the targeted buffer', function()
local new_buffer = make_buffer()
- local new_bufnr = buf.get_number(new_buffer)
+ local new_bufnr = api.nvim_buf_get_number(new_buffer)
command('call setbufvar(' .. new_bufnr .. ', "&buftype", "nofile")')
- expected_combination({'buftype', '', '', '', 'nofile', 'local', 'setlocal', {bufnr = new_bufnr}})
+ expected_combination({
+ 'buftype',
+ '',
+ '',
+ '',
+ 'nofile',
+ 'local',
+ 'setlocal',
+ { bufnr = new_bufnr },
+ })
end)
end)
@@ -224,24 +231,30 @@ describe('au OptionSet', function()
local oldval = eval('&backupext')
command('set backupext=foo')
- expected_combination({'backupext', oldval, oldval, oldval, 'foo', 'global', 'set'})
+ expected_combination({ 'backupext', oldval, oldval, oldval, 'foo', 'global', 'set' })
command('set backupext&')
- expected_combination({'backupext', 'foo', 'foo', 'foo', oldval, 'global', 'set'})
+ expected_combination({ 'backupext', 'foo', 'foo', 'foo', oldval, 'global', 'set' })
command('setglobal backupext=bar')
- expected_combination({'backupext', oldval, '', oldval, 'bar', 'global', 'setglobal'})
+ expected_combination({ 'backupext', oldval, '', oldval, 'bar', 'global', 'setglobal' })
command('noa set backupext&')
-- As this is a global option this sets the global value even though :setlocal is used!
command('setlocal backupext=baz')
- expected_combination({'backupext', oldval, oldval, '', 'baz', 'local', 'setlocal'})
+ expected_combination({ 'backupext', oldval, oldval, '', 'baz', 'local', 'setlocal' })
command('noa setglobal backupext=ext_global')
command('noa setlocal backupext=ext_local') -- Sets the global(!) value
command('set backupext=foo')
expected_combination({
- 'backupext', 'ext_local', 'ext_local', 'ext_local', 'foo', 'global', 'set'
+ 'backupext',
+ 'ext_local',
+ 'ext_local',
+ 'ext_local',
+ 'foo',
+ 'global',
+ 'set',
})
end)
@@ -249,16 +262,16 @@ describe('au OptionSet', function()
local oldval = eval('&tags')
command('set tags=tagpath')
- expected_combination({'tags', oldval, oldval, oldval, 'tagpath', 'global', 'set'})
+ expected_combination({ 'tags', oldval, oldval, oldval, 'tagpath', 'global', 'set' })
command('set tags&')
- expected_combination({'tags', 'tagpath', 'tagpath', 'tagpath', oldval, 'global', 'set'})
+ expected_combination({ 'tags', 'tagpath', 'tagpath', 'tagpath', oldval, 'global', 'set' })
command('setglobal tags=tagpath1')
- expected_combination({'tags', oldval, '', oldval, 'tagpath1', 'global', 'setglobal'})
+ expected_combination({ 'tags', oldval, '', oldval, 'tagpath1', 'global', 'setglobal' })
command('setlocal tags=tagpath2')
- expected_combination({'tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal'})
+ expected_combination({ 'tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
@@ -266,7 +279,13 @@ describe('au OptionSet', function()
command('noa setlocal tags=tag_local')
command('set tags=tagpath')
expected_combination({
- 'tags', 'tag_global', 'tag_local', 'tag_global', 'tagpath', 'global', 'set'
+ 'tags',
+ 'tag_global',
+ 'tag_local',
+ 'tag_global',
+ 'tagpath',
+ 'global',
+ 'set',
})
-- Note: v:option_old is the old global value for global-local options.
@@ -274,26 +293,48 @@ describe('au OptionSet', function()
command('noa set tags=tag_global')
command('noa setlocal tags=')
command('set tags=tagpath')
- expected_combination({'tags', 'tag_global', 'tag_global', 'tag_global', 'tagpath', 'global', 'set'})
+ expected_combination({
+ 'tags',
+ 'tag_global',
+ 'tag_global',
+ 'tag_global',
+ 'tagpath',
+ 'global',
+ 'set',
+ })
end)
it('with string local (to buffer) option', function()
local oldval = eval('&spelllang')
command('set spelllang=elvish,klingon')
- expected_combination({'spelllang', oldval, oldval, oldval, 'elvish,klingon', 'global', 'set'})
+ expected_combination({
+ 'spelllang',
+ oldval,
+ oldval,
+ oldval,
+ 'elvish,klingon',
+ 'global',
+ 'set',
+ })
command('set spelllang&')
expected_combination({
- 'spelllang', 'elvish,klingon', 'elvish,klingon', 'elvish,klingon', oldval, 'global', 'set'
+ 'spelllang',
+ 'elvish,klingon',
+ 'elvish,klingon',
+ 'elvish,klingon',
+ oldval,
+ 'global',
+ 'set',
})
command('setglobal spelllang=elvish')
- expected_combination({'spelllang', oldval, '', oldval, 'elvish', 'global', 'setglobal'})
+ expected_combination({ 'spelllang', oldval, '', oldval, 'elvish', 'global', 'setglobal' })
command('noa set spelllang&')
command('setlocal spelllang=klingon')
- expected_combination({'spelllang', oldval, oldval, '', 'klingon', 'local', 'setlocal'})
+ expected_combination({ 'spelllang', oldval, oldval, '', 'klingon', 'local', 'setlocal' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
@@ -301,7 +342,13 @@ describe('au OptionSet', function()
command('noa setlocal spelllang=spelllocal')
command('set spelllang=foo')
expected_combination({
- 'spelllang', 'spelllocal', 'spelllocal', 'spellglobal', 'foo', 'global', 'set'
+ 'spelllang',
+ 'spelllocal',
+ 'spelllocal',
+ 'spellglobal',
+ 'foo',
+ 'global',
+ 'set',
})
end)
@@ -309,259 +356,257 @@ describe('au OptionSet', function()
local oldval = eval('&statusline')
command('set statusline=foo')
- expected_combination({'statusline', oldval, oldval, '', 'foo', 'global', 'set'})
+ expected_combination({ 'statusline', oldval, oldval, '', 'foo', 'global', 'set' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('set statusline&')
- expected_combination({'statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set'})
+ expected_combination({ 'statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set' })
command('setglobal statusline=bar')
- expected_combination({'statusline', oldval, '', oldval, 'bar', 'global', 'setglobal'})
+ expected_combination({ 'statusline', oldval, '', oldval, 'bar', 'global', 'setglobal' })
command('noa set statusline&')
command('setlocal statusline=baz')
- expected_combination({'statusline', oldval, oldval, '', 'baz', 'local', 'setlocal'})
+ expected_combination({ 'statusline', oldval, oldval, '', 'baz', 'local', 'setlocal' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal statusline=bar')
command('noa setlocal statusline=baz')
command('set statusline=foo')
- expected_combination({'statusline', 'bar', 'baz', 'bar', 'foo', 'global', 'set'})
+ expected_combination({ 'statusline', 'bar', 'baz', 'bar', 'foo', 'global', 'set' })
end)
it('with string local (to window) option', function()
local oldval = eval('&foldignore')
command('set foldignore=fo')
- expected_combination({'foldignore', oldval, oldval, oldval, 'fo', 'global', 'set'})
+ expected_combination({ 'foldignore', oldval, oldval, oldval, 'fo', 'global', 'set' })
command('set foldignore&')
- expected_combination({'foldignore', 'fo', 'fo', 'fo', oldval, 'global', 'set'})
+ expected_combination({ 'foldignore', 'fo', 'fo', 'fo', oldval, 'global', 'set' })
command('setglobal foldignore=bar')
- expected_combination({'foldignore', oldval, '', oldval, 'bar', 'global', 'setglobal'})
+ expected_combination({ 'foldignore', oldval, '', oldval, 'bar', 'global', 'setglobal' })
command('noa set foldignore&')
command('setlocal foldignore=baz')
- expected_combination({'foldignore', oldval, oldval, '', 'baz', 'local', 'setlocal'})
+ expected_combination({ 'foldignore', oldval, oldval, '', 'baz', 'local', 'setlocal' })
command('noa setglobal foldignore=glob')
command('noa setlocal foldignore=loc')
command('set foldignore=fo')
- expected_combination({'foldignore', 'loc', 'loc', 'glob', 'fo', 'global', 'set'})
+ expected_combination({ 'foldignore', 'loc', 'loc', 'glob', 'fo', 'global', 'set' })
end)
it('with number global option', function()
command('noa setglobal cmdheight=8')
command('noa setlocal cmdheight=1') -- Sets the global(!) value
command('setglobal cmdheight=2')
- expected_combination({'cmdheight', 1, '', 1, 2, 'global', 'setglobal'})
+ expected_combination({ 'cmdheight', 1, '', 1, 2, 'global', 'setglobal' })
command('noa setglobal cmdheight=8')
command('noa setlocal cmdheight=1') -- Sets the global(!) value
command('setlocal cmdheight=2')
- expected_combination({'cmdheight', 1, 1, '', 2, 'local', 'setlocal'})
+ expected_combination({ 'cmdheight', 1, 1, '', 2, 'local', 'setlocal' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal cmdheight=8')
command('noa setlocal cmdheight=1') -- Sets the global(!) value
command('set cmdheight=2')
- expected_combination({'cmdheight', 1, 1, 1, 2, 'global', 'set'})
+ expected_combination({ 'cmdheight', 1, 1, 1, 2, 'global', 'set' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa set cmdheight=8')
command('set cmdheight=2')
- expected_combination({'cmdheight', 8, 8, 8, 2, 'global', 'set'})
+ expected_combination({ 'cmdheight', 8, 8, 8, 2, 'global', 'set' })
end)
it('with number global-local (to buffer) option', function()
command('noa setglobal undolevels=8')
command('noa setlocal undolevels=1')
command('setglobal undolevels=2')
- expected_combination({'undolevels', 8, '', 8, 2, 'global', 'setglobal'})
+ expected_combination({ 'undolevels', 8, '', 8, 2, 'global', 'setglobal' })
command('noa setglobal undolevels=8')
command('noa setlocal undolevels=1')
command('setlocal undolevels=2')
- expected_combination({'undolevels', 1, 1, '', 2, 'local', 'setlocal'})
+ expected_combination({ 'undolevels', 1, 1, '', 2, 'local', 'setlocal' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal undolevels=8')
command('noa setlocal undolevels=1')
command('set undolevels=2')
- expected_combination({'undolevels', 8, 1, 8, 2, 'global', 'set'})
+ expected_combination({ 'undolevels', 8, 1, 8, 2, 'global', 'set' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa set undolevels=8')
command('set undolevels=2')
- expected_combination({'undolevels', 8, 8, 8, 2, 'global', 'set'})
+ expected_combination({ 'undolevels', 8, 8, 8, 2, 'global', 'set' })
end)
it('with number local (to buffer) option', function()
command('noa setglobal wrapmargin=8')
command('noa setlocal wrapmargin=1')
command('setglobal wrapmargin=2')
- expected_combination({'wrapmargin', 8, '', 8, 2, 'global', 'setglobal'})
+ expected_combination({ 'wrapmargin', 8, '', 8, 2, 'global', 'setglobal' })
command('noa setglobal wrapmargin=8')
command('noa setlocal wrapmargin=1')
command('setlocal wrapmargin=2')
- expected_combination({'wrapmargin', 1, 1, '', 2, 'local', 'setlocal'})
+ expected_combination({ 'wrapmargin', 1, 1, '', 2, 'local', 'setlocal' })
command('noa setglobal wrapmargin=8')
command('noa setlocal wrapmargin=1')
command('set wrapmargin=2')
- expected_combination({'wrapmargin', 1, 1, 8, 2, 'global', 'set'})
+ expected_combination({ 'wrapmargin', 1, 1, 8, 2, 'global', 'set' })
command('noa set wrapmargin=8')
command('set wrapmargin=2')
- expected_combination({'wrapmargin', 8, 8, 8, 2, 'global', 'set'})
+ expected_combination({ 'wrapmargin', 8, 8, 8, 2, 'global', 'set' })
end)
it('with number global-local (to window) option', function()
command('noa setglobal scrolloff=8')
command('noa setlocal scrolloff=1')
command('setglobal scrolloff=2')
- expected_combination({'scrolloff', 8, '', 8, 2, 'global', 'setglobal'})
+ expected_combination({ 'scrolloff', 8, '', 8, 2, 'global', 'setglobal' })
command('noa setglobal scrolloff=8')
command('noa setlocal scrolloff=1')
command('setlocal scrolloff=2')
- expected_combination({'scrolloff', 1, 1, '', 2, 'local', 'setlocal'})
+ expected_combination({ 'scrolloff', 1, 1, '', 2, 'local', 'setlocal' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal scrolloff=8')
command('noa setlocal scrolloff=1')
command('set scrolloff=2')
- expected_combination({'scrolloff', 8, 1, 8, 2, 'global', 'set'})
+ expected_combination({ 'scrolloff', 8, 1, 8, 2, 'global', 'set' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa set scrolloff=8')
command('set scrolloff=2')
- expected_combination({'scrolloff', 8, 8, 8, 2, 'global', 'set'})
+ expected_combination({ 'scrolloff', 8, 8, 8, 2, 'global', 'set' })
end)
it('with number local (to window) option', function()
command('noa setglobal foldcolumn=8')
command('noa setlocal foldcolumn=1')
command('setglobal foldcolumn=2')
- expected_combination({'foldcolumn', '8', '', '8', '2', 'global', 'setglobal'})
+ expected_combination({ 'foldcolumn', '8', '', '8', '2', 'global', 'setglobal' })
command('noa setglobal foldcolumn=8')
command('noa setlocal foldcolumn=1')
command('setlocal foldcolumn=2')
- expected_combination({'foldcolumn', '1', '1', '', '2', 'local', 'setlocal'})
+ expected_combination({ 'foldcolumn', '1', '1', '', '2', 'local', 'setlocal' })
command('noa setglobal foldcolumn=8')
command('noa setlocal foldcolumn=1')
command('set foldcolumn=2')
- expected_combination({'foldcolumn', '1', '1', '8', '2', 'global', 'set'})
+ expected_combination({ 'foldcolumn', '1', '1', '8', '2', 'global', 'set' })
command('noa set foldcolumn=8')
command('set foldcolumn=2')
- expected_combination({'foldcolumn', '8', '8', '8', '2', 'global', 'set'})
+ expected_combination({ 'foldcolumn', '8', '8', '8', '2', 'global', 'set' })
end)
it('with boolean global option', function()
command('noa setglobal nowrapscan')
command('noa setlocal wrapscan') -- Sets the global(!) value
command('setglobal nowrapscan')
- expected_combination({'wrapscan', true, '', true, false, 'global', 'setglobal'})
+ expected_combination({ 'wrapscan', true, '', true, false, 'global', 'setglobal' })
command('noa setglobal nowrapscan')
command('noa setlocal wrapscan') -- Sets the global(!) value
command('setlocal nowrapscan')
- expected_combination({'wrapscan', true, true, '', false, 'local', 'setlocal'})
+ expected_combination({ 'wrapscan', true, true, '', false, 'local', 'setlocal' })
command('noa setglobal nowrapscan')
command('noa setlocal wrapscan') -- Sets the global(!) value
command('set nowrapscan')
- expected_combination({'wrapscan', true, true, true, false, 'global', 'set'})
+ expected_combination({ 'wrapscan', true, true, true, false, 'global', 'set' })
command('noa set nowrapscan')
command('set wrapscan')
- expected_combination({'wrapscan', false, false, false, true, 'global', 'set'})
+ expected_combination({ 'wrapscan', false, false, false, true, 'global', 'set' })
end)
it('with boolean global-local (to buffer) option', function()
command('noa setglobal noautoread')
command('noa setlocal autoread')
command('setglobal autoread')
- expected_combination({'autoread', false, '', false, true, 'global', 'setglobal'})
+ expected_combination({ 'autoread', false, '', false, true, 'global', 'setglobal' })
command('noa setglobal noautoread')
command('noa setlocal autoread')
command('setlocal noautoread')
- expected_combination({'autoread', true, true, '', false, 'local', 'setlocal'})
+ expected_combination({ 'autoread', true, true, '', false, 'local', 'setlocal' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal noautoread')
command('noa setlocal autoread')
command('set autoread')
- expected_combination({'autoread', false, true, false, true, 'global', 'set'})
+ expected_combination({ 'autoread', false, true, false, true, 'global', 'set' })
-- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa set noautoread')
command('set autoread')
- expected_combination({'autoread', false, false, false, true, 'global', 'set'})
+ expected_combination({ 'autoread', false, false, false, true, 'global', 'set' })
end)
it('with boolean local (to buffer) option', function()
command('noa setglobal nocindent')
command('noa setlocal cindent')
command('setglobal cindent')
- expected_combination({'cindent', false, '', false, true, 'global', 'setglobal'})
+ expected_combination({ 'cindent', false, '', false, true, 'global', 'setglobal' })
command('noa setglobal nocindent')
command('noa setlocal cindent')
command('setlocal nocindent')
- expected_combination({'cindent', true, true, '', false, 'local', 'setlocal'})
+ expected_combination({ 'cindent', true, true, '', false, 'local', 'setlocal' })
command('noa setglobal nocindent')
command('noa setlocal cindent')
command('set cindent')
- expected_combination({'cindent', true, true, false, true, 'global', 'set'})
+ expected_combination({ 'cindent', true, true, false, true, 'global', 'set' })
command('noa set nocindent')
command('set cindent')
- expected_combination({'cindent', false, false, false, true, 'global', 'set'})
+ expected_combination({ 'cindent', false, false, false, true, 'global', 'set' })
end)
it('with boolean local (to window) option', function()
command('noa setglobal nocursorcolumn')
command('noa setlocal cursorcolumn')
command('setglobal cursorcolumn')
- expected_combination({'cursorcolumn', false, '', false, true, 'global', 'setglobal'})
+ expected_combination({ 'cursorcolumn', false, '', false, true, 'global', 'setglobal' })
command('noa setglobal nocursorcolumn')
command('noa setlocal cursorcolumn')
command('setlocal nocursorcolumn')
- expected_combination({'cursorcolumn', true, true, '', false, 'local', 'setlocal'})
+ expected_combination({ 'cursorcolumn', true, true, '', false, 'local', 'setlocal' })
command('noa setglobal nocursorcolumn')
command('noa setlocal cursorcolumn')
command('set cursorcolumn')
- expected_combination({'cursorcolumn', true, true, false, true, 'global', 'set'})
+ expected_combination({ 'cursorcolumn', true, true, false, true, 'global', 'set' })
command('noa set nocursorcolumn')
command('set cursorcolumn')
- expected_combination({'cursorcolumn', false, false, false, true, 'global', 'set'})
+ expected_combination({ 'cursorcolumn', false, false, false, true, 'global', 'set' })
end)
-
end)
describe('with specific option', function()
-
before_each(function()
clear()
declare_hook_function()
@@ -575,13 +620,13 @@ describe('au OptionSet', function()
expected_empty()
command('setlocal ro')
- expected_combination({'readonly', false, false, '', true, 'local', 'setlocal'})
+ expected_combination({ 'readonly', false, false, '', true, 'local', 'setlocal' })
command('setglobal ro')
- expected_combination({'readonly', false, '', false, true, 'global', 'setglobal'})
+ expected_combination({ 'readonly', false, '', false, true, 'global', 'setglobal' })
command('set noro')
- expected_combination({'readonly', true, true, true, false, 'global', 'set'})
+ expected_combination({ 'readonly', true, true, true, false, 'global', 'set' })
end)
describe('being set by setbufvar()', function()
@@ -596,18 +641,26 @@ describe('au OptionSet', function()
set_hook('backup')
command('call setbufvar(1, "&backup", 1)')
- expected_combination({'backup', false, false, '', true, 'local', 'setlocal'})
+ expected_combination({ 'backup', false, false, '', true, 'local', 'setlocal' })
end)
it('should trigger if the current buffer is different from the targeted buffer', function()
set_hook('buftype')
local new_buffer = make_buffer()
- local new_bufnr = buf.get_number(new_buffer)
+ local new_bufnr = api.nvim_buf_get_number(new_buffer)
command('call setbufvar(' .. new_bufnr .. ', "&buftype", "nofile")')
- expected_combination({ 'buftype', '', '', '', 'nofile', 'local', 'setlocal',
- { bufnr = new_bufnr } })
+ expected_combination({
+ 'buftype',
+ '',
+ '',
+ '',
+ 'nofile',
+ 'local',
+ 'setlocal',
+ { bufnr = new_bufnr },
+ })
end)
end)
@@ -623,43 +676,54 @@ describe('au OptionSet', function()
set_hook('backup')
command('call setwinvar(1, "&backup", 1)')
- expected_combination({'backup', false, false, '', true, 'local', 'setlocal'})
+ expected_combination({ 'backup', false, false, '', true, 'local', 'setlocal' })
end)
- it('should not trigger if the current window is different from the targeted window', function()
- set_hook('cursorcolumn')
+ it(
+ 'should not trigger if the current window is different from the targeted window',
+ function()
+ set_hook('cursorcolumn')
- local new_winnr = get_new_window_number()
+ local new_winnr = get_new_window_number()
- command('call setwinvar(' .. new_winnr .. ', "&cursorcolumn", 1)')
- -- expected_combination({'cursorcolumn', false, true, 'local', {winnr = new_winnr}})
- expected_empty()
- end)
+ command('call setwinvar(' .. new_winnr .. ', "&cursorcolumn", 1)')
+ -- expected_combination({'cursorcolumn', false, true, 'local', {winnr = new_winnr}})
+ expected_empty()
+ end
+ )
end)
describe('being set by neovim api', function()
it('should trigger if a boolean option be set globally', function()
set_hook('autochdir')
- nvim.set_option_value('autochdir', true, {scope='global'})
- eq(true, nvim.get_option_value('autochdir', {scope='global'}))
- expected_combination({'autochdir', false, '', false, true, 'global', 'setglobal'})
+ nvim.nvim_set_option_value('autochdir', true, { scope = 'global' })
+ eq(true, nvim.nvim_get_option_value('autochdir', { scope = 'global' }))
+ expected_combination({ 'autochdir', false, '', false, true, 'global', 'setglobal' })
end)
it('should trigger if a number option be set globally', function()
set_hook('cmdheight')
- nvim.set_option_value('cmdheight', 5, {scope='global'})
- eq(5, nvim.get_option_value('cmdheight', {scope='global'}))
- expected_combination({'cmdheight', 1, '', 1, 5, 'global', 'setglobal'})
+ nvim.nvim_set_option_value('cmdheight', 5, { scope = 'global' })
+ eq(5, nvim.nvim_get_option_value('cmdheight', { scope = 'global' }))
+ expected_combination({ 'cmdheight', 1, '', 1, 5, 'global', 'setglobal' })
end)
it('should trigger if a string option be set globally', function()
set_hook('ambiwidth')
- nvim.set_option_value('ambiwidth', 'double', {scope='global'})
- eq('double', nvim.get_option_value('ambiwidth', {scope='global'}))
- expected_combination({'ambiwidth', 'single', '', 'single', 'double', 'global', 'setglobal'})
+ nvim.nvim_set_option_value('ambiwidth', 'double', { scope = 'global' })
+ eq('double', nvim.nvim_get_option_value('ambiwidth', { scope = 'global' }))
+ expected_combination({
+ 'ambiwidth',
+ 'single',
+ '',
+ 'single',
+ 'double',
+ 'global',
+ 'setglobal',
+ })
end)
end)
end)
diff --git a/test/functional/legacy/autocmd_spec.lua b/test/functional/legacy/autocmd_spec.lua
new file mode 100644
index 0000000000..97051f3d3f
--- /dev/null
+++ b/test/functional/legacy/autocmd_spec.lua
@@ -0,0 +1,40 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear = helpers.clear
+local write_file = helpers.write_file
+local command = helpers.command
+local feed = helpers.feed
+local api = helpers.api
+local eq = helpers.eq
+
+before_each(clear)
+
+-- oldtest: Test_autocmd_invalidates_undo_on_textchanged()
+it('no E440 in quickfix window when autocommand invalidates undo', function()
+ write_file(
+ 'XTest_autocmd_invalidates_undo_on_textchanged',
+ [[
+ set hidden
+ " create quickfix list (at least 2 lines to move line)
+ vimgrep /u/j %
+
+ " enter quickfix window
+ cwindow
+
+ " set modifiable
+ setlocal modifiable
+
+ " set autocmd to clear quickfix list
+
+ autocmd! TextChanged <buffer> call setqflist([])
+ " move line
+ move+1
+ ]]
+ )
+ finally(function()
+ os.remove('XTest_autocmd_invalidates_undo_on_textchanged')
+ end)
+ command('edit XTest_autocmd_invalidates_undo_on_textchanged')
+ command('so %')
+ feed('G')
+ eq('', api.nvim_get_vvar('errmsg'))
+end)
diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua
index 3913ba935a..cf0065f394 100644
--- a/test/functional/legacy/breakindent_spec.lua
+++ b/test/functional/legacy/breakindent_spec.lua
@@ -12,9 +12,9 @@ describe('breakindent', function()
it('cursor shown at correct position with showbreak', function()
local screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue}, -- SignColumn
- [2] = {bold = true}, -- ModeMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, -- SignColumn
+ [2] = { bold = true }, -- ModeMsg
})
screen:attach()
exec([[
@@ -26,13 +26,12 @@ describe('breakindent', function()
eval repeat('x', &columns - leftcol - 1)->setline(1)
eval 'second line'->setline(2)
]])
+
feed('AX')
screen:expect([[
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
{1: }^second line |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2:-- INSERT --} |
]])
-- No line wraps, so changing 'showbreak' should lead to the same screen.
@@ -43,22 +42,75 @@ describe('breakindent', function()
screen:expect_unchanged()
-- The first line now wraps because of "eol" in 'listchars'.
command('setlocal list')
- screen:expect{grid=[[
+ screen:expect([[
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
{1: } {0:+^$} |
{1: }second line{0:$} |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:-- INSERT --} |
- ]]}
+ ]])
command('setlocal nobreakindent')
- screen:expect{grid=[[
+ screen:expect([[
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
{1: }{0:+^$} |
{1: }second line{0:$} |
+ {0:~ }|*2
+ {2:-- INSERT --} |
+ ]])
+ end)
+
+ -- oldtest: Test_visual_starts_before_skipcol()
+ it('Visual selection that starts before skipcol shows correctly', function()
+ local screen = Screen.new(75, 6)
+ exec([[
+ 1new
+ setlocal breakindent
+ call setline(1, "\t" .. join(range(100)))
+ ]])
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
+ [2] = { bold = true, reverse = true }, -- StatusLine
+ [3] = { reverse = true }, -- StatusLineNC
+ [4] = { bold = true }, -- ModeMsg
+ })
+ screen:attach()
+
+ feed('v$')
+ screen:expect([[
+ {0:<<<} {1: 93 94 95 96 97 98 99}^ |
+ {2:[No Name] [+] }|
+ |
{0:~ }|
+ {3:[No Name] }|
+ {4:-- VISUAL --} |
+ ]])
+ command('setlocal showbreak=+++')
+ screen:expect([[
+ {0:+++}{1: 90 91 92 93 94 95 96 97 98 99}^ |
+ {2:[No Name] [+] }|
+ |
{0:~ }|
- {2:-- INSERT --} |
- ]]}
+ {3:[No Name] }|
+ {4:-- VISUAL --} |
+ ]])
+ command('setlocal breakindentopt+=sbr')
+ screen:expect([[
+ {0:+++} {1: 93 94 95 96 97 98 99}^ |
+ {2:[No Name] [+] }|
+ |
+ {0:~ }|
+ {3:[No Name] }|
+ {4:-- VISUAL --} |
+ ]])
+ command('setlocal nobreakindent')
+ screen:expect([[
+ {0:+++}{1: 98 99}^ |
+ {2:[No Name] [+] }|
+ |
+ {0:~ }|
+ {3:[No Name] }|
+ {4:-- VISUAL --} |
+ ]])
end)
end)
diff --git a/test/functional/legacy/buffer_spec.lua b/test/functional/legacy/buffer_spec.lua
index 1e8909f0d0..b3964540f0 100644
--- a/test/functional/legacy/buffer_spec.lua
+++ b/test/functional/legacy/buffer_spec.lua
@@ -1,16 +1,16 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, source = helpers.clear, helpers.source
-local call, eq, meths = helpers.call, helpers.eq, helpers.meths
+local call, eq, api = helpers.call, helpers.eq, helpers.api
local function expected_empty()
- eq({}, meths.get_vvar('errors'))
+ eq({}, api.nvim_get_vvar('errors'))
end
describe('buffer', function()
before_each(function()
clear()
- meths.ui_attach(80, 24, {})
- meths.set_option_value('hidden', false, {})
+ api.nvim_ui_attach(80, 24, {})
+ api.nvim_set_option_value('hidden', false, {})
end)
it('deleting a modified buffer with :confirm', function()
diff --git a/test/functional/legacy/changelist_spec.lua b/test/functional/legacy/changelist_spec.lua
index 72c9872163..b673e74128 100644
--- a/test/functional/legacy/changelist_spec.lua
+++ b/test/functional/legacy/changelist_spec.lua
@@ -9,7 +9,7 @@ describe('changelist', function()
setup(clear)
it('is working', function()
- insert("1\n2")
+ insert('1\n2')
feed('Gkylp')
feed_command('set ul=100')
diff --git a/test/functional/legacy/close_count_spec.lua b/test/functional/legacy/close_count_spec.lua
index 60ae155fbf..930dae668a 100644
--- a/test/functional/legacy/close_count_spec.lua
+++ b/test/functional/legacy/close_count_spec.lua
@@ -19,20 +19,20 @@ describe('close_count', function()
command('close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({6, 5, 4, 2, 1}, eval('buffers'))
+ eq({ 6, 5, 4, 2, 1 }, eval('buffers'))
command('1close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({5, 4, 2, 1}, eval('buffers'))
+ eq({ 5, 4, 2, 1 }, eval('buffers'))
command('$close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({5, 4, 2}, eval('buffers'))
+ eq({ 5, 4, 2 }, eval('buffers'))
command('1wincmd w')
command('2close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({5, 2}, eval('buffers'))
+ eq({ 5, 2 }, eval('buffers'))
command('1wincmd w')
command('new')
command('new')
@@ -40,37 +40,37 @@ describe('close_count', function()
command('-1close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({7, 5, 2}, eval('buffers'))
+ eq({ 7, 5, 2 }, eval('buffers'))
command('2wincmd w')
command('+1close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({7, 5}, eval('buffers'))
+ eq({ 7, 5 }, eval('buffers'))
command('only!')
command('b1')
command('let tests = []')
command('for i in range(5)|new|endfor')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({13, 12, 11, 10, 9, 1}, eval('buffers'))
+ eq({ 13, 12, 11, 10, 9, 1 }, eval('buffers'))
command('4wincmd w')
command('.hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({13, 12, 11, 9, 1}, eval('buffers'))
+ eq({ 13, 12, 11, 9, 1 }, eval('buffers'))
command('1hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({12, 11, 9, 1}, eval('buffers'))
+ eq({ 12, 11, 9, 1 }, eval('buffers'))
command('$hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({12, 11, 9}, eval('buffers'))
+ eq({ 12, 11, 9 }, eval('buffers'))
command('1wincmd w')
command('2hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({12, 9}, eval('buffers'))
+ eq({ 12, 9 }, eval('buffers'))
command('1wincmd w')
command('new')
command('new')
@@ -78,12 +78,12 @@ describe('close_count', function()
command('-hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({15, 12, 9}, eval('buffers'))
+ eq({ 15, 12, 9 }, eval('buffers'))
command('2wincmd w')
command('+hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({15, 12}, eval('buffers'))
+ eq({ 15, 12 }, eval('buffers'))
command('only!')
command('b1')
command('let tests = []')
@@ -93,16 +93,16 @@ describe('close_count', function()
command('$ hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({20, 19, 18, 17, 16}, eval('buffers'))
+ eq({ 20, 19, 18, 17, 16 }, eval('buffers'))
command('$-1 close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({20, 19, 18, 16}, eval('buffers'))
+ eq({ 20, 19, 18, 16 }, eval('buffers'))
command('1wincmd w')
command('.+close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({20, 18, 16}, eval('buffers'))
+ eq({ 20, 18, 16 }, eval('buffers'))
command('only!')
command('b1')
command('let tests = []')
@@ -113,22 +113,22 @@ describe('close_count', function()
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({25, 24, 23, 21, 1}, eval('buffers'))
+ eq({ 25, 24, 23, 21, 1 }, eval('buffers'))
feed('1<C-W>c<cr>')
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({24, 23, 21, 1}, eval('buffers'))
+ eq({ 24, 23, 21, 1 }, eval('buffers'))
feed('9<C-W>c<cr>')
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({24, 23, 21}, eval('buffers'))
+ eq({ 24, 23, 21 }, eval('buffers'))
command('1wincmd w')
feed('2<C-W>c<cr>')
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
- eq({24, 21}, eval('buffers'))
+ eq({ 24, 21 }, eval('buffers'))
end)
end)
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua
index 3cbff2a01b..8c94451f9a 100644
--- a/test/functional/legacy/cmdline_spec.lua
+++ b/test/functional/legacy/cmdline_spec.lua
@@ -5,8 +5,8 @@ local command = helpers.command
local feed = helpers.feed
local feed_command = helpers.feed_command
local exec = helpers.exec
-local meths = helpers.meths
-local pesc = helpers.pesc
+local api = helpers.api
+local pesc = vim.pesc
describe('cmdline', function()
before_each(clear)
@@ -16,10 +16,10 @@ describe('cmdline', function()
local screen = Screen.new(30, 10)
screen:attach()
screen:set_default_attr_ids {
- [1] = {underline = true, background = Screen.colors.LightGrey};
- [2] = {bold = true};
- [3] = {reverse = true};
- [4] = {bold = true, foreground = Screen.colors.Blue1};
+ [1] = { underline = true, background = Screen.colors.LightGrey },
+ [2] = { bold = true },
+ [3] = { reverse = true },
+ [4] = { bold = true, foreground = Screen.colors.Blue1 },
}
feed_command([[call setline(1, range(30))]])
@@ -37,35 +37,28 @@ describe('cmdline', function()
]])
feed [[:tabnew<cr>]]
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1: + [No Name] }{2: [No Name] }{3: }{1:X}|
^ |
- {4:~ }|
- {4:~ }|
- {4:~ }|
- {4:~ }|
- {4:~ }|
- {4:~ }|
- {4:~ }|
+ {4:~ }|*7
:tabnew |
- ]]}
+ ]],
+ }
feed [[<C-w>-<C-w>-]]
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1: + [No Name] }{2: [No Name] }{3: }{1:X}|
^ |
- {4:~ }|
- {4:~ }|
- {4:~ }|
- {4:~ }|
- {4:~ }|
- |
- |
- |
- ]]}
+ {4:~ }|*5
+ |*3
+ ]],
+ }
feed [[gt]]
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{2: + [No Name] }{1: [No Name] }{3: }{1:X}|
^0 |
1 |
@@ -76,20 +69,15 @@ describe('cmdline', function()
6 |
7 |
|
- ]]}
+ ]],
+ }
feed [[gt]]
screen:expect([[
{1: + [No Name] }{2: [No Name] }{3: }{1:X}|
^ |
- {4:~ }|
- {4:~ }|
- {4:~ }|
- {4:~ }|
- {4:~ }|
- |
- |
- |
+ {4:~ }|*5
+ |*3
]])
end)
@@ -105,8 +93,7 @@ describe('cmdline', function()
feed_command('DoSomething')
screen:expect([[
|
- ~ |
- ~ |
+ ~ |*2
|
Executing: DoSomething |
Executing: echo 'hello' |set ts=4 |let v = '123' |echo v |
@@ -123,8 +110,8 @@ describe('cmdline', function()
it('tabline is redrawn on entering cmdline', function()
local screen = Screen.new(30, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {reverse = true}, -- TabLineFill
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { reverse = true }, -- TabLineFill
})
screen:attach()
exec([[
@@ -135,9 +122,7 @@ describe('cmdline', function()
screen:expect([[
{1:foo }|
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
:^ |
]])
end)
@@ -146,7 +131,7 @@ describe('cmdline', function()
it('cmdline cursor position is correct after :redraw with cmdheight=2', function()
local screen = Screen.new(30, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
exec([[
@@ -156,9 +141,7 @@ describe('cmdline', function()
feed(':for i in range(3)<CR>')
screen:expect([[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
:for i in range(3) |
: ^ |
]])
@@ -166,9 +149,7 @@ describe('cmdline', function()
-- Note: this may still be considered broken, ref #18140
screen:expect([[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
: :let i =^ |
|
]])
@@ -177,8 +158,8 @@ describe('cmdline', function()
it("setting 'cmdheight' works after outputting two messages vim-patch:9.0.0665", function()
local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {bold = true, reverse = true}, -- StatusLine
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, reverse = true }, -- StatusLine
})
screen:attach()
exec([[
@@ -194,22 +175,14 @@ describe('cmdline', function()
feed(':call EchoTwo()')
screen:expect([[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
{1:[No Name] }|
:call EchoTwo()^ |
]])
feed('<CR>')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
{1:[No Name] }|
|
]])
@@ -219,22 +192,19 @@ describe('cmdline', function()
it("changing 'cmdheight' when there is a tabline", function()
local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {bold = true, reverse = true}, -- StatusLine
- [2] = {bold = true}, -- TabLineSel
- [3] = {reverse = true}, -- TabLineFill
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, reverse = true }, -- StatusLine
+ [2] = { bold = true }, -- TabLineSel
+ [3] = { reverse = true }, -- TabLineFill
})
screen:attach()
- meths.set_option_value('laststatus', 2, {})
- meths.set_option_value('showtabline', 2, {})
- meths.set_option_value('cmdheight', 1, {})
+ api.nvim_set_option_value('laststatus', 2, {})
+ api.nvim_set_option_value('showtabline', 2, {})
+ api.nvim_set_option_value('cmdheight', 1, {})
screen:expect([[
{2: [No Name] }{3: }|
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{1:[No Name] }|
|
]])
@@ -244,13 +214,13 @@ describe('cmdline', function()
it("ruler has correct position with 'rulerformat' set", function()
local screen = Screen.new(20, 3)
screen:set_default_attr_ids {
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
}
screen:attach()
- meths.set_option_value('ruler', true, {})
- meths.set_option_value('rulerformat', 'longish', {})
- meths.set_option_value('laststatus', 0, {})
- meths.set_option_value('winwidth', 1, {})
+ api.nvim_set_option_value('ruler', true, {})
+ api.nvim_set_option_value('rulerformat', 'longish', {})
+ api.nvim_set_option_value('laststatus', 0, {})
+ api.nvim_set_option_value('winwidth', 1, {})
feed [[<C-W>v<C-W>|<C-W>p]]
screen:expect [[
│^ |
@@ -267,72 +237,41 @@ describe('cmdwin', function()
it('still uses a new buffer when interrupting more prompt on open', function()
local screen = Screen.new(30, 16)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {bold = true, reverse = true}, -- StatusLine
- [2] = {reverse = true}, -- StatusLineNC
- [3] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
- [4] = {bold = true}, -- ModeMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, reverse = true }, -- StatusLine
+ [2] = { reverse = true }, -- StatusLineNC
+ [3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
+ [4] = { bold = true }, -- ModeMsg
})
screen:attach()
command('set more')
command('autocmd WinNew * highlight')
feed('q:')
- screen:expect({any = pesc('{3:-- More --}^')})
+ screen:expect({ any = pesc('{3:-- More --}^') })
feed('q')
screen:expect([[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
{2:[No Name] }|
{0::}^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
{1:[Command Line] }|
|
]])
feed([[aecho 'done']])
screen:expect([[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
{2:[No Name] }|
{0::}echo 'done'^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
{1:[Command Line] }|
{4:-- INSERT --} |
]])
feed('<CR>')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*14
done |
]])
end)
diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua
index 6aaa93f886..9a23d16c5b 100644
--- a/test/functional/legacy/conceal_spec.lua
+++ b/test/functional/legacy/conceal_spec.lua
@@ -6,7 +6,7 @@ local exec = helpers.exec
local feed = helpers.feed
local expect_pos = function(row, col)
- return helpers.eq({row, col}, helpers.eval('[screenrow(), screencol()]'))
+ return helpers.eq({ row, col }, helpers.eval('[screenrow(), screencol()]'))
end
describe('Conceal', function()
@@ -19,10 +19,10 @@ describe('Conceal', function()
it('works', function()
local screen = Screen.new(75, 12)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {bold = true, reverse = true}, -- StatusLine
- [2] = {reverse = true}, -- StatusLineNC, IncSearch
- [3] = {bold = true}, -- ModeMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, reverse = true }, -- StatusLine
+ [2] = { reverse = true }, -- StatusLineNC, IncSearch
+ [3] = { bold = true }, -- ModeMsg
})
screen:attach()
exec([[
@@ -386,9 +386,9 @@ describe('Conceal', function()
it('CursorColumn and ColorColumn on wrapped line', function()
local screen = Screen.new(40, 10)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.Grey90}, -- CursorColumn
- [2] = {background = Screen.colors.LightRed}, -- ColorColumn
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Grey90 }, -- CursorColumn
+ [2] = { background = Screen.colors.LightRed }, -- ColorColumn
})
screen:attach()
-- Check that cursorcolumn and colorcolumn don't get broken in presence of
@@ -416,10 +416,7 @@ describe('Conceal', function()
two two two two |hidden| ^here two two |
three three three three {1:t}hree |
{0: >>> }thre{2:e} three three three |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
/here |
]])
@@ -431,10 +428,7 @@ describe('Conceal', function()
two two two two |hidden| here two tw^o |
three three three three three |
{0: >>> }thre{2:e} three three three |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
/here |
]])
end)
@@ -443,8 +437,8 @@ describe('Conceal', function()
it('resize editor', function()
local screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {foreground = Screen.colors.Blue}, -- Comment
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { foreground = Screen.colors.Blue }, -- Comment
})
screen:attach()
exec([[
@@ -455,21 +449,14 @@ describe('Conceal', function()
]])
screen:expect([[
one two three four five, the ^backticks should be concealed |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
|
]])
screen:try_resize(75, 7)
screen:expect([[
one two three four five, the ^backticks should be concealed |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
|
]])
end)
@@ -478,7 +465,7 @@ describe('Conceal', function()
it('with linebreak', function()
local screen = Screen.new(75, 8)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
exec([[
@@ -501,8 +488,7 @@ describe('Conceal', function()
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
{0:+ }bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
{0:+ }cccccc |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
end)
diff --git a/test/functional/legacy/cpoptions_spec.lua b/test/functional/legacy/cpoptions_spec.lua
index d2f382ec12..288146199a 100644
--- a/test/functional/legacy/cpoptions_spec.lua
+++ b/test/functional/legacy/cpoptions_spec.lua
@@ -15,19 +15,13 @@ describe('cpoptions', function()
feed('c2w')
screen:expect([[
^one tw$ three |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
-- INSERT -- |
]])
feed('vim<Esc>')
screen:expect([[
vi^m three |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
end)
diff --git a/test/functional/legacy/crash_spec.lua b/test/functional/legacy/crash_spec.lua
index 5094f81847..094bea253e 100644
--- a/test/functional/legacy/crash_spec.lua
+++ b/test/functional/legacy/crash_spec.lua
@@ -6,7 +6,6 @@ local feed = helpers.feed
before_each(clear)
--- oldtest: Test_crash1()
it('no crash when ending Visual mode while editing buffer closes window', function()
command('new')
command('autocmd ModeChanged v:n ++once close')
@@ -14,3 +13,21 @@ it('no crash when ending Visual mode while editing buffer closes window', functi
command('enew')
assert_alive()
end)
+
+it('no crash when ending Visual mode close the window to switch to', function()
+ command('new')
+ command('autocmd ModeChanged v:n ++once only')
+ feed('v')
+ command('wincmd p')
+ assert_alive()
+end)
+
+it('no crash when truncating overlong message', function()
+ pcall(command, 'source test/old/testdir/crash/vim_msg_trunc_poc')
+ assert_alive()
+end)
+
+it('no crash with very long option error message', function()
+ pcall(command, 'source test/old/testdir/crash/poc_did_set_langmap')
+ assert_alive()
+end)
diff --git a/test/functional/legacy/debugger_spec.lua b/test/functional/legacy/debugger_spec.lua
index e6fb81719f..7ed5e84da6 100644
--- a/test/functional/legacy/debugger_spec.lua
+++ b/test/functional/legacy/debugger_spec.lua
@@ -13,8 +13,8 @@ describe('debugger', function()
before_each(function()
screen = Screen.new(999, 10)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue};
- [1] = {reverse = true, bold = true};
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { reverse = true, bold = true },
})
screen:attach()
end)
@@ -30,20 +30,16 @@ describe('debugger', function()
command(':let g:Xtest_var = 10')
command(':breakadd expr g:Xtest_var')
feed(':source %<CR>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^let g:Xtest_var += 1{MATCH: *}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|*8
:source %{MATCH: *}|
- ]]}
+ ]],
+ }
feed(':source %<CR>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
let g:Xtest_var += 1{MATCH: *}|
{0:~{MATCH: *}}|
{1:{MATCH: *}}|
@@ -54,22 +50,19 @@ describe('debugger', function()
{MATCH:.*}XdebugBreakExpr.vim{MATCH: *}|
line 1: let g:Xtest_var += 1{MATCH: *}|
>^{MATCH: *}|
- ]]}
+ ]],
+ }
feed('cont<CR>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^let g:Xtest_var += 1{MATCH: *}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
- {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|*8
{MATCH: *}|
- ]]}
+ ]],
+ }
feed(':source %<CR>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
let g:Xtest_var += 1{MATCH: *}|
{0:~{MATCH: *}}|
{1:{MATCH: *}}|
@@ -80,6 +73,7 @@ describe('debugger', function()
{MATCH:.*}XdebugBreakExpr.vim{MATCH: *}|
line 1: let g:Xtest_var += 1{MATCH: *}|
>^{MATCH: *}|
- ]]}
+ ]],
+ }
end)
end)
diff --git a/test/functional/legacy/delete_spec.lua b/test/functional/legacy/delete_spec.lua
index 1b9ec9af62..1227065af2 100644
--- a/test/functional/legacy/delete_spec.lua
+++ b/test/functional/legacy/delete_spec.lua
@@ -49,9 +49,9 @@ describe('Test for delete()', function()
it('symlink directory delete', function()
command("call mkdir('Xdir1')")
if helpers.is_os('win') then
- command("silent !mklink /j Xlink Xdir1")
+ command('silent !mklink /j Xlink Xdir1')
else
- command("silent !ln -s Xdir1 Xlink")
+ command('silent !ln -s Xdir1 Xlink')
end
eq(1, eval("isdirectory('Xdir1')"))
eq(1, eval("isdirectory('Xlink')"))
diff --git a/test/functional/legacy/digraph_spec.lua b/test/functional/legacy/digraph_spec.lua
index 7eeb83eb5f..015f144b74 100644
--- a/test/functional/legacy/digraph_spec.lua
+++ b/test/functional/legacy/digraph_spec.lua
@@ -10,36 +10,27 @@ describe('digraph', function()
it('characters displayed on the screen', function()
local screen = Screen.new(10, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {foreground = Screen.colors.Blue}, -- SpecialKey
- [2] = {bold = true}, -- ModeMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { foreground = Screen.colors.Blue }, -- SpecialKey
+ [2] = { bold = true }, -- ModeMsg
})
screen:attach()
feed('i<C-K>')
screen:expect([[
{1:^?} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:-- INSERT --}|
]])
feed('1')
screen:expect([[
{1:^1} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:-- INSERT --}|
]])
feed('2')
screen:expect([[
½^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:-- INSERT --}|
]])
end)
diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua
index 9c6f521882..153fad2e22 100644
--- a/test/functional/legacy/display_spec.lua
+++ b/test/functional/legacy/display_spec.lua
@@ -14,7 +14,7 @@ describe('display', function()
local screen = Screen.new(20, 4)
screen:attach()
screen:set_default_attr_ids({
- [1] = {bold = true},
+ [1] = { bold = true },
})
command([[call setline(1, repeat('a', 21))]])
@@ -32,9 +32,9 @@ describe('display', function()
local screen = Screen.new(60, 8)
screen:attach()
screen:set_default_attr_ids({
- [1] = {bold = true}, -- ModeMsg
- [2] = {background = Screen.colors.LightGrey}, -- Visual
- [3] = {background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue}, -- SignColumn
+ [1] = { bold = true }, -- ModeMsg
+ [2] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
+ [3] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, -- SignColumn
})
exec([[
@@ -48,12 +48,7 @@ describe('display', function()
feed('VG7kk')
screen:expect([[
{3: }^f{2:oo} |
- {3: }foo |
- {3: }foo |
- {3: }foo |
- {3: }foo |
- {3: }foo |
- {3: }foo |
+ {3: }foo |*6
{1:-- VISUAL LINE --} |
]])
end)
@@ -61,9 +56,9 @@ describe('display', function()
local function run_test_display_lastline(euro)
local screen = Screen.new(75, 10)
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [2] = {bold = true, reverse = true}, -- StatusLine
- [3] = {reverse = true}, -- StatusLineNC
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [2] = { bold = true, reverse = true }, -- StatusLine
+ [3] = { reverse = true }, -- StatusLineNC
})
screen:attach()
exec([[
@@ -80,12 +75,9 @@ describe('display', function()
end
screen:expect((([[
^a│aaa |
- a│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- a│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ a│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*2
b│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
- b│{1:~ }|
- b│{1:~ }|
- b│{1:~ }|
+ b│{1:~ }|*3
{1:@}│{1:~ }|
{2:< }{3:[No Name] [+] }|
|
@@ -97,12 +89,9 @@ describe('display', function()
command('100wincmd >')
screen:expect((([[
^aaa │a|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│a|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│a|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│a|*2
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb │b|
- {1:~ }│b|
- {1:~ }│b|
- {1:~ }│b|
+ {1:~ }│b|*3
{1:~ }│{1:@}|
{2:[No Name] [+] }{3:<}|
|
@@ -119,8 +108,7 @@ describe('display', function()
{1:@@@ }|
{2:[No Name] [+] }|
aaa |
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*2
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
{3:[No Name] [+] }|
|
@@ -133,9 +121,7 @@ describe('display', function()
a │bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
bb│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
bb│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
- bb│{1:~ }|
- bb│{1:~ }|
- bb│{1:~ }|
+ bb│{1:~ }|*3
{1:@@}│{1:~ }|
{2:< }{3:[No Name] [+] }|
|
@@ -164,17 +150,7 @@ describe('display', function()
feed('736|')
screen:expect([[
<<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|*11
^aaaaaaaaaaaaaaa |
|
]])
@@ -182,16 +158,7 @@ describe('display', function()
feed('D')
screen:expect([[
<<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|*10
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a|
bbbbb bbbbb bbbbb bbbbb bbbbb bb@@@|
|
@@ -205,29 +172,14 @@ describe('display', function()
bbbbb ccccc ccccc ccccc ccccc cccc|
c ccccc ccccc ddddd ddddd ddddd ddd|
dd ddddd ddddd ddddd |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*8
|
]])
-- "w_skipcol" is reset to bring the entire topline into view because
-- the line length is now smaller than the current skipcol + marker.
feed('x')
screen:expect([[
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|*9
aa^a |
bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb|
bbbbb ccccc ccccc ccccc ccccc cccc|
@@ -246,11 +198,7 @@ describe('display', function()
]])
screen:expect([[
<<<bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*5
b^b |
|
]])
@@ -260,12 +208,7 @@ describe('display', function()
feed('$0')
screen:expect([[
<<<b^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*6
|
]])
-- Going to the start of the line with "b" did not set w_skipcol correctly with 'smoothscroll'.
@@ -273,24 +216,14 @@ describe('display', function()
feed('$b')
screen:expect([[
2 b ^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*6
|
]])
-- Same for "ge".
feed('$ge')
screen:expect([[
2 ^b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*6
|
]])
end)
diff --git a/test/functional/legacy/edit_spec.lua b/test/functional/legacy/edit_spec.lua
index 939999e21b..0762e5e671 100644
--- a/test/functional/legacy/edit_spec.lua
+++ b/test/functional/legacy/edit_spec.lua
@@ -4,7 +4,7 @@ local clear = helpers.clear
local command = helpers.command
local expect = helpers.expect
local feed = helpers.feed
-local sleep = helpers.sleep
+local sleep = vim.uv.sleep
before_each(clear)
@@ -31,27 +31,21 @@ describe('edit', function()
it('inserting a register using CTRL-R', function()
local screen = Screen.new(10, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {foreground = Screen.colors.Blue}, -- SpecialKey
- [2] = {bold = true}, -- ModeMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { foreground = Screen.colors.Blue }, -- SpecialKey
+ [2] = { bold = true }, -- ModeMsg
})
screen:attach()
feed('a<C-R>')
screen:expect([[
{1:^"} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:-- INSERT --}|
]])
feed('=')
screen:expect([[
{1:"} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
=^ |
]])
end)
@@ -60,32 +54,26 @@ describe('edit', function()
it('positioning cursor after CTRL-R expression failed', function()
local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {foreground = Screen.colors.Blue}, -- SpecialKey
- [2] = {foreground = Screen.colors.SlateBlue},
- [3] = {bold = true}, -- ModeMsg
- [4] = {reverse = true, bold = true}, -- MsgSeparator
- [5] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
- [6] = {foreground = Screen.colors.SeaGreen, bold = true}, -- MoreMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { foreground = Screen.colors.Blue }, -- SpecialKey
+ [2] = { foreground = Screen.colors.SlateBlue },
+ [3] = { bold = true }, -- ModeMsg
+ [4] = { reverse = true, bold = true }, -- MsgSeparator
+ [5] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
+ [6] = { foreground = Screen.colors.SeaGreen, bold = true }, -- MoreMsg
})
screen:attach()
feed('i<C-R>')
screen:expect([[
{1:^"} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{3:-- INSERT --} |
]])
feed('={}')
screen:expect([[
{1:"} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
={2:{}}^ |
]])
-- trying to insert a dictionary produces an error
@@ -102,20 +90,14 @@ describe('edit', function()
feed(':')
screen:expect([[
:^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{3:-- INSERT --} |
]])
-- ending Insert mode should put the cursor back on the ':'
feed('<Esc>')
screen:expect([[
^: |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
|
]])
end)
diff --git a/test/functional/legacy/erasebackword_spec.lua b/test/functional/legacy/erasebackword_spec.lua
index 8ca64df328..46057fe599 100644
--- a/test/functional/legacy/erasebackword_spec.lua
+++ b/test/functional/legacy/erasebackword_spec.lua
@@ -8,7 +8,6 @@ describe('CTRL-W in Insert mode', function()
-- luacheck: ignore 611 (Line contains only whitespaces)
it('works for multi-byte characters', function()
-
for i = 1, 6 do
feed('o wwwこんにちわ世界ワールドvim ' .. string.rep('<C-w>', i) .. '<esc>')
end
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
index c531c59fd1..21d0ce118d 100644
--- a/test/functional/legacy/eval_spec.lua
+++ b/test/functional/legacy/eval_spec.lua
@@ -11,7 +11,9 @@ local dedent = helpers.dedent
describe('eval', function()
setup(function()
- write_file('test_eval_setup.vim', [[
+ write_file(
+ 'test_eval_setup.vim',
+ [[
set noswapfile
lang C
@@ -33,7 +35,8 @@ describe('eval', function()
execute "silent normal! Go==\n==\e\"".a:1."P"
endif
endfun
- ]])
+ ]]
+ )
end)
before_each(clear)
teardown(function()
@@ -53,8 +56,8 @@ describe('eval', function()
expect([[
": type v; value: abc (['abc']), expr: abc (['abc'])
- ": type V; value: abc]].."\000 (['abc']), expr: abc\000"..[[ (['abc'])
- ": type V; value: abc]].."\r\000 (['abc\r']), expr: abc\r\000 (['abc\r"..[['])
+ ": type V; value: abc]] .. "\000 (['abc']), expr: abc\000" .. [[ (['abc'])
+ ": type V; value: abc]] .. "\r\000 (['abc\r']), expr: abc\r\000 (['abc\r" .. [['])
=: type v; value: abc (['abc']), expr: "abc" (['"abc"'])]])
end)
@@ -97,29 +100,29 @@ describe('eval', function()
==
=abcB=
{{{2 setreg('c', 'abcC', 'l')
- c: type V; value: abcC]].."\000 (['abcC']), expr: abcC\000"..[[ (['abcC'])
+ c: type V; value: abcC]] .. "\000 (['abcC']), expr: abcC\000" .. [[ (['abcC'])
==
abcC
==
{{{2 setreg('d', 'abcD', 'V')
- d: type V; value: abcD]].."\000 (['abcD']), expr: abcD\000"..[[ (['abcD'])
+ d: type V; value: abcD]] .. "\000 (['abcD']), expr: abcD\000" .. [[ (['abcD'])
==
abcD
==
{{{2 setreg('e', 'abcE', 'b')
- e: type ]]..'\022'..[[4; value: abcE (['abcE']), expr: abcE (['abcE'])
+ e: type ]] .. '\022' .. [[4; value: abcE (['abcE']), expr: abcE (['abcE'])
==
=abcE=
- {{{2 setreg('f', 'abcF', ']]..'\022'..[[')
- f: type ]]..'\022'..[[4; value: abcF (['abcF']), expr: abcF (['abcF'])
+ {{{2 setreg('f', 'abcF', ']] .. '\022' .. [[')
+ f: type ]] .. '\022' .. [[4; value: abcF (['abcF']), expr: abcF (['abcF'])
==
=abcF=
{{{2 setreg('g', 'abcG', 'b10')
- g: type ]]..'\022'..[[10; value: abcG (['abcG']), expr: abcG (['abcG'])
+ g: type ]] .. '\022' .. [[10; value: abcG (['abcG']), expr: abcG (['abcG'])
==
=abcG =
- {{{2 setreg('h', 'abcH', ']]..'\022'..[[10')
- h: type ]]..'\022'..[[10; value: abcH (['abcH']), expr: abcH (['abcH'])
+ {{{2 setreg('h', 'abcH', ']] .. '\022' .. [[10')
+ h: type ]] .. '\022' .. [[10; value: abcH (['abcH']), expr: abcH (['abcH'])
==
=abcH =
{{{2 setreg('I', 'abcI')
@@ -132,12 +135,12 @@ describe('eval', function()
==
=abcAabcAc=
{{{2 setreg('A', 'abcAl', 'l')
- A: type V; value: abcAabcAcabcAl]].."\000 (['abcAabcAcabcAl']), expr: abcAabcAcabcAl\000"..[[ (['abcAabcAcabcAl'])
+ A: type V; value: abcAabcAcabcAl]] .. "\000 (['abcAabcAcabcAl']), expr: abcAabcAcabcAl\000" .. [[ (['abcAabcAcabcAl'])
==
abcAabcAcabcAl
==
{{{2 setreg('A', 'abcAc2', 'c')
- A: type v; value: abcAabcAcabcAl]].."\000abcAc2 (['abcAabcAcabcAl', 'abcAc2']), expr: abcAabcAcabcAl\000"..[[abcAc2 (['abcAabcAcabcAl', 'abcAc2'])
+ A: type v; value: abcAabcAcabcAl]] .. "\000abcAc2 (['abcAabcAcabcAl', 'abcAc2']), expr: abcAabcAcabcAl\000" .. [[abcAc2 (['abcAabcAcabcAl', 'abcAc2'])
==
=abcAabcAcabcAl
abcAc2=
@@ -146,50 +149,50 @@ describe('eval', function()
==
=abcBabcBc=
{{{2 setreg('b', 'abcBb', 'ba')
- b: type ]]..'\022'..[[5; value: abcBabcBcabcBb (['abcBabcBcabcBb']), expr: abcBabcBcabcBb (['abcBabcBcabcBb'])
+ b: type ]] .. '\022' .. [[5; value: abcBabcBcabcBb (['abcBabcBcabcBb']), expr: abcBabcBcabcBb (['abcBabcBcabcBb'])
==
=abcBabcBcabcBb=
{{{2 setreg('b', 'abcBc2', 'ca')
- b: type v; value: abcBabcBcabcBb]].."\000abcBc2 (['abcBabcBcabcBb', 'abcBc2']), expr: abcBabcBcabcBb\000"..[[abcBc2 (['abcBabcBcabcBb', 'abcBc2'])
+ b: type v; value: abcBabcBcabcBb]] .. "\000abcBc2 (['abcBabcBcabcBb', 'abcBc2']), expr: abcBabcBcabcBb\000" .. [[abcBc2 (['abcBabcBcabcBb', 'abcBc2'])
==
=abcBabcBcabcBb
abcBc2=
{{{2 setreg('b', 'abcBb2', 'b50a')
- b: type ]].."\02250; value: abcBabcBcabcBb\000abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2']), expr: abcBabcBcabcBb\000"..[[abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2'])
+ b: type ]] .. "\02250; value: abcBabcBcabcBb\000abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2']), expr: abcBabcBcabcBb\000" .. [[abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2'])
==
=abcBabcBcabcBb =
abcBc2abcBb2
{{{2 setreg('C', 'abcCl', 'l')
- C: type V; value: abcC]].."\000abcCl\000 (['abcC', 'abcCl']), expr: abcC\000abcCl\000"..[[ (['abcC', 'abcCl'])
+ C: type V; value: abcC]] .. "\000abcCl\000 (['abcC', 'abcCl']), expr: abcC\000abcCl\000" .. [[ (['abcC', 'abcCl'])
==
abcC
abcCl
==
{{{2 setreg('C', 'abcCc', 'c')
- C: type v; value: abcC]].."\000abcCl\000abcCc (['abcC', 'abcCl', 'abcCc']), expr: abcC\000abcCl\000"..[[abcCc (['abcC', 'abcCl', 'abcCc'])
+ C: type v; value: abcC]] .. "\000abcCl\000abcCc (['abcC', 'abcCl', 'abcCc']), expr: abcC\000abcCl\000" .. [[abcCc (['abcC', 'abcCl', 'abcCc'])
==
=abcC
abcCl
abcCc=
{{{2 setreg('D', 'abcDb', 'b')
- D: type ]].."\0225; value: abcD\000abcDb (['abcD', 'abcDb']), expr: abcD\000"..[[abcDb (['abcD', 'abcDb'])
+ D: type ]] .. "\0225; value: abcD\000abcDb (['abcD', 'abcDb']), expr: abcD\000" .. [[abcDb (['abcD', 'abcDb'])
==
=abcD =
abcDb
{{{2 setreg('E', 'abcEb', 'b')
- E: type ]].."\0225; value: abcE\000abcEb (['abcE', 'abcEb']), expr: abcE\000"..[[abcEb (['abcE', 'abcEb'])
+ E: type ]] .. "\0225; value: abcE\000abcEb (['abcE', 'abcEb']), expr: abcE\000" .. [[abcEb (['abcE', 'abcEb'])
==
=abcE =
abcEb
{{{2 setreg('E', 'abcEl', 'l')
- E: type V; value: abcE]].."\000abcEb\000abcEl\000 (['abcE', 'abcEb', 'abcEl']), expr: abcE\000abcEb\000abcEl\000"..[[ (['abcE', 'abcEb', 'abcEl'])
+ E: type V; value: abcE]] .. "\000abcEb\000abcEl\000 (['abcE', 'abcEb', 'abcEl']), expr: abcE\000abcEb\000abcEl\000" .. [[ (['abcE', 'abcEb', 'abcEl'])
==
abcE
abcEb
abcEl
==
{{{2 setreg('F', 'abcFc', 'c')
- F: type v; value: abcF]].."\000abcFc (['abcF', 'abcFc']), expr: abcF\000"..[[abcFc (['abcF', 'abcFc'])
+ F: type v; value: abcF]] .. "\000abcFc (['abcF', 'abcFc']), expr: abcF\000" .. [[abcFc (['abcF', 'abcFc'])
==
=abcF
abcFc=]])
@@ -219,36 +222,36 @@ describe('eval', function()
command([[call SetReg('F', "\n", 'b')]])
expect([[
- {{{2 setreg('A', ']]..'\000'..[[')
- A: type V; value: abcA2]].."\000 (['abcA2']), expr: abcA2\000"..[[ (['abcA2'])
+ {{{2 setreg('A', ']] .. '\000' .. [[')
+ A: type V; value: abcA2]] .. "\000 (['abcA2']), expr: abcA2\000" .. [[ (['abcA2'])
==
abcA2
==
- {{{2 setreg('B', ']]..'\000'..[[', 'c')
- B: type v; value: abcB2]].."\000 (['abcB2', '']), expr: abcB2\000"..[[ (['abcB2', ''])
+ {{{2 setreg('B', ']] .. '\000' .. [[', 'c')
+ B: type v; value: abcB2]] .. "\000 (['abcB2', '']), expr: abcB2\000" .. [[ (['abcB2', ''])
==
=abcB2
=
- {{{2 setreg('C', ']]..'\000'..[[')
- C: type V; value: abcC2]].."\000\000 (['abcC2', '']), expr: abcC2\000\000"..[[ (['abcC2', ''])
+ {{{2 setreg('C', ']] .. '\000' .. [[')
+ C: type V; value: abcC2]] .. "\000\000 (['abcC2', '']), expr: abcC2\000\000" .. [[ (['abcC2', ''])
==
abcC2
==
- {{{2 setreg('D', ']]..'\000'..[[', 'l')
- D: type V; value: abcD2]].."\000\000 (['abcD2', '']), expr: abcD2\000\000"..[[ (['abcD2', ''])
+ {{{2 setreg('D', ']] .. '\000' .. [[', 'l')
+ D: type V; value: abcD2]] .. "\000\000 (['abcD2', '']), expr: abcD2\000\000" .. [[ (['abcD2', ''])
==
abcD2
==
- {{{2 setreg('E', ']]..'\000'..[[')
- E: type V; value: abcE2]].."\000\000 (['abcE2', '']), expr: abcE2\000\000"..[[ (['abcE2', ''])
+ {{{2 setreg('E', ']] .. '\000' .. [[')
+ E: type V; value: abcE2]] .. "\000\000 (['abcE2', '']), expr: abcE2\000\000" .. [[ (['abcE2', ''])
==
abcE2
==
- {{{2 setreg('F', ']]..'\000'..[[', 'b')
- F: type ]].."\0220; value: abcF2\000 (['abcF2', '']), expr: abcF2\000"..[[ (['abcF2', ''])
+ {{{2 setreg('F', ']] .. '\000' .. [[', 'b')
+ F: type ]] .. "\0220; value: abcF2\000 (['abcF2', '']), expr: abcF2\000" .. [[ (['abcF2', ''])
==
=abcF2=
]])
@@ -282,21 +285,21 @@ describe('eval', function()
==
=abcA3=
{{{2 setreg('b', ['abcB3'], 'l')
- b: type V; value: abcB3]].."\000 (['abcB3']), expr: abcB3\000"..[[ (['abcB3'])
+ b: type V; value: abcB3]] .. "\000 (['abcB3']), expr: abcB3\000" .. [[ (['abcB3'])
==
abcB3
==
{{{2 setreg('c', ['abcC3'], 'b')
- c: type ]]..'\022'..[[5; value: abcC3 (['abcC3']), expr: abcC3 (['abcC3'])
+ c: type ]] .. '\022' .. [[5; value: abcC3 (['abcC3']), expr: abcC3 (['abcC3'])
==
=abcC3=
{{{2 setreg('d', ['abcD3'])
- d: type V; value: abcD3]].."\000 (['abcD3']), expr: abcD3\000"..[[ (['abcD3'])
+ d: type V; value: abcD3]] .. "\000 (['abcD3']), expr: abcD3\000" .. [[ (['abcD3'])
==
abcD3
==
{{{2 setreg('e', [1, 2, 'abc', 3])
- e: type V; value: 1]].."\0002\000abc\0003\000 (['1', '2', 'abc', '3']), expr: 1\0002\000abc\0003\000"..[[ (['1', '2', 'abc', '3'])
+ e: type V; value: 1]] .. "\0002\000abc\0003\000 (['1', '2', 'abc', '3']), expr: 1\0002\000abc\0003\000" .. [[ (['1', '2', 'abc', '3'])
==
1
2
@@ -304,7 +307,7 @@ describe('eval', function()
3
==
{{{2 setreg('f', [1, 2, 3])
- f: type V; value: 1]].."\0002\0003\000 (['1', '2', '3']), expr: 1\0002\0003\000"..[[ (['1', '2', '3'])
+ f: type V; value: 1]] .. "\0002\0003\000 (['1', '2', '3']), expr: 1\0002\0003\000" .. [[ (['1', '2', '3'])
==
1
2
@@ -312,49 +315,49 @@ describe('eval', function()
==
{{{1 Appending lists with setreg()
{{{2 setreg('A', ['abcA3c'], 'c')
- A: type v; value: abcA3]].."\000abcA3c (['abcA3', 'abcA3c']), expr: abcA3\000"..[[abcA3c (['abcA3', 'abcA3c'])
+ A: type v; value: abcA3]] .. "\000abcA3c (['abcA3', 'abcA3c']), expr: abcA3\000" .. [[abcA3c (['abcA3', 'abcA3c'])
==
=abcA3
abcA3c=
{{{2 setreg('b', ['abcB3l'], 'la')
- b: type V; value: abcB3]].."\000abcB3l\000 (['abcB3', 'abcB3l']), expr: abcB3\000abcB3l\000"..[[ (['abcB3', 'abcB3l'])
+ b: type V; value: abcB3]] .. "\000abcB3l\000 (['abcB3', 'abcB3l']), expr: abcB3\000abcB3l\000" .. [[ (['abcB3', 'abcB3l'])
==
abcB3
abcB3l
==
{{{2 setreg('C', ['abcC3b'], 'lb')
- C: type ]].."\0226; value: abcC3\000abcC3b (['abcC3', 'abcC3b']), expr: abcC3\000"..[[abcC3b (['abcC3', 'abcC3b'])
+ C: type ]] .. "\0226; value: abcC3\000abcC3b (['abcC3', 'abcC3b']), expr: abcC3\000" .. [[abcC3b (['abcC3', 'abcC3b'])
==
=abcC3 =
abcC3b
{{{2 setreg('D', ['abcD32'])
- D: type V; value: abcD3]].."\000abcD32\000 (['abcD3', 'abcD32']), expr: abcD3\000abcD32\000"..[[ (['abcD3', 'abcD32'])
+ D: type V; value: abcD3]] .. "\000abcD32\000 (['abcD3', 'abcD32']), expr: abcD3\000abcD32\000" .. [[ (['abcD3', 'abcD32'])
==
abcD3
abcD32
==
{{{2 setreg('A', ['abcA32'])
- A: type V; value: abcA3]].."\000abcA3c\000abcA32\000 (['abcA3', 'abcA3c', 'abcA32']), expr: abcA3\000abcA3c\000abcA32\000"..[[ (['abcA3', 'abcA3c', 'abcA32'])
+ A: type V; value: abcA3]] .. "\000abcA3c\000abcA32\000 (['abcA3', 'abcA3c', 'abcA32']), expr: abcA3\000abcA3c\000abcA32\000" .. [[ (['abcA3', 'abcA3c', 'abcA32'])
==
abcA3
abcA3c
abcA32
==
{{{2 setreg('B', ['abcB3c'], 'c')
- B: type v; value: abcB3]].."\000abcB3l\000abcB3c (['abcB3', 'abcB3l', 'abcB3c']), expr: abcB3\000abcB3l\000"..[[abcB3c (['abcB3', 'abcB3l', 'abcB3c'])
+ B: type v; value: abcB3]] .. "\000abcB3l\000abcB3c (['abcB3', 'abcB3l', 'abcB3c']), expr: abcB3\000abcB3l\000" .. [[abcB3c (['abcB3', 'abcB3l', 'abcB3c'])
==
=abcB3
abcB3l
abcB3c=
{{{2 setreg('C', ['abcC3l'], 'l')
- C: type V; value: abcC3]].."\000abcC3b\000abcC3l\000 (['abcC3', 'abcC3b', 'abcC3l']), expr: abcC3\000abcC3b\000abcC3l\000"..[[ (['abcC3', 'abcC3b', 'abcC3l'])
+ C: type V; value: abcC3]] .. "\000abcC3b\000abcC3l\000 (['abcC3', 'abcC3b', 'abcC3l']), expr: abcC3\000abcC3b\000abcC3l\000" .. [[ (['abcC3', 'abcC3b', 'abcC3l'])
==
abcC3
abcC3b
abcC3l
==
{{{2 setreg('D', ['abcD3b'], 'b')
- D: type ]].."\0226; value: abcD3\000abcD32\000abcD3b (['abcD3', 'abcD32', 'abcD3b']), expr: abcD3\000abcD32\000"..[[abcD3b (['abcD3', 'abcD32', 'abcD3b'])
+ D: type ]] .. "\0226; value: abcD3\000abcD32\000abcD3b (['abcD3', 'abcD32', 'abcD3b']), expr: abcD3\000abcD32\000" .. [[abcD3b (['abcD3', 'abcD32', 'abcD3b'])
==
=abcD3 =
abcD32
@@ -368,53 +371,57 @@ describe('eval', function()
command([[$put ='{{{1 Appending lists with NL with setreg()']])
command([=[call SetReg('A', ["\n", 'abcA3l2'], 'l')]=])
expect(
- '\n'..
- '{{{1 Appending lists with NL with setreg()\n'..
- "{{{2 setreg('A', ['\000', 'abcA3l2'], 'l')\n"..
- "A: type V; value: abcA3\000abcA3c\000abcA32\000\000\000abcA3l2\000 (['abcA3', 'abcA3c', 'abcA32', '\000', 'abcA3l2']), expr: abcA3\000abcA3c\000abcA32\000\000\000abcA3l2\000 (['abcA3', 'abcA3c', 'abcA32', '\000', 'abcA3l2'])\n"..
- '==\n'..
- 'abcA3\n'..
- 'abcA3c\n'..
- 'abcA32\n'..
- '\000\n'..
- 'abcA3l2\n'..
- '==')
+ '\n'
+ .. '{{{1 Appending lists with NL with setreg()\n'
+ .. "{{{2 setreg('A', ['\000', 'abcA3l2'], 'l')\n"
+ .. "A: type V; value: abcA3\000abcA3c\000abcA32\000\000\000abcA3l2\000 (['abcA3', 'abcA3c', 'abcA32', '\000', 'abcA3l2']), expr: abcA3\000abcA3c\000abcA32\000\000\000abcA3l2\000 (['abcA3', 'abcA3c', 'abcA32', '\000', 'abcA3l2'])\n"
+ .. '==\n'
+ .. 'abcA3\n'
+ .. 'abcA3c\n'
+ .. 'abcA32\n'
+ .. '\000\n'
+ .. 'abcA3l2\n'
+ .. '=='
+ )
command('%delete')
command([=[call SetReg('B', ["\n", 'abcB3c2'], 'c')]=])
expect(
- '\n'..
- "{{{2 setreg('B', ['\000', 'abcB3c2'], 'c')\n"..
- "B: type v; value: abcB3\000abcB3l\000abcB3c\000\000\000abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\000', 'abcB3c2']), expr: abcB3\000abcB3l\000abcB3c\000\000\000abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\000', 'abcB3c2'])\n"..
- '==\n'..
- '=abcB3\n'..
- 'abcB3l\n'..
- 'abcB3c\n'..
- '\000\n'..
- 'abcB3c2=')
+ '\n'
+ .. "{{{2 setreg('B', ['\000', 'abcB3c2'], 'c')\n"
+ .. "B: type v; value: abcB3\000abcB3l\000abcB3c\000\000\000abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\000', 'abcB3c2']), expr: abcB3\000abcB3l\000abcB3c\000\000\000abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\000', 'abcB3c2'])\n"
+ .. '==\n'
+ .. '=abcB3\n'
+ .. 'abcB3l\n'
+ .. 'abcB3c\n'
+ .. '\000\n'
+ .. 'abcB3c2='
+ )
command('%delete')
command([=[call SetReg('C', ["\n", 'abcC3b2'], 'b')]=])
expect(
- '\n'..
- "{{{2 setreg('C', ['\000', 'abcC3b2'], 'b')\n"..
- "C: type \0227; value: abcC3\000abcC3b\000abcC3l\000\000\000abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\000', 'abcC3b2']), expr: abcC3\000abcC3b\000abcC3l\000\000\000abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\000', 'abcC3b2'])\n"..
- '==\n'..
- '=abcC3 =\n'..
- ' abcC3b\n'..
- ' abcC3l\n'..
- ' \000\n'..
- ' abcC3b2')
+ '\n'
+ .. "{{{2 setreg('C', ['\000', 'abcC3b2'], 'b')\n"
+ .. "C: type \0227; value: abcC3\000abcC3b\000abcC3l\000\000\000abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\000', 'abcC3b2']), expr: abcC3\000abcC3b\000abcC3l\000\000\000abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\000', 'abcC3b2'])\n"
+ .. '==\n'
+ .. '=abcC3 =\n'
+ .. ' abcC3b\n'
+ .. ' abcC3l\n'
+ .. ' \000\n'
+ .. ' abcC3b2'
+ )
command('%delete')
command([=[call SetReg('D', ["\n", 'abcD3b50'],'b50')]=])
expect(
- '\n'..
- "{{{2 setreg('D', ['\000', 'abcD3b50'], 'b50')\n"..
- "D: type \02250; value: abcD3\000abcD32\000abcD3b\000\000\000abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\000', 'abcD3b50']), expr: abcD3\000abcD32\000abcD3b\000\000\000abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\000', 'abcD3b50'])\n"..
- '==\n'..
- '=abcD3 =\n'..
- ' abcD32\n'..
- ' abcD3b\n'..
- ' \000\n'..
- ' abcD3b50')
+ '\n'
+ .. "{{{2 setreg('D', ['\000', 'abcD3b50'], 'b50')\n"
+ .. "D: type \02250; value: abcD3\000abcD32\000abcD3b\000\000\000abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\000', 'abcD3b50']), expr: abcD3\000abcD32\000abcD3b\000\000\000abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\000', 'abcD3b50'])\n"
+ .. '==\n'
+ .. '=abcD3 =\n'
+ .. ' abcD32\n'
+ .. ' abcD3b\n'
+ .. ' \000\n'
+ .. ' abcD3b50'
+ )
end)
-- The tests for setting lists with NLs are split into separate it() blocks
@@ -422,77 +429,92 @@ describe('eval', function()
-- make trouble on a line on its own.
it('setting lists with NLs with setreg(), part 1', function()
command('so test_eval_setup.vim')
- command([=[call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"])]=])
+ command(
+ [=[call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"])]=]
+ )
expect(
- '\n'..
- "{{{2 setreg('a', ['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2'])\n"..
- "a: type V; value: abcA4-0\000\000\000abcA4-2\000\000\000abcA4-3\000abcA4-4\000abcA4-4-2\000 (['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2']), expr: abcA4-0\000\000\000abcA4-2\000\000\000abcA4-3\000abcA4-4\000abcA4-4-2\000 (['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2'])\n"..
- '==\n'..
- 'abcA4-0\n'..
- '\000\n'..
- 'abcA4-2\000\n'..
- '\000abcA4-3\n'..
- 'abcA4-4\000abcA4-4-2\n'..
- '==')
+ '\n'
+ .. "{{{2 setreg('a', ['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2'])\n"
+ .. "a: type V; value: abcA4-0\000\000\000abcA4-2\000\000\000abcA4-3\000abcA4-4\000abcA4-4-2\000 (['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2']), expr: abcA4-0\000\000\000abcA4-2\000\000\000abcA4-3\000abcA4-4\000abcA4-4-2\000 (['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2'])\n"
+ .. '==\n'
+ .. 'abcA4-0\n'
+ .. '\000\n'
+ .. 'abcA4-2\000\n'
+ .. '\000abcA4-3\n'
+ .. 'abcA4-4\000abcA4-4-2\n'
+ .. '=='
+ )
end)
it('setting lists with NLs with setreg(), part 2', function()
command('so test_eval_setup.vim')
- command([=[call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c')]=])
+ command(
+ [=[call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c')]=]
+ )
expect(
- '\n'..
- "{{{2 setreg('b', ['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2'], 'c')\n"..
- "b: type v; value: abcB4c-0\000\000\000abcB4c-2\000\000\000abcB4c-3\000abcB4c-4\000abcB4c-4-2 (['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2']), expr: abcB4c-0\000\000\000abcB4c-2\000\000\000abcB4c-3\000abcB4c-4\000abcB4c-4-2 (['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2'])\n"..
- '==\n'..
- '=abcB4c-0\n'..
- '\000\n'..
- 'abcB4c-2\000\n'..
- '\000abcB4c-3\n'..
- 'abcB4c-4\000abcB4c-4-2=')
+ '\n'
+ .. "{{{2 setreg('b', ['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2'], 'c')\n"
+ .. "b: type v; value: abcB4c-0\000\000\000abcB4c-2\000\000\000abcB4c-3\000abcB4c-4\000abcB4c-4-2 (['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2']), expr: abcB4c-0\000\000\000abcB4c-2\000\000\000abcB4c-3\000abcB4c-4\000abcB4c-4-2 (['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2'])\n"
+ .. '==\n'
+ .. '=abcB4c-0\n'
+ .. '\000\n'
+ .. 'abcB4c-2\000\n'
+ .. '\000abcB4c-3\n'
+ .. 'abcB4c-4\000abcB4c-4-2='
+ )
end)
it('setting lists with NLs with setreg(), part 3', function()
command('so test_eval_setup.vim')
- command([=[call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l')]=])
+ command(
+ [=[call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l')]=]
+ )
expect(
- '\n'..
- "{{{2 setreg('c', ['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2'], 'l')\n"..
- "c: type V; value: abcC4l-0\000\000\000abcC4l-2\000\000\000abcC4l-3\000abcC4l-4\000abcC4l-4-2\000 (['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2']), expr: abcC4l-0\000\000\000abcC4l-2\000\000\000abcC4l-3\000abcC4l-4\000abcC4l-4-2\000 (['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2'])\n"..
- '==\n'..
- 'abcC4l-0\n'..
- '\000\n'..
- 'abcC4l-2\000\n'..
- '\000abcC4l-3\n'..
- 'abcC4l-4\000abcC4l-4-2\n'..
- '==')
+ '\n'
+ .. "{{{2 setreg('c', ['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2'], 'l')\n"
+ .. "c: type V; value: abcC4l-0\000\000\000abcC4l-2\000\000\000abcC4l-3\000abcC4l-4\000abcC4l-4-2\000 (['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2']), expr: abcC4l-0\000\000\000abcC4l-2\000\000\000abcC4l-3\000abcC4l-4\000abcC4l-4-2\000 (['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2'])\n"
+ .. '==\n'
+ .. 'abcC4l-0\n'
+ .. '\000\n'
+ .. 'abcC4l-2\000\n'
+ .. '\000abcC4l-3\n'
+ .. 'abcC4l-4\000abcC4l-4-2\n'
+ .. '=='
+ )
end)
it('setting lists with NLs with setreg(), part 4', function()
command('so test_eval_setup.vim')
- command([=[call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b')]=])
+ command(
+ [=[call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b')]=]
+ )
expect(
- '\n'..
- "{{{2 setreg('d', ['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2'], 'b')\n"..
- "d: type \02219; value: abcD4b-0\000\000\000abcD4b-2\000\000\000abcD4b-3\000abcD4b-4\000abcD4b-4-2 (['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2']), expr: abcD4b-0\000\000\000abcD4b-2\000\000\000abcD4b-3\000abcD4b-4\000abcD4b-4-2 (['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2'])\n"..
- '==\n'..
- '=abcD4b-0 =\n'..
- ' \000\n'..
- ' abcD4b-2\000\n'..
- ' \000abcD4b-3\n'..
- ' abcD4b-4\000abcD4b-4-2')
+ '\n'
+ .. "{{{2 setreg('d', ['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2'], 'b')\n"
+ .. "d: type \02219; value: abcD4b-0\000\000\000abcD4b-2\000\000\000abcD4b-3\000abcD4b-4\000abcD4b-4-2 (['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2']), expr: abcD4b-0\000\000\000abcD4b-2\000\000\000abcD4b-3\000abcD4b-4\000abcD4b-4-2 (['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2'])\n"
+ .. '==\n'
+ .. '=abcD4b-0 =\n'
+ .. ' \000\n'
+ .. ' abcD4b-2\000\n'
+ .. ' \000abcD4b-3\n'
+ .. ' abcD4b-4\000abcD4b-4-2'
+ )
end)
it('setting lists with NLs with setreg(), part 5', function()
command('so test_eval_setup.vim')
- command([=[call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10')]=])
+ command(
+ [=[call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10')]=]
+ )
expect(
- '\n'..
- "{{{2 setreg('e', ['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2'], 'b10')\n"..
- "e: type \02210; value: abcE4b10-0\000\000\000abcE4b10-2\000\000\000abcE4b10-3\000abcE4b10-4\000abcE4b10-4-2 (['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2']), expr: abcE4b10-0\000\000\000abcE4b10-2\000\000\000abcE4b10-3\000abcE4b10-4\000abcE4b10-4-2 (['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2'])\n"..
- '==\n'..
- '=abcE4b10-0=\n'..
- ' \000\n'..
- ' abcE4b10-2\000\n'..
- ' \000abcE4b10-3\n'..
- ' abcE4b10-4\000abcE4b10-4-2')
+ '\n'
+ .. "{{{2 setreg('e', ['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2'], 'b10')\n"
+ .. "e: type \02210; value: abcE4b10-0\000\000\000abcE4b10-2\000\000\000abcE4b10-3\000abcE4b10-4\000abcE4b10-4-2 (['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2']), expr: abcE4b10-0\000\000\000abcE4b10-2\000\000\000abcE4b10-3\000abcE4b10-4\000abcE4b10-4-2 (['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2'])\n"
+ .. '==\n'
+ .. '=abcE4b10-0=\n'
+ .. ' \000\n'
+ .. ' abcE4b10-2\000\n'
+ .. ' \000abcE4b10-3\n'
+ .. ' abcE4b10-4\000abcE4b10-4-2'
+ )
end)
it('getreg("a",1,1) returns a valid list when "a is unset', function()
@@ -511,19 +533,19 @@ describe('eval', function()
eq({}, eval("getreg('0',1,1)"))
-- x is a mutable list
- command("let y = x")
- eq({}, eval("y"))
+ command('let y = x')
+ eq({}, eval('y'))
command("call add(x, 'item')")
- eq({'item'}, eval("y"))
+ eq({ 'item' }, eval('y'))
end)
it('sets the unnamed register when the "u" option is passed to setreg', function()
command("call setreg('a','a reg', 'cu')")
- eq("a reg", eval('@"'))
+ eq('a reg', eval('@"'))
command("call setreg('b','b reg', 'cu')")
- eq("b reg", eval('@"'))
+ eq('b reg', eval('@"'))
command("call setreg('c','c reg', 'c')")
- eq("b reg", eval('@"'))
+ eq('b reg', eval('@"'))
end)
it('search and expressions', function()
@@ -532,20 +554,36 @@ describe('eval', function()
command([=[call SetReg('/', ["abc/\n"])]=])
command([=[call SetReg('=', ['"abc/"'])]=])
command([=[call SetReg('=', ["\"abc/\n\""])]=])
- expect([[
+ expect(
+ [[
{{{2 setreg('/', ['abc/'])
/: type v; value: abc/ (['abc/']), expr: abc/ (['abc/'])
==
=abc/=
- {{{2 setreg('/', ['abc/]]..'\000'..[['])
- /: type v; value: abc/]].."\000 (['abc/\000']), expr: abc/\000 (['abc/\000"..[['])
- ==
- =abc/]]..'\000'..[[=
+ {{{2 setreg('/', ['abc/]]
+ .. '\000'
+ .. [['])
+ /: type v; value: abc/]]
+ .. "\000 (['abc/\000']), expr: abc/\000 (['abc/\000"
+ .. [['])
+ ==
+ =abc/]]
+ .. '\000'
+ .. [[=
{{{2 setreg('=', ['"abc/"'])
=: type v; value: abc/ (['abc/']), expr: "abc/" (['"abc/"'])
- {{{2 setreg('=', ['"abc/]]..'\000'..[["'])
- =: type v; value: abc/]].."\000 (['abc/\000"..[[']), expr: "abc/]]..'\000'..[[" (['"abc/]]..'\000'..[["'])]])
+ {{{2 setreg('=', ['"abc/]]
+ .. '\000'
+ .. [["'])
+ =: type v; value: abc/]]
+ .. "\000 (['abc/\000"
+ .. [[']), expr: "abc/]]
+ .. '\000'
+ .. [[" (['"abc/]]
+ .. '\000'
+ .. [["'])]]
+ )
end)
describe('system clipboard', function()
@@ -574,15 +612,25 @@ describe('eval', function()
command('AR *')
command('let &cb=_clipopt')
command("call call('setreg', _clipreg)")
- expect([[
+ expect(
+ [[
Some first line (this text was at the top of the old test_eval.in).
Note: system clipboard is saved, changed and restored.
clipboard contents
something else
- *: type V; value: clipboard contents]]..'\00'..[[ (['clipboard contents']), expr: clipboard contents]]..'\00'..[[ (['clipboard contents'])
- *: type V; value: something else]]..'\00'..[[ (['something else']), expr: something else]]..'\00'..[[ (['something else'])]])
+ *: type V; value: clipboard contents]]
+ .. '\00'
+ .. [[ (['clipboard contents']), expr: clipboard contents]]
+ .. '\00'
+ .. [[ (['clipboard contents'])
+ *: type V; value: something else]]
+ .. '\00'
+ .. [[ (['something else']), expr: something else]]
+ .. '\00'
+ .. [[ (['something else'])]]
+ )
end)
end)
@@ -625,24 +673,30 @@ describe('eval', function()
end)
it('function name not starting with a capital', function()
- eq('Vim(function):E128: Function name must start with a capital or "s:": g:test()\\nendfunction',
- exc_exec(dedent([[
+ eq(
+ 'Vim(function):E128: Function name must start with a capital or "s:": g:test()\\nendfunction',
+ exc_exec(dedent([[
function! g:test()
- endfunction]])))
+ endfunction]]))
+ )
end)
it('Function name followed by #', function()
- eq('Vim(function):E128: Function name must start with a capital or "s:": test2() "#\\nendfunction',
- exc_exec(dedent([[
+ eq(
+ 'Vim(function):E128: Function name must start with a capital or "s:": test2() "#\\nendfunction',
+ exc_exec(dedent([[
function! test2() "#
- endfunction]])))
+ endfunction]]))
+ )
end)
it('function name includes a colon', function()
- eq('Vim(function):E884: Function name cannot contain a colon: b:test()\\nendfunction',
- exc_exec(dedent([[
+ eq(
+ 'Vim(function):E884: Function name cannot contain a colon: b:test()\\nendfunction',
+ exc_exec(dedent([[
function! b:test()
- endfunction]])))
+ endfunction]]))
+ )
end)
it('function name starting with/without "g:", buffer-local funcref', function()
@@ -686,8 +740,10 @@ describe('eval', function()
end)
it("using $ instead of '$' must give an error", function()
- eq('Vim(call):E116: Invalid arguments for function append',
- exc_exec('call append($, "foobar")'))
+ eq(
+ 'Vim(call):E116: Invalid arguments for function append',
+ exc_exec('call append($, "foobar")')
+ )
end)
it('getcurpos/setpos', function()
diff --git a/test/functional/legacy/ex_mode_spec.lua b/test/functional/legacy/ex_mode_spec.lua
index f21c47e175..ae4c4309d1 100644
--- a/test/functional/legacy/ex_mode_spec.lua
+++ b/test/functional/legacy/ex_mode_spec.lua
@@ -5,7 +5,7 @@ local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
-local meths = helpers.meths
+local api = helpers.api
local poke_eventloop = helpers.poke_eventloop
before_each(clear)
@@ -14,9 +14,9 @@ describe('Ex mode', function()
it('supports command line editing', function()
local function test_ex_edit(expected, cmd)
feed('gQ' .. cmd .. '<C-b>"<CR>')
- local ret = eval('@:[1:]') -- Remove leading quote.
+ local ret = eval('@:[1:]') -- Remove leading quote.
feed('visual<CR>')
- eq(meths.replace_termcodes(expected, true, true, true), ret)
+ eq(api.nvim_replace_termcodes(expected, true, true, true), ret)
end
command('set sw=2')
test_ex_edit('bar', 'foo bar<C-u>bar')
@@ -46,9 +46,9 @@ describe('Ex mode', function()
command('set noincsearch nohlsearch inccommand=')
local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, reverse = true}, -- MsgSeparator
- [1] = {foreground = Screen.colors.Brown}, -- LineNr
- [2] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [0] = { bold = true, reverse = true }, -- MsgSeparator
+ [1] = { foreground = Screen.colors.Brown }, -- LineNr
+ [2] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
command([[call setline(1, ['foo foo', 'foo foo', 'foo foo'])]])
@@ -118,8 +118,7 @@ describe('Ex mode', function()
{1: 1 }foo bar |
{1: 2 }foo foo |
{1: 3 }^foo foo |
- {2:~ }|
- {2:~ }|
+ {2:~ }|*2
|
]])
end)
@@ -127,8 +126,8 @@ describe('Ex mode', function()
it('pressing Ctrl-C in :append inside a loop in Ex mode does not hang', function()
local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, reverse = true}, -- MsgSeparator
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [0] = { bold = true, reverse = true }, -- MsgSeparator
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
feed('gQ')
@@ -143,7 +142,7 @@ describe('Ex mode', function()
^ |
]])
feed('<C-C>')
- poke_eventloop() -- Wait for input to be flushed
+ poke_eventloop() -- Wait for input to be flushed
feed('foo<CR>')
screen:expect([[
Entering Ex mode. Type "visual" to go to Normal mode. |
@@ -166,10 +165,7 @@ describe('Ex mode', function()
feed('vi<CR>')
screen:expect([[
^foo |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*4
|
]])
end)
diff --git a/test/functional/legacy/excmd_spec.lua b/test/functional/legacy/excmd_spec.lua
index eb480a6689..41f14c4645 100644
--- a/test/functional/legacy/excmd_spec.lua
+++ b/test/functional/legacy/excmd_spec.lua
@@ -6,8 +6,8 @@ local exec = helpers.exec
local exec_lua = helpers.exec_lua
local expect_exit = helpers.expect_exit
local feed = helpers.feed
-local funcs = helpers.funcs
-local meths = helpers.meths
+local fn = helpers.fn
+local api = helpers.api
local read_file = helpers.read_file
local source = helpers.source
local eq = helpers.eq
@@ -23,7 +23,9 @@ end
describe('Ex command', function()
before_each(clear)
- after_each(function() eq({}, meths.get_vvar('errors')) end)
+ after_each(function()
+ eq({}, api.nvim_get_vvar('errors'))
+ end)
it('checks for address line overflow', function()
if sizeoflong() < 8 then
@@ -47,10 +49,10 @@ describe(':confirm command dialog', function()
clear()
screen = Screen.new(75, 20)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {bold = true, reverse = true}, -- StatusLine, MsgSeparator
- [2] = {reverse = true}, -- StatusLineNC
- [3] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, reverse = true }, -- StatusLine, MsgSeparator
+ [2] = { reverse = true }, -- StatusLineNC
+ [3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach()
end
@@ -74,21 +76,13 @@ describe(':confirm command dialog', function()
feed(':confirm qall\n')
screen:expect([[
bar2 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
{2:Xbar [+] }|
foo2 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:Xfoo [+] }|
|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{1: }|
:confirm qall |
{3:Save changes to "Xbar"?} |
@@ -112,21 +106,13 @@ describe(':confirm command dialog', function()
feed(':confirm qall\n')
screen:expect([[
bar3 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
{2:Xbar [+] }|
foo3 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:Xfoo [+] }|
|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{1: }|
:confirm qall |
{3:Save changes to "Xbar"?} |
@@ -150,21 +136,13 @@ describe(':confirm command dialog', function()
feed(':confirm qall\n')
screen:expect([[
bar4 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
{2:Xbar [+] }|
foo4 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:Xfoo [+] }|
|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{1: }|
:confirm qall |
{3:Save changes to "Xbar"?} |
@@ -173,17 +151,10 @@ describe(':confirm command dialog', function()
feed('N')
screen:expect([[
bar4 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
{2:Xbar [+] }|
foo4 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:Xfoo [+] }|
|
{1: }|
@@ -215,9 +186,7 @@ describe(':confirm command dialog', function()
feed(':confirm close\n')
screen:expect([[
abc |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:[No Name] [+] }|
|
{1: }|
@@ -228,22 +197,17 @@ describe(':confirm command dialog', function()
feed('C')
screen:expect([[
^abc |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:[No Name] [+] }|
|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:[No Name] }|
|
]])
feed(':confirm close\n')
screen:expect([[
abc |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:[No Name] [+] }|
|
{1: }|
@@ -254,14 +218,7 @@ describe(':confirm command dialog', function()
feed('N')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*8
|
]])
end)
@@ -280,9 +237,7 @@ describe(':confirm command dialog', function()
feed(':confirm q\n')
screen:expect([[
foo |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1: }|
:confirm q |
{3:Save changes to "Untitled"?} |
@@ -291,12 +246,7 @@ describe(':confirm command dialog', function()
feed('C')
screen:expect([[
^abc |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
|
]])
@@ -304,9 +254,7 @@ describe(':confirm command dialog', function()
feed(':confirm wq\n')
screen:expect([[
foo |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1: }|
"Xfoo" [noeol] 1L, 3B written |
{3:Save changes to "Untitled"?} |
@@ -315,12 +263,7 @@ describe(':confirm command dialog', function()
feed('C')
screen:expect([[
^abc |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
"Xfoo" [noeol] 1L, 3B written |
]])
@@ -343,8 +286,7 @@ describe(':confirm command dialog', function()
feed(':set ro | confirm w\n')
screen:expect([[
foobar |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{1: }|
:set ro | confirm w |
{3:'readonly' option is set for "Xconfirm_write_ro".} |
@@ -354,11 +296,7 @@ describe(':confirm command dialog', function()
feed('N')
screen:expect([[
fooba^r |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
|
1,6 All |
]])
@@ -367,8 +305,7 @@ describe(':confirm command dialog', function()
feed(':confirm w\n')
screen:expect([[
foobar |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{1: }|
:confirm w |
{3:'readonly' option is set for "Xconfirm_write_ro".} |
@@ -400,10 +337,10 @@ describe(':confirm command dialog', function()
]])
end
eq('foobar\n', read_file('Xconfirm_write_ro'))
- feed('<CR>') -- suppress hit-enter prompt
+ feed('<CR>') -- suppress hit-enter prompt
-- Try to write with read-only file permissions.
- funcs.setfperm('Xconfirm_write_ro', 'r--r--r--')
+ fn.setfperm('Xconfirm_write_ro', 'r--r--r--')
feed(':set noro | silent undo | confirm w\n')
screen:expect([[
foobar |
@@ -440,7 +377,7 @@ describe(':confirm command dialog', function()
]])
end
eq('foo\n', read_file('Xconfirm_write_ro'))
- feed('<CR>') -- suppress hit-enter prompt
+ feed('<CR>') -- suppress hit-enter prompt
os.remove('Xconfirm_write_ro')
end)
@@ -473,8 +410,7 @@ describe(':confirm command dialog', function()
b |
c |
d |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
1,1 All |
]])
diff --git a/test/functional/legacy/filechanged_spec.lua b/test/functional/legacy/filechanged_spec.lua
index c8e772f597..46ecfdcd63 100644
--- a/test/functional/legacy/filechanged_spec.lua
+++ b/test/functional/legacy/filechanged_spec.lua
@@ -1,19 +1,19 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, source = helpers.clear, helpers.source
-local call, eq, meths = helpers.call, helpers.eq, helpers.meths
+local call, eq, api = helpers.call, helpers.eq, helpers.api
local is_os = helpers.is_os
local skip = helpers.skip
local function expected_empty()
- eq({}, meths.get_vvar('errors'))
+ eq({}, api.nvim_get_vvar('errors'))
end
describe('file changed dialog', function()
before_each(function()
clear()
- meths.ui_attach(80, 24, {})
- meths.set_option_value('autoread', false, {})
- meths.set_option_value('fsync', true, {})
+ api.nvim_ui_attach(80, 24, {})
+ api.nvim_set_option_value('autoread', false, {})
+ api.nvim_set_option_value('fsync', true, {})
end)
it('works', function()
diff --git a/test/functional/legacy/fixeol_spec.lua b/test/functional/legacy/fixeol_spec.lua
index 3cc9d54e2b..01b87ac9a0 100644
--- a/test/functional/legacy/fixeol_spec.lua
+++ b/test/functional/legacy/fixeol_spec.lua
@@ -6,11 +6,11 @@ local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers
describe('fixeol', function()
local function rmtestfiles()
- os.remove("test.out")
- os.remove("XXEol")
- os.remove("XXNoEol")
- os.remove("XXTestEol")
- os.remove("XXTestNoEol")
+ os.remove('test.out')
+ os.remove('XXEol')
+ os.remove('XXNoEol')
+ os.remove('XXTestEol')
+ os.remove('XXTestNoEol')
end
setup(function()
clear()
diff --git a/test/functional/legacy/fnamemodify_spec.lua b/test/functional/legacy/fnamemodify_spec.lua
index 6262db3a2f..570b523d92 100644
--- a/test/functional/legacy/fnamemodify_spec.lua
+++ b/test/functional/legacy/fnamemodify_spec.lua
@@ -2,10 +2,10 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, source = helpers.clear, helpers.source
-local call, eq, nvim = helpers.call, helpers.eq, helpers.meths
+local call, eq, nvim = helpers.call, helpers.eq, helpers.api
local function expected_empty()
- eq({}, nvim.get_vvar('errors'))
+ eq({}, nvim.nvim_get_vvar('errors'))
end
describe('filename modifiers', function()
diff --git a/test/functional/legacy/fold_spec.lua b/test/functional/legacy/fold_spec.lua
index 83513a3f94..c39aae87d2 100644
--- a/test/functional/legacy/fold_spec.lua
+++ b/test/functional/legacy/fold_spec.lua
@@ -15,10 +15,10 @@ describe('folding', function()
screen = Screen.new(45, 8)
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [2] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}, -- Folded
- [3] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Grey}, -- FoldColumn
- [4] = {foreground = Screen.colors.Brown}, -- LineNr
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [2] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey }, -- Folded
+ [3] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Grey }, -- FoldColumn
+ [4] = { foreground = Screen.colors.Brown }, -- LineNr
})
screen:attach()
end)
@@ -50,7 +50,7 @@ describe('folding', function()
1 aa]])
end)
- it("foldmethod=marker", function()
+ it('foldmethod=marker', function()
screen:try_resize(20, 10)
insert([[
dd {{{
@@ -72,18 +72,15 @@ describe('folding', function()
dd {{{ |
ee {{{ }}} |
{{{ |
- ff }}} |
- ff }}} |
+ ff }}} |*2
^ |
line 2 foldlevel=2 |
- 1 |
- 1 |
+ 1 |*2
|
]])
-
end)
- it("foldmethod=indent", function()
+ it('foldmethod=indent', function()
screen:try_resize(20, 8)
feed_command('set fdm=indent sw=2')
insert([[
@@ -109,7 +106,7 @@ describe('folding', function()
]])
end)
- it("foldmethod=syntax", function()
+ it('foldmethod=syntax', function()
screen:try_resize(35, 15)
insert([[
1 aa
@@ -148,7 +145,7 @@ describe('folding', function()
a jj]])
end)
- it("foldmethod=expression", function()
+ it('foldmethod=expression', function()
insert([[
1 aa
2 bb
@@ -227,22 +224,14 @@ describe('folding', function()
screen:expect([[
{3:+ }{4: 0 }{2:^+-- 2 lines: ·························}|
{3:+ }{4: 1 }{2:+-- 2 lines: ·························}|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*5
|
]])
- feed("j")
+ feed('j')
screen:expect([[
{3:+ }{4: 1 }{2:+-- 2 lines: ·························}|
{3:+ }{4: 0 }{2:^+-- 2 lines: ·························}|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*5
|
]])
end)
@@ -259,10 +248,7 @@ describe('folding', function()
^one |
{2:+-- 2 lines: two····························}|
four |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*4
|
]])
feed('2G')
@@ -271,9 +257,7 @@ describe('folding', function()
^two |
three |
four |
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
|
]])
feed('4G')
@@ -281,10 +265,7 @@ describe('folding', function()
one |
{2:+-- 2 lines: two····························}|
^four |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*4
|
]])
feed('3G')
@@ -293,9 +274,7 @@ describe('folding', function()
two |
^three |
four |
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
|
]])
feed('1G')
@@ -303,10 +282,7 @@ describe('folding', function()
^one |
{2:+-- 2 lines: two····························}|
four |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*4
|
]])
feed('2G')
@@ -315,9 +291,7 @@ describe('folding', function()
^two |
three |
four |
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
|
]])
feed('k')
@@ -325,10 +299,7 @@ describe('folding', function()
^one |
{2:+-- 2 lines: two····························}|
four |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*4
|
]])
end)
diff --git a/test/functional/legacy/function_sort_spec.lua b/test/functional/legacy/function_sort_spec.lua
index 414953aacc..36128bb0a2 100644
--- a/test/functional/legacy/function_sort_spec.lua
+++ b/test/functional/legacy/function_sort_spec.lua
@@ -11,24 +11,24 @@ describe('sort', function()
before_each(clear)
it('numbers compared as strings', function()
- eq({1, 2, 3}, eval('sort([3, 2, 1])'))
- eq({13, 28, 3}, eval('sort([3, 28, 13])'))
+ eq({ 1, 2, 3 }, eval('sort([3, 2, 1])'))
+ eq({ 13, 28, 3 }, eval('sort([3, 28, 13])'))
end)
it('numbers compared as numeric', function()
- eq({1, 2, 3}, eval("sort([3, 2, 1], 'n')"))
- eq({3, 13, 28}, eval("sort([3, 28, 13], 'n')"))
+ eq({ 1, 2, 3 }, eval("sort([3, 2, 1], 'n')"))
+ eq({ 3, 13, 28 }, eval("sort([3, 28, 13], 'n')"))
-- Strings are not sorted.
- eq({'13', '28', '3'}, eval("sort(['13', '28', '3'], 'n')"))
+ eq({ '13', '28', '3' }, eval("sort(['13', '28', '3'], 'n')"))
end)
it('numbers compared as numbers', function()
- eq({3, 13, 28}, eval("sort([13, 28, 3], 'N')"))
- eq({'3', '13', '28'}, eval("sort(['13', '28', '3'], 'N')"))
+ eq({ 3, 13, 28 }, eval("sort([13, 28, 3], 'N')"))
+ eq({ '3', '13', '28' }, eval("sort(['13', '28', '3'], 'N')"))
end)
it('numbers compared as float', function()
- eq({0.28, 3, 13.5}, eval("sort([13.5, 0.28, 3], 'f')"))
+ eq({ 0.28, 3, 13.5 }, eval("sort([13.5, 0.28, 3], 'f')"))
end)
it('ability to call sort() from a compare function', function()
@@ -43,15 +43,15 @@ describe('sort', function()
endfunc
]])
- eq({1, 3, 5}, eval("sort([3, 1, 5], 'Compare1')"))
+ eq({ 1, 3, 5 }, eval("sort([3, 1, 5], 'Compare1')"))
end)
it('default sort', function()
-- docs say omitted, empty or zero argument sorts on string representation
- eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"])'))
- eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval([[sort([3.3, 1, "2", "A", "a", "AA"], '')]]))
- eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"], 0)'))
- eq({'2', 'A', 'a', 'AA', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"], 1)'))
+ eq({ '2', 'A', 'AA', 'a', 1, 3.3 }, eval('sort([3.3, 1, "2", "A", "a", "AA"])'))
+ eq({ '2', 'A', 'AA', 'a', 1, 3.3 }, eval([[sort([3.3, 1, "2", "A", "a", "AA"], '')]]))
+ eq({ '2', 'A', 'AA', 'a', 1, 3.3 }, eval('sort([3.3, 1, "2", "A", "a", "AA"], 0)'))
+ eq({ '2', 'A', 'a', 'AA', 1, 3.3 }, eval('sort([3.3, 1, "2", "A", "a", "AA"], 1)'))
neq(nil, exc_exec('call sort([3.3, 1, "2"], 3)'):find('E474:'))
end)
end)
diff --git a/test/functional/legacy/gf_spec.lua b/test/functional/legacy/gf_spec.lua
index 9f725446be..b51f671bee 100644
--- a/test/functional/legacy/gf_spec.lua
+++ b/test/functional/legacy/gf_spec.lua
@@ -10,7 +10,9 @@ describe('gf', function()
it('is not allowed when buffer is locked', function()
command('au OptionSet diff norm! gf')
command([[call setline(1, ['Xfile1', 'line2', 'line3', 'line4'])]])
- eq('OptionSet Autocommands for "diff": Vim(normal):E788: Not allowed to edit another buffer now',
- pcall_err(command, 'diffthis'))
+ eq(
+ 'OptionSet Autocommands for "diff": Vim(normal):E788: Not allowed to edit another buffer now',
+ pcall_err(command, 'diffthis')
+ )
end)
end)
diff --git a/test/functional/legacy/global_spec.lua b/test/functional/legacy/global_spec.lua
index ff02c41e6c..2c92b7814a 100644
--- a/test/functional/legacy/global_spec.lua
+++ b/test/functional/legacy/global_spec.lua
@@ -12,8 +12,8 @@ describe(':global', function()
it('can be interrupted using Ctrl-C in cmdline mode vim-patch:9.0.0082', function()
local screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, reverse = true}, -- MsgSeparator
- [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ [0] = { bold = true, reverse = true }, -- MsgSeparator
+ [1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach()
@@ -24,20 +24,17 @@ describe(':global', function()
]])
feed(':g/foo/norm :<C-V>;<CR>')
- poke_eventloop() -- Wait for :sleep to start
+ poke_eventloop() -- Wait for :sleep to start
feed('<C-C>')
screen:expect([[
^foo |
- foo |
- foo |
- foo |
- foo |
+ foo |*4
{1:Interrupted} |
]])
-- Also test in Ex mode
feed('gQg/foo/norm :<C-V>;<CR>')
- poke_eventloop() -- Wait for :sleep to start
+ poke_eventloop() -- Wait for :sleep to start
feed('<C-C>')
screen:expect([[
{0: }|
diff --git a/test/functional/legacy/highlight_spec.lua b/test/functional/legacy/highlight_spec.lua
index 0a130f1607..3d06bf3978 100644
--- a/test/functional/legacy/highlight_spec.lua
+++ b/test/functional/legacy/highlight_spec.lua
@@ -39,7 +39,9 @@ describe(':highlight', function()
-- Test setting colors.
-- Test clearing one color and all doesn't generate error or warning
- feed_command('hi NewGroup cterm=italic ctermfg=DarkBlue ctermbg=Grey gui=NONE guifg=#00ff00 guibg=Cyan')
+ feed_command(
+ 'hi NewGroup cterm=italic ctermfg=DarkBlue ctermbg=Grey gui=NONE guifg=#00ff00 guibg=Cyan'
+ )
feed_command('hi Group2 cterm=NONE')
feed_command('hi Group3 cterm=bold')
feed_command('redir! @a')
@@ -54,8 +56,7 @@ describe(':highlight', function()
feed_command('hi clear')
feed_command('hi Group3')
feed('<cr>')
- eq('Vim(highlight):E475: Invalid argument: cterm=\'asdf',
- exc_exec([[hi Crash cterm='asdf]]))
+ eq("Vim(highlight):E475: Invalid argument: cterm='asdf", exc_exec([[hi Crash cterm='asdf]]))
feed_command('redir END')
-- Filter ctermfg and ctermbg, the numbers depend on the terminal
@@ -99,9 +100,9 @@ describe('Visual selection highlight', function()
it("when 'showbreak' is set", function()
local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.LightGrey}, -- Visual
- [2] = {bold = true}, -- ModeMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
+ [2] = { bold = true }, -- ModeMsg
})
screen:attach()
exec([[
@@ -112,10 +113,7 @@ describe('Visual selection highlight', function()
feed('v$')
screen:expect([[
{0:>}{1:n, no sea takimata sanctus est Lorem ipsum dolor sit amet.}^ |
- |
- |
- |
- |
+ |*4
{2:-- VISUAL --} |
]])
end)
diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua
index d35f4bdae6..a81044114c 100644
--- a/test/functional/legacy/increment_spec.lua
+++ b/test/functional/legacy/increment_spec.lua
@@ -3,10 +3,9 @@
local helpers = require('test.functional.helpers')(after_each)
local source, command = helpers.source, helpers.command
local call, clear = helpers.call, helpers.clear
-local eq, nvim = helpers.eq, helpers.meths
+local eq, nvim = helpers.eq, helpers.api
describe('Ctrl-A/Ctrl-X on visual selections', function()
-
before_each(function()
clear()
source([=[
@@ -744,18 +743,18 @@ describe('Ctrl-A/Ctrl-X on visual selections', function()
it('works on Test ' .. id, function()
command('set nrformats&vi') -- &vi makes Vim compatible
call('Test_visual_increment_' .. id)
- eq({}, nvim.get_vvar('errors'))
+ eq({}, nvim.nvim_get_vvar('errors'))
end)
end
it('does not drop leading zeroes', function()
command('set nrformats&vi') -- &vi makes Vim compatible
call('Test_normal_increment_01')
- eq({}, nvim.get_vvar('errors'))
+ eq({}, nvim.nvim_get_vvar('errors'))
end)
it('maintains correct column after CTRL-A', function()
call('Test_normal_increment_02')
- eq({}, nvim.get_vvar('errors'))
+ eq({}, nvim.nvim_get_vvar('errors'))
end)
end)
diff --git a/test/functional/legacy/lispwords_spec.lua b/test/functional/legacy/lispwords_spec.lua
index 57d8d51377..efac8775d3 100644
--- a/test/functional/legacy/lispwords_spec.lua
+++ b/test/functional/legacy/lispwords_spec.lua
@@ -8,7 +8,7 @@ local source = helpers.source
describe('lispwords', function()
before_each(clear)
- it('should be set global-local',function()
+ it('should be set global-local', function()
source([[
setglobal lispwords=foo,bar,baz
setlocal lispwords-=foo
diff --git a/test/functional/legacy/listchars_spec.lua b/test/functional/legacy/listchars_spec.lua
index a9aa238d4e..746e0550a6 100644
--- a/test/functional/legacy/listchars_spec.lua
+++ b/test/functional/legacy/listchars_spec.lua
@@ -103,10 +103,10 @@ describe("'listchars'", function()
it('"exceeds" character does not appear in foldcolumn vim-patch:8.2.3121', function()
local screen = Screen.new(60, 10)
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [2] = {bold = true, reverse = true}, -- StatusLine
- [3] = {reverse = true}, -- StatusLineNC
- [4] = {background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue}, -- FoldColumn, SignColumn
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [2] = { bold = true, reverse = true }, -- StatusLine
+ [3] = { reverse = true }, -- StatusLineNC
+ [4] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, -- FoldColumn, SignColumn
})
screen:attach()
exec([[
@@ -121,10 +121,7 @@ describe("'listchars'", function()
{4: } │{4: } │{4: } |
{4: }a │{4: }a │{4: }a |
{4: }aaaaaa │{4: }a{1:>}│{4: }aaaaaa |
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
+ {1:~ }│{1:~ }│{1:~ }|*4
{3:[No Name] [+] <[+] }{2:[No Name] [+] }|
|
]])
@@ -134,10 +131,7 @@ describe("'listchars'", function()
{4: } │{4: } │{4: } |
{4: }a │{4: }a│{4: }a |
{4: }aaaaaa │{4: }{1:>}│{4: }aaaaaa |
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
+ {1:~ }│{1:~ }│{1:~ }|*4
{3:[No Name] [+] <+] }{2:[No Name] [+] }|
|
]])
@@ -147,10 +141,7 @@ describe("'listchars'", function()
{4: } │{4: }│{4: } |
{4: }a │{4: }│{4: }a |
{4: }aaaaaa │{4: }│{4: }aaaaaa |
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
+ {1:~ }│{1:~ }│{1:~ }|*4
{3:[No Name] [+] <] }{2:[No Name] [+] }|
|
]])
@@ -160,10 +151,7 @@ describe("'listchars'", function()
{4: } │{4: }│{4: } |
{4: }a │{4: }│{4: }a |
{4: }aaaaaa │{4: }│{4: }aaaaaa |
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
+ {1:~ }│{1:~ }│{1:~ }|*4
{3:[No Name] [+] < }{2:[No Name] [+] }|
|
]])
@@ -173,10 +161,7 @@ describe("'listchars'", function()
{4: } │{4: }│{4: } |
{4: }a │{4: }│{4: }a |
{4: }aaaaaa │{4: }│{4: }aaaaaa |
- {1:~ }│{1:~}│{1:~ }|
- {1:~ }│{1:~}│{1:~ }|
- {1:~ }│{1:~}│{1:~ }|
- {1:~ }│{1:~}│{1:~ }|
+ {1:~ }│{1:~}│{1:~ }|*4
{3:[No Name] [+] < }{2:[No Name] [+] }|
|
]])
@@ -187,10 +172,7 @@ describe("'listchars'", function()
{4: } │{4: } │{4: } |
{4: }a │{4: }a │{4: }a |
{4: }aaaaaa │{4: }aaaaaa │{4: }aaaaaa |
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
+ {1:~ }│{1:~ }│{1:~ }|*4
{3:[No Name] [+] }{2:[No Name] [+] }{3:[No Name] [+] }|
:set nowrap foldcolumn=4 |
]])
@@ -200,10 +182,7 @@ describe("'listchars'", function()
{4: } │{4: }│{4: } |
{4: }a │{4: }│{4: }a |
{4: }aaaaaa │{4: ^ }│{4: }aaaaaa |
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
- {1:~ }│{1:~ }│{1:~ }|
+ {1:~ }│{1:~ }│{1:~ }|*4
{3:[No Name] [+] }{2:<[+] }{3:[No Name] [+] }|
:set nowrap foldcolumn=4 |
]])
@@ -213,10 +192,7 @@ describe("'listchars'", function()
{4: } │{4: }│{4: } |
{4: }a │{4: }│{4: }a |
{4: }aaaaaa │{4:^ }│{4: }aaaaaa |
- {1:~ }│{1:~}│{1:~ }|
- {1:~ }│{1:~}│{1:~ }|
- {1:~ }│{1:~}│{1:~ }|
- {1:~ }│{1:~}│{1:~ }|
+ {1:~ }│{1:~}│{1:~ }|*4
{3:[No Name] [+] }{2:< }{3:[No Name] [+] }|
:set nowrap foldcolumn=4 |
]])
diff --git a/test/functional/legacy/listlbr_spec.lua b/test/functional/legacy/listlbr_spec.lua
index d4f11a61c2..50628e5ef9 100644
--- a/test/functional/legacy/listlbr_spec.lua
+++ b/test/functional/legacy/listlbr_spec.lua
@@ -57,7 +57,9 @@ describe('listlbr', function()
feed_command('let line=ScreenChar(winwidth(0))')
feed_command('call DoRecordScreen()')
- feed_command('let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!"')
+ feed_command(
+ 'let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!"'
+ )
feed_command('set nolist linebreak ts=8')
feed_command([[let line="1\t".repeat('a', winwidth(0)-2)]])
feed_command('$put =line')
@@ -71,7 +73,9 @@ describe('listlbr', function()
feed_command('$')
feed_command('norm! zt')
- feed_command('let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)"')
+ feed_command(
+ 'let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)"'
+ )
feed_command('set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab')
feed_command('syn match ConcealVar contained /_/ conceal')
feed_command('syn match All /.*/ contains=ConcealVar')
@@ -201,9 +205,9 @@ describe('listlbr', function()
it('cursor position is drawn correctly after operator', function()
local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.LightGrey}, -- Visual
- [2] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
+ [2] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach()
@@ -217,18 +221,14 @@ describe('listlbr', function()
screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb {1:c}^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
2 |
]])
feed('zo')
screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb ^c |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2:E490: No fold found} |
]])
@@ -236,18 +236,14 @@ describe('listlbr', function()
screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb {1:c}^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2:E490: No fold found} 2 |
]])
feed('gq')
screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb ^c |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2:E490: No fold found} |
]])
@@ -255,18 +251,14 @@ describe('listlbr', function()
screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb {1:c}^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2:E490: No fold found} 1x2 |
]])
feed('I')
screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb ^c |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2:E490: No fold found} |
]])
@@ -274,18 +266,14 @@ describe('listlbr', function()
screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb {1:c}^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2:E490: No fold found} 2 |
]])
feed('s')
screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{2:E490: No fold found} |
]])
end)
diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua
index d7f4c71af2..8e5d9b88bc 100644
--- a/test/functional/legacy/listlbr_utf8_spec.lua
+++ b/test/functional/legacy/listlbr_utf8_spec.lua
@@ -1,12 +1,14 @@
-- Test for linebreak and list option in utf-8 mode
local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
local source = helpers.source
local feed = helpers.feed
+local exec = helpers.exec
local clear, expect = helpers.clear, helpers.expect
describe('linebreak', function()
- setup(clear)
+ before_each(clear)
-- luacheck: ignore 621 (Indentation)
-- luacheck: ignore 613 (Trailing whitespaces in a string)
@@ -208,4 +210,29 @@ describe('linebreak', function()
a b c¶
Screen attributes are the same!]])
end)
+
+ -- oldtest: Test_visual_ends_before_showbreak()
+ it("Visual area is correct when it ends before multibyte 'showbreak'", function()
+ local screen = Screen.new(60, 8)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
+ [2] = { bold = true }, -- ModeMsg
+ })
+ screen:attach()
+ exec([[
+ let &wrap = v:true
+ let &linebreak = v:true
+ let &showbreak = '↪ '
+ eval ['xxxxx ' .. 'y'->repeat(&columns - 6) .. ' zzzz']->setline(1)
+ normal! wvel
+ ]])
+ screen:expect([[
+ xxxxx |
+ {0:↪ }{1:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy}^ {1: }|
+ {0:↪ }zzzz |
+ {0:~ }|*4
+ {2:-- VISUAL --} |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua
index c1f23ab0a6..9eddec40f7 100644
--- a/test/functional/legacy/mapping_spec.lua
+++ b/test/functional/legacy/mapping_spec.lua
@@ -3,8 +3,8 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local expect, poke_eventloop = helpers.expect, helpers.poke_eventloop
-local command, eq, eval, meths = helpers.command, helpers.eq, helpers.eval, helpers.meths
-local sleep = helpers.sleep
+local command, eq, eval, api = helpers.command, helpers.eq, helpers.eval, helpers.api
+local sleep = vim.uv.sleep
describe('mapping', function()
before_each(clear)
@@ -110,7 +110,9 @@ describe('mapping', function()
command('imapclear')
command('set whichwrap=<,>,[,]')
feed('G3o<esc>2k')
- command([[:exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>."]])
+ command(
+ [[:exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>."]]
+ )
expect([[
@@ -132,9 +134,9 @@ describe('mapping', function()
command('nnoremap <LeftDrag> <LeftDrag><Cmd><CR>')
poke_eventloop()
- meths.input_mouse('left', 'press', '', 0, 0, 0)
+ api.nvim_input_mouse('left', 'press', '', 0, 0, 0)
poke_eventloop()
- meths.input_mouse('left', 'drag', '', 0, 0, 1)
+ api.nvim_input_mouse('left', 'drag', '', 0, 0, 1)
poke_eventloop()
eq('s', eval('mode()'))
end)
@@ -145,9 +147,9 @@ describe('mapping', function()
command('inoremap <LeftDrag> <LeftDrag><Cmd>let g:dragged = 1<CR>')
feed('i')
poke_eventloop()
- meths.input_mouse('left', 'press', '', 0, 0, 0)
+ api.nvim_input_mouse('left', 'press', '', 0, 0, 0)
poke_eventloop()
- meths.input_mouse('left', 'drag', '', 0, 0, 1)
+ api.nvim_input_mouse('left', 'drag', '', 0, 0, 1)
poke_eventloop()
eq(1, eval('g:dragged'))
eq('v', eval('mode()'))
@@ -156,9 +158,9 @@ describe('mapping', function()
command([[inoremap <LeftDrag> <LeftDrag><C-\><C-N>]])
feed('i')
poke_eventloop()
- meths.input_mouse('left', 'press', '', 0, 0, 0)
+ api.nvim_input_mouse('left', 'press', '', 0, 0, 0)
poke_eventloop()
- meths.input_mouse('left', 'drag', '', 0, 0, 1)
+ api.nvim_input_mouse('left', 'drag', '', 0, 0, 1)
poke_eventloop()
eq('n', eval('mode()'))
end)
diff --git a/test/functional/legacy/match_spec.lua b/test/functional/legacy/match_spec.lua
index b6e45c396c..ab791f03e5 100644
--- a/test/functional/legacy/match_spec.lua
+++ b/test/functional/legacy/match_spec.lua
@@ -11,8 +11,8 @@ describe('matchaddpos()', function()
it('can add more than 8 match positions vim-patch:9.0.0620', function()
local screen = Screen.new(60, 14)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.Yellow}, -- Search
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Yellow }, -- Search
})
screen:attach()
exec([[
@@ -43,8 +43,8 @@ describe('match highlighting', function()
it('does not continue in linebreak vim-patch:8.2.3698', function()
local screen = Screen.new(75, 10)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach()
exec([=[
@@ -55,13 +55,7 @@ describe('match highlighting', function()
screen:expect([[
^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{1:]} |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*7
|
]])
end)
@@ -69,9 +63,9 @@ describe('match highlighting', function()
it('is shown with incsearch vim-patch:8.2.3940', function()
local screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.Yellow}, -- Search
- [2] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Yellow }, -- Search
+ [2] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach()
exec([[
@@ -101,8 +95,8 @@ describe('match highlighting', function()
it('on a Tab vim-patch:8.2.4062', function()
local screen = Screen.new(75, 10)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach()
exec([[
@@ -112,14 +106,7 @@ describe('match highlighting', function()
]])
screen:expect([[
{1: ^ }ix |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*8
|
]])
end)
diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua
index 22d9247698..b03107deb0 100644
--- a/test/functional/legacy/matchparen_spec.lua
+++ b/test/functional/legacy/matchparen_spec.lua
@@ -13,8 +13,8 @@ describe('matchparen', function()
local screen = Screen.new(30, 7)
screen:attach()
screen:set_default_attr_ids({
- [1] = {bold = true},
- [2] = {background = Screen.colors.LightGrey},
+ [1] = { bold = true },
+ [2] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black },
})
exec([[
@@ -40,23 +40,19 @@ describe('matchparen', function()
it('matchparen highlight is cleared when switching buffer', function()
local screen = Screen.new(20, 5)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue},
- [1] = {background = Screen.colors.Cyan},
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { background = Screen.colors.Cyan },
})
screen:attach()
local screen1 = [[
{1:^()} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
|
]]
local screen2 = [[
^aa |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
|
]]
@@ -86,11 +82,11 @@ describe('matchparen', function()
local screen = Screen.new(30, 9)
screen:attach()
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue};
- [1] = {background = Screen.colors.Plum1};
- [2] = {background = Screen.colors.Grey};
- [3] = {bold = true};
- [4] = {bold = true, foreground = Screen.colors.SeaGreen};
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { background = Screen.colors.Plum1 },
+ [2] = { background = Screen.colors.Grey },
+ [3] = { bold = true },
+ [4] = { bold = true, foreground = Screen.colors.SeaGreen },
})
exec([[
@@ -101,7 +97,8 @@ describe('matchparen', function()
]])
feed('i<C-X><C-N><C-N>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
aa |
aaa |
aaaa |
@@ -111,6 +108,7 @@ describe('matchparen', function()
{1: aaaa }{0: }|
{0:~ }|
{3:-- }{4:match 2 of 3} |
- ]]}
+ ]],
+ }
end)
end)
diff --git a/test/functional/legacy/memory_usage_spec.lua b/test/functional/legacy/memory_usage_spec.lua
index 5f722e5190..a05e9fdf57 100644
--- a/test/functional/legacy/memory_usage_spec.lua
+++ b/test/functional/legacy/memory_usage_spec.lua
@@ -19,7 +19,10 @@ if is_asan() then
return
elseif is_os('win') then
if is_ci('github') then
- pending('Windows runners in Github Actions do not have a stable environment to estimate memory usage', function() end)
+ pending(
+ 'Windows runners in Github Actions do not have a stable environment to estimate memory usage',
+ function() end
+ )
return
elseif eval("executable('wmic')") == 0 then
pending('missing "wmic" command', function() end)
@@ -34,9 +37,9 @@ local monitor_memory_usage = {
memory_usage = function(self)
local handle
if is_os('win') then
- handle = io.popen('wmic process where processid=' ..self.pid..' get WorkingSetSize')
+ handle = io.popen('wmic process where processid=' .. self.pid .. ' get WorkingSetSize')
else
- handle = io.popen('ps -o rss= -p '..self.pid)
+ handle = io.popen('ps -o rss= -p ' .. self.pid)
end
return tonumber(handle:read('*a'):match('%d+'))
end,
@@ -49,7 +52,7 @@ local monitor_memory_usage = {
table.insert(self.hist, val)
ok(#self.hist > 20)
local result = {}
- for key,value in ipairs(self.hist) do
+ for key, value in ipairs(self.hist) do
if value ~= self.hist[key + 1] then
table.insert(result, value)
end
@@ -60,7 +63,7 @@ local monitor_memory_usage = {
end)
end,
dump = function(self)
- return 'max: '..self.max ..', last: '..self.last
+ return 'max: ' .. self.max .. ', last: ' .. self.last
end,
monitor_memory_usage = function(self, pid)
local obj = {
@@ -72,12 +75,13 @@ local monitor_memory_usage = {
setmetatable(obj, { __index = self })
obj:op()
return obj
- end
+ end,
}
-setmetatable(monitor_memory_usage,
-{__call = function(self, pid)
- return monitor_memory_usage.monitor_memory_usage(self, pid)
-end})
+setmetatable(monitor_memory_usage, {
+ __call = function(self, pid)
+ return monitor_memory_usage.monitor_memory_usage(self, pid)
+ end,
+})
describe('memory usage', function()
local tmpfile = 'X_memory_usage'
@@ -101,46 +105,51 @@ describe('memory usage', function()
--[[
Case: if a local variable captures a:000, funccall object will be free
just after it finishes.
- ]]--
+ ]]
+ --
it('function capture vargs', function()
local pid = eval('getpid()')
local before = monitor_memory_usage(pid)
- write_file(tmpfile, [[
+ write_file(
+ tmpfile,
+ [[
func s:f(...)
let x = a:000
endfunc
for _ in range(10000)
call s:f(0)
endfor
- ]])
+ ]]
+ )
-- TODO: check_result fails if command() is used here. Why? #16064
- feed_command('source '..tmpfile)
+ feed_command('source ' .. tmpfile)
poke_eventloop()
local after = monitor_memory_usage(pid)
-- Estimate the limit of max usage as 2x initial usage.
-- The lower limit can fluctuate a bit, use 97%.
- check_result({before=before, after=after},
- pcall(ok, before.last * 97 / 100 < after.max))
- check_result({before=before, after=after},
- pcall(ok, before.last * 2 > after.max))
+ check_result({ before = before, after = after }, pcall(ok, before.last * 97 / 100 < after.max))
+ check_result({ before = before, after = after }, pcall(ok, before.last * 2 > after.max))
-- In this case, garbage collecting is not needed.
-- The value might fluctuate a bit, allow for 3% tolerance below and 5% above.
-- Based on various test runs.
local lower = after.last * 97 / 100
local upper = after.last * 105 / 100
- check_result({before=before, after=after}, pcall(ok, lower < after.max))
- check_result({before=before, after=after}, pcall(ok, after.max < upper))
+ check_result({ before = before, after = after }, pcall(ok, lower < after.max))
+ check_result({ before = before, after = after }, pcall(ok, after.max < upper))
end)
--[[
Case: if a local variable captures l: dict, funccall object will not be
free until garbage collector runs, but after that memory usage doesn't
increase so much even when rerun Xtest.vim since system memory caches.
- ]]--
+ ]]
+ --
it('function capture lvars', function()
local pid = eval('getpid()')
local before = monitor_memory_usage(pid)
- write_file(tmpfile, [[
+ write_file(
+ tmpfile,
+ [[
if !exists('s:defined_func')
func s:f()
let x = l:
@@ -150,13 +159,14 @@ describe('memory usage', function()
for _ in range(10000)
call s:f()
endfor
- ]])
- feed_command('source '..tmpfile)
+ ]]
+ )
+ feed_command('source ' .. tmpfile)
poke_eventloop()
local after = monitor_memory_usage(pid)
for _ = 1, 3 do
-- TODO: check_result fails if command() is used here. Why? #16064
- feed_command('source '..tmpfile)
+ feed_command('source ' .. tmpfile)
poke_eventloop()
end
local last = monitor_memory_usage(pid)
@@ -167,10 +177,8 @@ describe('memory usage', function()
local upper_multiplier = is_os('freebsd') and 19 or 12
local lower = before.last * 8 / 10
local upper = load_adjust((after.max + (after.last - before.last)) * upper_multiplier / 10)
- check_result({before=before, after=after, last=last},
- pcall(ok, lower < last.last))
- check_result({before=before, after=after, last=last},
- pcall(ok, last.last < upper))
+ check_result({ before = before, after = after, last = last }, pcall(ok, lower < last.last))
+ check_result({ before = before, after = after, last = last }, pcall(ok, last.last < upper))
end)
it('releases memory when closing windows when folds exist', function()
@@ -205,6 +213,6 @@ describe('memory usage', function()
-- but is small enough that if memory were not released (prior to PR #14884), the test
-- would fail.
local upper = before.last * 1.10
- check_result({before=before, after=after}, pcall(ok, after.last <= upper))
+ check_result({ before = before, after = after }, pcall(ok, after.last <= upper))
end)
end)
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua
index e0cc1dc79c..a87398b158 100644
--- a/test/functional/legacy/messages_spec.lua
+++ b/test/functional/legacy/messages_spec.lua
@@ -4,7 +4,7 @@ local clear = helpers.clear
local command = helpers.command
local exec = helpers.exec
local feed = helpers.feed
-local meths = helpers.meths
+local api = helpers.api
local nvim_dir = helpers.nvim_dir
local assert_alive = helpers.assert_alive
@@ -17,10 +17,10 @@ describe('messages', function()
it('a warning causes scrolling if and only if it has a stacktrace', function()
screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
- [2] = {bold = true, reverse = true}, -- MsgSeparator
- [3] = {foreground = Screen.colors.Red}, -- WarningMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
+ [2] = { bold = true, reverse = true }, -- MsgSeparator
+ [3] = { foreground = Screen.colors.Red }, -- WarningMsg
})
screen:attach()
@@ -32,20 +32,17 @@ describe('messages', function()
command('enew')
command('set readonly')
feed('u')
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{3:W10: Warning: Changing a readonly file}^ |
- ]], timeout = 500})
+ ]],
+ timeout = 500,
+ })
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
Already at oldest change |
]])
end)
@@ -54,8 +51,8 @@ describe('messages', function()
it('clearing mode does not remove message', function()
screen = Screen.new(60, 10)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach()
exec([[
@@ -74,12 +71,7 @@ describe('messages', function()
^one |
NoSuchFile |
three |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
from DebugSilent normal |
]])
@@ -89,12 +81,7 @@ describe('messages', function()
^one |
NoSuchFile |
three |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*6
from DebugSilent visual |
]])
@@ -105,11 +92,7 @@ describe('messages', function()
one |
NoSuchFil^e |
three |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
from DebugSilent visual |
{1:E447: Can't find file "NoSuchFile" in path} |
]])
@@ -124,8 +107,8 @@ describe('messages', function()
it('works', function()
screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
- [2] = {foreground = Screen.colors.Brown}, -- LineNr
+ [1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
+ [2] = { foreground = Screen.colors.Brown }, -- LineNr
})
screen:attach()
@@ -421,15 +404,15 @@ describe('messages', function()
it('verbose message before echo command', function()
screen = Screen.new(60, 10)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach()
- command('cd '..nvim_dir)
- meths.set_option_value('shell', './shell-test', {})
- meths.set_option_value('shellcmdflag', 'REP 20', {})
- meths.set_option_value('shellxquote', '', {}) -- win: avoid extra quotes
+ command('cd ' .. nvim_dir)
+ api.nvim_set_option_value('shell', './shell-test', {})
+ api.nvim_set_option_value('shellcmdflag', 'REP 20', {})
+ api.nvim_set_option_value('shellxquote', '', {}) -- win: avoid extra quotes
-- display a page and go back, results in exactly the same view
feed([[:4 verbose echo system('foo')<CR>]])
@@ -475,18 +458,10 @@ describe('messages', function()
-- do the same with 'cmdheight' set to 2
feed('q')
command('set ch=2')
- command('mode') -- FIXME: bottom is invalid after scrolling
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- |
+ {0:~ }|*7
+ |*2
]])
feed([[:4 verbose echo system('foo')<CR>]])
screen:expect([[
@@ -533,9 +508,9 @@ describe('messages', function()
it('with control characters can be quit vim-patch:8.2.1844', function()
screen = Screen.new(40, 10)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
- [2] = {foreground = Screen.colors.Blue}, -- SpecialKey
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
+ [2] = { foreground = Screen.colors.Blue }, -- SpecialKey
})
screen:attach()
@@ -555,14 +530,7 @@ describe('messages', function()
feed('q')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*8
|
]])
end)
@@ -572,9 +540,9 @@ describe('messages', function()
before_each(function()
screen = Screen.new(40, 6)
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [2] = {bold = true}, -- ModeMsg
- [3] = {bold = true, reverse=true}, -- StatusLine
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [2] = { bold = true }, -- ModeMsg
+ [3] = { bold = true, reverse = true }, -- StatusLine
})
screen:attach()
end)
@@ -591,18 +559,14 @@ describe('messages', function()
feed('i')
screen:expect([[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
{3: }|
{2:-- INSERT --} |
]])
feed('<C-C>')
screen:expect([[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
{3: }|
|
]])
@@ -617,18 +581,14 @@ describe('messages', function()
feed('i')
screen:expect([[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
{3:[No Name] }|
{2:-- INSERT --} |
]])
feed('<Esc>')
screen:expect([[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*3
{3:[No Name] }|
|
]])
@@ -639,19 +599,13 @@ describe('messages', function()
feed('i<C-O>')
screen:expect([[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*4
{2:-- (insert) --} |
]])
feed('<C-C>')
screen:expect([[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*4
|
]])
end)
@@ -661,9 +615,9 @@ describe('messages', function()
it('y/n prompt works', function()
screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
- [2] = {bold = true, reverse = true}, -- MsgSeparator
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
+ [2] = { bold = true, reverse = true }, -- MsgSeparator
})
screen:attach()
command('set noincsearch nohlsearch inccommand=')
@@ -673,18 +627,14 @@ describe('messages', function()
screen:expect([[
1 |
2 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}^ |
]])
feed('n')
screen:expect([[
^1 |
2 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}n |
]])
@@ -692,18 +642,14 @@ describe('messages', function()
screen:expect([[
1 |
2 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}^ |
]])
feed('<Esc>')
screen:expect([[
^1 |
2 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}n |
]])
@@ -711,18 +657,14 @@ describe('messages', function()
screen:expect([[
1 |
2 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}^ |
]])
feed('y')
screen:expect([[
y1 |
^y2 |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}y |
]])
end)
@@ -731,10 +673,10 @@ describe('messages', function()
it("fileinfo works when 'cmdheight' has just decreased", function()
screen = Screen.new(40, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}; -- NonText
- [1] = {bold = true}; -- TabLineSel
- [2] = {underline = true, background = Screen.colors.LightGrey}; -- TabLine
- [3] = {reverse = true}; -- TabLineFill
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true }, -- TabLineSel
+ [2] = { underline = true, background = Screen.colors.LightGrey }, -- TabLine
+ [3] = { reverse = true }, -- TabLineFill
})
screen:attach()
@@ -745,23 +687,18 @@ describe('messages', function()
tabnew
set cmdheight=2
]])
- command('mode') -- FIXME: bottom is invalid after scrolling
screen:expect([[
{2: [No Name] }{1: [No Name] }{3: }{2:X}|
^ |
- {0:~ }|
- {0:~ }|
- |
- |
+ {0:~ }|*2
+ |*2
]])
feed(':tabprev | edit Xfileinfo.txt<CR>')
screen:expect([[
{1: Xfileinfo.txt }{2: [No Name] }{3: }{2:X}|
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
"Xfileinfo.txt" [New] |
]])
assert_alive()
@@ -771,7 +708,7 @@ describe('messages', function()
it('fileinfo does not overwrite echo message vim-patch:8.2.4156', function()
screen = Screen.new(40, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
@@ -793,17 +730,9 @@ describe('messages', function()
feed('0$')
screen:expect([[
^hi |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
'b' written |
]])
os.remove('b.txt')
end)
-
- it('no crash when truncating overlong message', function()
- pcall(command, 'source test/old/testdir/crash/vim_msg_trunc_poc')
- assert_alive()
- end)
end)
diff --git a/test/functional/legacy/mksession_spec.lua b/test/functional/legacy/mksession_spec.lua
index bca9cd833c..689d918cd9 100644
--- a/test/functional/legacy/mksession_spec.lua
+++ b/test/functional/legacy/mksession_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
-local funcs = helpers.funcs
+local fn = helpers.fn
local eq = helpers.eq
describe('mksession', function()
@@ -18,7 +18,7 @@ describe('mksession', function()
command('mksession! Xtest_mks.out')
local found_rtp = 0
local found_pp = 0
- for _, line in pairs(funcs.readfile('Xtest_mks.out', 'b')) do
+ for _, line in pairs(fn.readfile('Xtest_mks.out', 'b')) do
if line:find('set runtimepath') then
found_rtp = found_rtp + 1
end
@@ -32,7 +32,7 @@ describe('mksession', function()
command('set sessionoptions+=skiprtp')
command('mksession! Xtest_mks.out')
local found_rtp_or_pp = 0
- for _, line in pairs(funcs.readfile('Xtest_mks.out', 'b')) do
+ for _, line in pairs(fn.readfile('Xtest_mks.out', 'b')) do
if line:find('set runtimepath') or line:find('set packpath') then
found_rtp_or_pp = found_rtp_or_pp + 1
end
diff --git a/test/functional/legacy/move_spec.lua b/test/functional/legacy/move_spec.lua
index 855996da8f..1500d48ad9 100644
--- a/test/functional/legacy/move_spec.lua
+++ b/test/functional/legacy/move_spec.lua
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local feed = helpers.feed
-local funcs = helpers.funcs
+local fn = helpers.fn
before_each(clear)
@@ -11,22 +11,18 @@ describe(':move', function()
it('redraws correctly when undone', function()
local screen = Screen.new(60, 10)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
- funcs.setline(1, {'First', 'Second', 'Third', 'Fourth'})
+ fn.setline(1, { 'First', 'Second', 'Third', 'Fourth' })
feed('gg:move +1<CR>')
screen:expect([[
Second |
^First |
Third |
Fourth |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
:move +1 |
]])
@@ -38,11 +34,7 @@ describe(':move', function()
Second |
Third |
Fourth |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*5
|
]])
end)
diff --git a/test/functional/legacy/normal_spec.lua b/test/functional/legacy/normal_spec.lua
index ba875460f5..1dddeed033 100644
--- a/test/functional/legacy/normal_spec.lua
+++ b/test/functional/legacy/normal_spec.lua
@@ -7,35 +7,29 @@ before_each(clear)
describe('normal', function()
-- oldtest: Test_normal_j_below_botline()
- it([["j" does not skip lines when scrolling below botline and 'foldmethod' is not "manual"]], function()
- local screen = Screen.new(40, 19)
- screen:attach()
- screen:set_default_attr_ids({{foreground = Screen.colors.Brown}})
- exec([[
+ it(
+ [["j" does not skip lines when scrolling below botline and 'foldmethod' is not "manual"]],
+ function()
+ local screen = Screen.new(40, 19)
+ screen:attach()
+ screen:set_default_attr_ids({ { foreground = Screen.colors.Brown } })
+ exec([[
set number foldmethod=diff scrolloff=0
call setline(1, map(range(1, 9), 'repeat(v:val, 200)'))
norm Lj
]])
- screen:expect([[
+ screen:expect([[
{1: 2 }222222222222222222222222222222222222|
- {1: }222222222222222222222222222222222222|
- {1: }222222222222222222222222222222222222|
- {1: }222222222222222222222222222222222222|
- {1: }222222222222222222222222222222222222|
+ {1: }222222222222222222222222222222222222|*4
{1: }22222222222222222222 |
{1: 3 }333333333333333333333333333333333333|
- {1: }333333333333333333333333333333333333|
- {1: }333333333333333333333333333333333333|
- {1: }333333333333333333333333333333333333|
- {1: }333333333333333333333333333333333333|
+ {1: }333333333333333333333333333333333333|*4
{1: }33333333333333333333 |
{1: 4 }^444444444444444444444444444444444444|
- {1: }444444444444444444444444444444444444|
- {1: }444444444444444444444444444444444444|
- {1: }444444444444444444444444444444444444|
- {1: }444444444444444444444444444444444444|
+ {1: }444444444444444444444444444444444444|*4
{1: }44444444444444444444 |
|
]])
- end)
+ end
+ )
end)
diff --git a/test/functional/legacy/number_spec.lua b/test/functional/legacy/number_spec.lua
new file mode 100644
index 0000000000..c112532eed
--- /dev/null
+++ b/test/functional/legacy/number_spec.lua
@@ -0,0 +1,306 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local command = helpers.command
+local exec = helpers.exec
+local feed = helpers.feed
+
+describe("'number' and 'relativenumber'", function()
+ before_each(clear)
+
+ -- oldtest: Test_relativenumber_colors()
+ it('LineNr, LineNrAbove and LineNrBelow', function()
+ local screen = Screen.new(50, 10)
+ screen:set_default_attr_ids({
+ [1] = { foreground = Screen.colors.Red },
+ [2] = { foreground = Screen.colors.Blue },
+ [3] = { foreground = Screen.colors.Green },
+ })
+ screen:attach()
+ exec([[
+ call setline(1, range(200))
+ 111
+ set number relativenumber
+ hi LineNr guifg=red
+ ]])
+ screen:expect([[
+ {1: 4 }106 |
+ {1: 3 }107 |
+ {1: 2 }108 |
+ {1: 1 }109 |
+ {1:111 }^110 |
+ {1: 1 }111 |
+ {1: 2 }112 |
+ {1: 3 }113 |
+ {1: 4 }114 |
+ |
+ ]])
+ command('hi LineNrAbove guifg=blue')
+ screen:expect([[
+ {2: 4 }106 |
+ {2: 3 }107 |
+ {2: 2 }108 |
+ {2: 1 }109 |
+ {1:111 }^110 |
+ {1: 1 }111 |
+ {1: 2 }112 |
+ {1: 3 }113 |
+ {1: 4 }114 |
+ |
+ ]])
+ command('hi LineNrBelow guifg=green')
+ screen:expect([[
+ {2: 4 }106 |
+ {2: 3 }107 |
+ {2: 2 }108 |
+ {2: 1 }109 |
+ {1:111 }^110 |
+ {3: 1 }111 |
+ {3: 2 }112 |
+ {3: 3 }113 |
+ {3: 4 }114 |
+ |
+ ]])
+ command('hi clear LineNrAbove')
+ screen:expect([[
+ {1: 4 }106 |
+ {1: 3 }107 |
+ {1: 2 }108 |
+ {1: 1 }109 |
+ {1:111 }^110 |
+ {3: 1 }111 |
+ {3: 2 }112 |
+ {3: 3 }113 |
+ {3: 4 }114 |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_relativenumber_colors_wrapped()
+ it('LineNr, LineNrAbove and LineNrBelow with wrapped lines', function()
+ local screen = Screen.new(50, 20)
+ screen:set_default_attr_ids({
+ [1] = { background = Screen.colors.Red, foreground = Screen.colors.Black },
+ [2] = { background = Screen.colors.Blue, foreground = Screen.colors.Black },
+ [3] = { background = Screen.colors.Green, foreground = Screen.colors.Black },
+ [4] = { bold = true, foreground = Screen.colors.Blue },
+ })
+ screen:attach()
+ exec([[
+ set display=lastline scrolloff=0
+ call setline(1, range(200)->map('v:val->string()->repeat(40)'))
+ 111
+ set number relativenumber
+ hi LineNr guibg=red guifg=black
+ hi LineNrAbove guibg=blue guifg=black
+ hi LineNrBelow guibg=green guifg=black
+ ]])
+ screen:expect([[
+ {2: 2 }1081081081081081081081081081081081081081081081|
+ {2: }0810810810810810810810810810810810810810810810|
+ {2: }8108108108108108108108108108 |
+ {2: 1 }1091091091091091091091091091091091091091091091|
+ {2: }0910910910910910910910910910910910910910910910|
+ {2: }9109109109109109109109109109 |
+ {1:111 }^1101101101101101101101101101101101101101101101|
+ {1: }1011011011011011011011011011011011011011011011|
+ {1: }0110110110110110110110110110 |
+ {3: 1 }1111111111111111111111111111111111111111111111|
+ {3: }1111111111111111111111111111111111111111111111|
+ {3: }1111111111111111111111111111 |
+ {3: 2 }1121121121121121121121121121121121121121121121|
+ {3: }1211211211211211211211211211211211211211211211|
+ {3: }2112112112112112112112112112 |
+ {3: 3 }1131131131131131131131131131131131131131131131|
+ {3: }1311311311311311311311311311311311311311311311|
+ {3: }3113113113113113113113113113 |
+ {3: 4 }1141141141141141141141141141141141141141141{4:@@@}|
+ |
+ ]])
+ feed('k')
+ screen:expect([[
+ {2: 1 }1081081081081081081081081081081081081081081081|
+ {2: }0810810810810810810810810810810810810810810810|
+ {2: }8108108108108108108108108108 |
+ {1:110 }^1091091091091091091091091091091091091091091091|
+ {1: }0910910910910910910910910910910910910910910910|
+ {1: }9109109109109109109109109109 |
+ {3: 1 }1101101101101101101101101101101101101101101101|
+ {3: }1011011011011011011011011011011011011011011011|
+ {3: }0110110110110110110110110110 |
+ {3: 2 }1111111111111111111111111111111111111111111111|
+ {3: }1111111111111111111111111111111111111111111111|
+ {3: }1111111111111111111111111111 |
+ {3: 3 }1121121121121121121121121121121121121121121121|
+ {3: }1211211211211211211211211211211211211211211211|
+ {3: }2112112112112112112112112112 |
+ {3: 4 }1131131131131131131131131131131131131131131131|
+ {3: }1311311311311311311311311311311311311311311311|
+ {3: }3113113113113113113113113113 |
+ {3: 5 }1141141141141141141141141141141141141141141{4:@@@}|
+ |
+ ]])
+ feed('2j')
+ screen:expect([[
+ {2: 3 }1081081081081081081081081081081081081081081081|
+ {2: }0810810810810810810810810810810810810810810810|
+ {2: }8108108108108108108108108108 |
+ {2: 2 }1091091091091091091091091091091091091091091091|
+ {2: }0910910910910910910910910910910910910910910910|
+ {2: }9109109109109109109109109109 |
+ {2: 1 }1101101101101101101101101101101101101101101101|
+ {2: }1011011011011011011011011011011011011011011011|
+ {2: }0110110110110110110110110110 |
+ {1:112 }^1111111111111111111111111111111111111111111111|
+ {1: }1111111111111111111111111111111111111111111111|
+ {1: }1111111111111111111111111111 |
+ {3: 1 }1121121121121121121121121121121121121121121121|
+ {3: }1211211211211211211211211211211211211211211211|
+ {3: }2112112112112112112112112112 |
+ {3: 2 }1131131131131131131131131131131131131131131131|
+ {3: }1311311311311311311311311311311311311311311311|
+ {3: }3113113113113113113113113113 |
+ {3: 3 }1141141141141141141141141141141141141141141{4:@@@}|
+ |
+ ]])
+ feed('2j')
+ screen:expect([[
+ {2: 5 }1081081081081081081081081081081081081081081081|
+ {2: }0810810810810810810810810810810810810810810810|
+ {2: }8108108108108108108108108108 |
+ {2: 4 }1091091091091091091091091091091091091091091091|
+ {2: }0910910910910910910910910910910910910910910910|
+ {2: }9109109109109109109109109109 |
+ {2: 3 }1101101101101101101101101101101101101101101101|
+ {2: }1011011011011011011011011011011011011011011011|
+ {2: }0110110110110110110110110110 |
+ {2: 2 }1111111111111111111111111111111111111111111111|
+ {2: }1111111111111111111111111111111111111111111111|
+ {2: }1111111111111111111111111111 |
+ {2: 1 }1121121121121121121121121121121121121121121121|
+ {2: }1211211211211211211211211211211211211211211211|
+ {2: }2112112112112112112112112112 |
+ {1:114 }^1131131131131131131131131131131131131131131131|
+ {1: }1311311311311311311311311311311311311311311311|
+ {1: }3113113113113113113113113113 |
+ {3: 1 }1141141141141141141141141141141141141141141{4:@@@}|
+ |
+ ]])
+ feed('k')
+ screen:expect([[
+ {2: 4 }1081081081081081081081081081081081081081081081|
+ {2: }0810810810810810810810810810810810810810810810|
+ {2: }8108108108108108108108108108 |
+ {2: 3 }1091091091091091091091091091091091091091091091|
+ {2: }0910910910910910910910910910910910910910910910|
+ {2: }9109109109109109109109109109 |
+ {2: 2 }1101101101101101101101101101101101101101101101|
+ {2: }1011011011011011011011011011011011011011011011|
+ {2: }0110110110110110110110110110 |
+ {2: 1 }1111111111111111111111111111111111111111111111|
+ {2: }1111111111111111111111111111111111111111111111|
+ {2: }1111111111111111111111111111 |
+ {1:113 }^1121121121121121121121121121121121121121121121|
+ {1: }1211211211211211211211211211211211211211211211|
+ {1: }2112112112112112112112112112 |
+ {3: 1 }1131131131131131131131131131131131131131131131|
+ {3: }1311311311311311311311311311311311311311311311|
+ {3: }3113113113113113113113113113 |
+ {3: 2 }1141141141141141141141141141141141141141141{4:@@@}|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_relativenumber_callback()
+ it('relative line numbers are updated if cursor is moved from timer', function()
+ local screen = Screen.new(50, 8)
+ screen:set_default_attr_ids({
+ [1] = { foreground = Screen.colors.Brown }, -- LineNr
+ [2] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
+ })
+ screen:attach()
+ exec([[
+ call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
+ set relativenumber
+ call cursor(4, 1)
+
+ func Func(timer)
+ call cursor(1, 1)
+ endfunc
+
+ call timer_start(300, 'Func')
+ ]])
+ screen:expect({
+ grid = [[
+ {1: 3 }aaaaa |
+ {1: 2 }bbbbb |
+ {1: 1 }ccccc |
+ {1: 0 }^ddddd |
+ {2:~ }|*3
+ |
+ ]],
+ timeout = 100,
+ })
+ screen:expect({
+ grid = [[
+ {1: 0 }^aaaaa |
+ {1: 1 }bbbbb |
+ {1: 2 }ccccc |
+ {1: 3 }ddddd |
+ {2:~ }|*3
+ |
+ ]],
+ })
+ end)
+
+ -- oldtest: Test_number_insert_delete_lines()
+ it('line numbers are updated when deleting/inserting lines', function()
+ local screen = Screen.new(50, 8)
+ screen:set_default_attr_ids({
+ [1] = { foreground = Screen.colors.Brown }, -- LineNr
+ [2] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
+ })
+ screen:attach()
+ exec([[
+ call setline(1, range(1, 7))
+ set number
+ call cursor(2, 1)
+ ]])
+ local snapshot1 = [[
+ {1: 1 }1 |
+ {1: 2 }^2 |
+ {1: 3 }3 |
+ {1: 4 }4 |
+ {1: 5 }5 |
+ {1: 6 }6 |
+ {1: 7 }7 |
+ |
+ ]]
+ screen:expect(snapshot1)
+ feed('dd')
+ screen:expect([[
+ {1: 1 }1 |
+ {1: 2 }^3 |
+ {1: 3 }4 |
+ {1: 4 }5 |
+ {1: 5 }6 |
+ {1: 6 }7 |
+ {2:~ }|
+ |
+ ]])
+ feed('P')
+ screen:expect(snapshot1)
+ feed('2dd')
+ screen:expect([[
+ {1: 1 }1 |
+ {1: 2 }^4 |
+ {1: 3 }5 |
+ {1: 4 }6 |
+ {1: 5 }7 |
+ {2:~ }|*2
+ |
+ ]])
+ feed('P')
+ screen:expect(snapshot1)
+ end)
+end)
diff --git a/test/functional/legacy/options_spec.lua b/test/functional/legacy/options_spec.lua
index ce46ea013d..2f20b6bd51 100644
--- a/test/functional/legacy/options_spec.lua
+++ b/test/functional/legacy/options_spec.lua
@@ -2,8 +2,8 @@
local helpers = require('test.functional.helpers')(after_each)
local command, clear = helpers.command, helpers.clear
local source, expect = helpers.source, helpers.expect
-local exc_exec = helpers.exc_exec;
-local matches = helpers.matches;
+local exc_exec = helpers.exc_exec
+local matches = helpers.matches
local Screen = require('test.functional.ui.screen')
describe('options', function()
@@ -66,17 +66,7 @@ describe('set', function()
command('verbose set scroll?')
screen:expect([[
|
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*11
|
scroll=7 |
Last set from changed window size |
diff --git a/test/functional/legacy/prompt_buffer_spec.lua b/test/functional/legacy/prompt_buffer_spec.lua
index 5c3f8a6f8c..e4810feedb 100644
--- a/test/functional/legacy/prompt_buffer_spec.lua
+++ b/test/functional/legacy/prompt_buffer_spec.lua
@@ -4,8 +4,9 @@ local feed = helpers.feed
local source = helpers.source
local clear = helpers.clear
local command = helpers.command
+local expect = helpers.expect
local poke_eventloop = helpers.poke_eventloop
-local meths = helpers.meths
+local api = helpers.api
local eq = helpers.eq
local neq = helpers.neq
@@ -57,14 +58,10 @@ describe('prompt buffer', function()
]])
screen:expect([[
cmd: ^ |
- ~ |
- ~ |
- ~ |
+ ~ |*3
[Prompt] [+] |
other buffer |
- ~ |
- ~ |
- ~ |
+ ~ |*3
-- INSERT -- |
]])
end
@@ -76,7 +73,7 @@ describe('prompt buffer', function()
-- oldtest: Test_prompt_basic()
it('works', function()
source_script()
- feed("hello\n")
+ feed('hello\n')
screen:expect([[
cmd: hello |
Command: "hello" |
@@ -84,22 +81,13 @@ describe('prompt buffer', function()
cmd: ^ |
[Prompt] |
other buffer |
- ~ |
- ~ |
- ~ |
+ ~ |*3
-- INSERT -- |
]])
- feed("exit\n")
+ feed('exit\n')
screen:expect([[
^other buffer |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*8
|
]])
end)
@@ -107,69 +95,46 @@ describe('prompt buffer', function()
-- oldtest: Test_prompt_editing()
it('editing', function()
source_script()
- feed("hello<BS><BS>")
+ feed('hello<BS><BS>')
screen:expect([[
cmd: hel^ |
- ~ |
- ~ |
- ~ |
+ ~ |*3
[Prompt] [+] |
other buffer |
- ~ |
- ~ |
- ~ |
+ ~ |*3
-- INSERT -- |
]])
- feed("<Left><Left><Left><BS>-")
+ feed('<Left><Left><Left><BS>-')
screen:expect([[
cmd: -^hel |
- ~ |
- ~ |
- ~ |
+ ~ |*3
[Prompt] [+] |
other buffer |
- ~ |
- ~ |
- ~ |
+ ~ |*3
-- INSERT -- |
]])
- feed("<C-O>lz")
+ feed('<C-O>lz')
screen:expect([[
cmd: -hz^el |
- ~ |
- ~ |
- ~ |
+ ~ |*3
[Prompt] [+] |
other buffer |
- ~ |
- ~ |
- ~ |
+ ~ |*3
-- INSERT -- |
]])
- feed("<End>x")
+ feed('<End>x')
screen:expect([[
cmd: -hzelx^ |
- ~ |
- ~ |
- ~ |
+ ~ |*3
[Prompt] [+] |
other buffer |
- ~ |
- ~ |
- ~ |
+ ~ |*3
-- INSERT -- |
]])
- feed("<C-U>exit\n")
+ feed('<C-U>exit\n')
screen:expect([[
^other buffer |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*8
|
]])
end)
@@ -177,43 +142,33 @@ describe('prompt buffer', function()
-- oldtest: Test_prompt_switch_windows()
it('switch windows', function()
source_script()
- feed("<C-O>:call SwitchWindows()<CR>")
- screen:expect{grid=[[
+ feed('<C-O>:call SwitchWindows()<CR>')
+ screen:expect {
+ grid = [[
cmd: |
- ~ |
- ~ |
- ~ |
+ ~ |*3
[Prompt] [+] |
^other buffer |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
- ]]}
- feed("<C-O>:call SwitchWindows()<CR>")
+ ]],
+ }
+ feed('<C-O>:call SwitchWindows()<CR>')
screen:expect([[
cmd: ^ |
- ~ |
- ~ |
- ~ |
+ ~ |*3
[Prompt] [+] |
other buffer |
- ~ |
- ~ |
- ~ |
+ ~ |*3
-- INSERT -- |
]])
- feed("<Esc>")
+ feed('<Esc>')
screen:expect([[
cmd:^ |
- ~ |
- ~ |
- ~ |
+ ~ |*3
[Prompt] [+] |
other buffer |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
]])
end)
@@ -226,12 +181,12 @@ describe('prompt buffer', function()
call timer_start(0, {-> nvim_buf_set_lines(s:buf, -1, -1, 0, ['walrus'])})
]]
poke_eventloop()
- eq({ mode = 'i', blocking = false }, meths.get_mode())
+ eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
end)
-- oldtest: Test_prompt_appending_while_hidden()
it('accessing hidden prompt buffer does not start insert mode', function()
- local prev_win = meths.get_current_win()
+ local prev_win = api.nvim_get_current_win()
source([[
new prompt
set buftype=prompt
@@ -251,16 +206,48 @@ describe('prompt buffer', function()
endfunc
]])
feed('asomething<CR>')
- eq('something', meths.get_var('entered'))
- neq(prev_win, meths.get_current_win())
+ eq('something', api.nvim_get_var('entered'))
+ neq(prev_win, api.nvim_get_current_win())
feed('exit<CR>')
- eq(prev_win, meths.get_current_win())
- eq({ mode = 'n', blocking = false }, meths.get_mode())
+ eq(prev_win, api.nvim_get_current_win())
+ eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
command('call DoAppend()')
- eq({ mode = 'n', blocking = false }, meths.get_mode())
+ eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
feed('i')
- eq({ mode = 'i', blocking = false }, meths.get_mode())
+ eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
command('call DoAppend()')
- eq({ mode = 'i', blocking = false }, meths.get_mode())
+ eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
+ end)
+
+ -- oldtest: Test_prompt_leave_modify_hidden()
+ it('modifying hidden buffer does not prevent prompt buffer mode change', function()
+ source([[
+ file hidden
+ set bufhidden=hide
+ enew
+ new prompt
+ set buftype=prompt
+
+ inoremap <buffer> w <Cmd>wincmd w<CR>
+ inoremap <buffer> q <Cmd>bwipe!<CR>
+ autocmd BufLeave prompt call appendbufline('hidden', '$', 'Leave')
+ autocmd BufEnter prompt call appendbufline('hidden', '$', 'Enter')
+ autocmd BufWinLeave prompt call appendbufline('hidden', '$', 'Close')
+ ]])
+ feed('a')
+ eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
+ feed('w')
+ eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
+ feed('<C-W>w')
+ eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
+ feed('q')
+ eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
+ command('bwipe!')
+ expect([[
+
+ Leave
+ Enter
+ Leave
+ Close]])
end)
end)
diff --git a/test/functional/legacy/put_spec.lua b/test/functional/legacy/put_spec.lua
index 4a42a1c8a3..c78946d690 100644
--- a/test/functional/legacy/put_spec.lua
+++ b/test/functional/legacy/put_spec.lua
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local exec_lua = helpers.exec_lua
-local meths = helpers.meths
+local api = helpers.api
local source = helpers.source
local eq = helpers.eq
@@ -15,7 +15,9 @@ end
describe('put', function()
before_each(clear)
- after_each(function() eq({}, meths.get_vvar('errors')) end)
+ after_each(function()
+ eq({}, api.nvim_get_vvar('errors'))
+ end)
it('very large count 64-bit', function()
if sizeoflong() < 8 then
@@ -64,8 +66,7 @@ describe('put', function()
three more text │ three more text |
^four more text │ four more text |
│ |
- ~ │~ |
- ~ │~ |
+ ~ │~ |*2
[No Name] [+] [No Name] [+] |
|
]])
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
index 8ac1141c2b..8d22c299d6 100644
--- a/test/functional/legacy/scroll_opt_spec.lua
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -23,9 +23,9 @@ describe('smoothscroll', function()
set number
]])
feed('<C-Y>')
- screen:expect({any = " 1 ^one"})
+ screen:expect({ any = ' 1 ^one' })
feed('<C-E><C-E><C-E>')
- screen:expect({any = " 2 ^two"})
+ screen:expect({ any = ' 2 ^two' })
end)
-- oldtest: Test_smoothscroll_CtrlE_CtrlY()
@@ -36,17 +36,14 @@ describe('smoothscroll', function()
:5
]])
local s1 = [[
- word word word word word word word word |
- word word word word word word word word |
+ word word word word word word word word |*2
word word word word |
line three |
long word long word long word long word |
long word long word long word |
^line |
- line |
- line |
- ~ |
- ~ |
+ line |*2
+ ~ |*2
|
]]
local s2 = [[
@@ -56,11 +53,8 @@ describe('smoothscroll', function()
long word long word long word long word |
long word long word long word |
^line |
- line |
- line |
- ~ |
- ~ |
- ~ |
+ line |*2
+ ~ |*3
|
]]
local s3 = [[
@@ -69,26 +63,17 @@ describe('smoothscroll', function()
long word long word long word long word |
long word long word long word |
^line |
- line |
- line |
- ~ |
- ~ |
- ~ |
- ~ |
+ line |*2
+ ~ |*4
|
]]
local s4 = [[
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*5
|
]]
local s5 = [[
@@ -96,13 +81,9 @@ describe('smoothscroll', function()
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]]
local s6 = [[
@@ -111,38 +92,30 @@ describe('smoothscroll', function()
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
]]
local s7 = [[
- word word word word word word word word |
- word word word word word word word word |
+ word word word word word word word word |*2
word word word word |
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
- ~ |
- ~ |
+ ~ |*2
|
]]
local s8 = [[
line one |
- word word word word word word word word |
- word word word word word word word word |
+ word word word word word word word word |*2
word word word word |
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
~ |
|
@@ -187,8 +160,7 @@ describe('smoothscroll', function()
ϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛ^ϛϛϛϛϛ|
ϛϛϛϛϛ |
222222222222222222222222222222222222 |
- ~ |
- ~ |
+ ~ |*2
|
]])
end)
@@ -217,9 +189,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
]])
feed('<C-E>')
@@ -231,10 +201,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
feed('<C-E>')
@@ -245,11 +212,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*5
|
]])
exec('set cpo-=n')
@@ -261,10 +224,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
feed('<C-Y>')
@@ -277,9 +237,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
]])
feed('<C-Y>')
@@ -293,8 +251,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
+ ~ |*2
|
]])
exec('botright split')
@@ -351,18 +308,13 @@ describe('smoothscroll', function()
y long text very long text very long|
text very long text very long text |
1 three |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*6
--No lines in buffer-- |
]])
end)
-- oldtest: Test_smoothscroll_list()
- it("works with list mode", function()
+ it('works with list mode', function()
screen:try_resize(40, 8)
exec([[
set smoothscroll scrolloff=0
@@ -376,8 +328,7 @@ describe('smoothscroll', function()
very long text very long text very long |
text very long text- |
three |
- ~ |
- ~ |
+ ~ |*2
|
]])
exec('set listchars+=precedes:#')
@@ -387,14 +338,13 @@ describe('smoothscroll', function()
very long text very long text very long |
text very long text- |
three |
- ~ |
- ~ |
+ ~ |*2
|
]])
end)
-- oldtest: Test_smoothscroll_diff_mode()
- it("works with diff mode", function()
+ it('works with diff mode', function()
screen:try_resize(40, 8)
exec([[
let text = 'just some text here'
@@ -408,8 +358,7 @@ describe('smoothscroll', function()
]])
screen:expect([[
- ^just some text here |
- ~ |
- ~ |
+ ~ |*2
[No Name] [+] |
- just some text here |
~ |
@@ -476,7 +425,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_wrap_long_line()
- it("adjusts the cursor position in a long line", function()
+ it('adjusts the cursor position in a long line', function()
screen:try_resize(40, 6)
exec([[
call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30)) .. ' end', 'four'])
@@ -580,10 +529,7 @@ describe('smoothscroll', function()
feed('zt')
screen:expect([[
^four |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
feed('zz')
@@ -591,8 +537,7 @@ describe('smoothscroll', function()
<<<of text with lots of text with lots o|
f text with lots of text end |
^four |
- ~ |
- ~ |
+ ~ |*2
|
]])
feed('zb')
@@ -608,7 +553,9 @@ describe('smoothscroll', function()
-- This time, use a shorter long line that is barely long enough to span more
-- than one window. Note that the cursor is at the bottom this time because
-- Vim prefers to do so if we are scrolling a few lines only.
- exec("call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])")
+ exec(
+ "call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])"
+ )
-- Currently visible lines were replaced, test that the lines and cursor
-- are correctly displayed.
screen:expect_unchanged()
@@ -630,7 +577,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_one_long_line()
- it("scrolls correctly when moving the cursor", function()
+ it('scrolls correctly when moving the cursor', function()
screen:try_resize(40, 6)
exec([[
call setline(1, 'with lots of text '->repeat(7))
@@ -650,8 +597,7 @@ describe('smoothscroll', function()
<<<ts of text with lots of text with lot|
^s of text with lots of text with lots of|
text |
- ~ |
- ~ |
+ ~ |*2
|
]])
feed('0')
@@ -659,7 +605,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_long_line_showbreak()
- it("cursor is not one screen line too far down", function()
+ it('cursor is not one screen line too far down', function()
screen:try_resize(40, 6)
-- a line that spans four screen lines
exec("call setline(1, 'with lots of text in one line '->repeat(6))")
@@ -696,28 +642,23 @@ describe('smoothscroll', function()
screen:expect([[
^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
口口口口口口口口口口 |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
]])
feed('<C-E>')
screen:expect([[
<<< 口口口口口口口^口 |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
end)
-- oldtest: Test_smoothscroll_zero_width()
- it("does not divide by zero with a narrow window", function()
+ it('does not divide by zero with a narrow window', function()
screen:try_resize(12, 2)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Brown},
- [2] = {foreground = Screen.colors.Blue1, bold = true},
+ [1] = { foreground = Screen.colors.Brown },
+ [2] = { foreground = Screen.colors.Blue1, bold = true },
})
exec([[
call setline(1, ['a'->repeat(100)])
@@ -739,7 +680,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_ins_lines()
- it("does not unnecessarily insert lines", function()
+ it('does not unnecessarily insert lines', function()
screen:try_resize(40, 6)
exec([=[
set wrap smoothscroll scrolloff=0 conceallevel=2 concealcursor=nc
@@ -763,7 +704,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_cursormoved_line()
- it("does not place the cursor in the command line", function()
+ it('does not place the cursor in the command line', function()
screen:try_resize(40, 6)
exec([=[
set smoothscroll
@@ -786,7 +727,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_eob()
- it("does not scroll halfway at end of buffer", function()
+ it('does not scroll halfway at end of buffer', function()
screen:try_resize(40, 10)
exec([[
set smoothscroll
@@ -795,14 +736,7 @@ describe('smoothscroll', function()
]])
-- does not scroll halfway when scrolling to end of buffer
screen:expect([[
- |
- |
- |
- |
- |
- |
- |
- |
+ |*8
^ |
|
]])
@@ -811,26 +745,20 @@ describe('smoothscroll', function()
-- cursor is not placed below window
screen:expect([[
<<<aaaaaaaaaaaaaaaaa |
- |
- |
- |
- |
- |
- |
- |
+ |*7
^ |
|
]])
end)
-- oldtest: Test_smoothscroll_incsearch()
- it("does not reset skipcol when doing incremental search on the same word", function()
+ it('does not reset skipcol when doing incremental search on the same word', function()
screen:try_resize(40, 8)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Brown},
- [2] = {foreground = Screen.colors.Blue1, bold = true},
- [3] = {background = Screen.colors.Yellow1},
- [4] = {reverse = true},
+ [1] = { foreground = Screen.colors.Brown },
+ [2] = { foreground = Screen.colors.Blue1, bold = true },
+ [3] = { background = Screen.colors.Yellow1 },
+ [4] = { reverse = true },
})
exec([[
set smoothscroll number scrolloff=0 incsearch
@@ -888,8 +816,8 @@ describe('smoothscroll', function()
it('scrolling multiple lines and stopping at non-zero skipcol', function()
screen:try_resize(40, 10)
screen:set_default_attr_ids({
- [0] = {foreground = Screen.colors.Blue, bold = true},
- [1] = {background = Screen.colors.Grey90},
+ [0] = { foreground = Screen.colors.Blue, bold = true },
+ [1] = { background = Screen.colors.Grey90 },
})
exec([[
setlocal cursorline scrolloff=0 smoothscroll
@@ -907,8 +835,7 @@ describe('smoothscroll', function()
aaaaaaaaaa |
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaa |
- |
- |
+ |*2
bbb |
|
]])
@@ -917,25 +844,19 @@ describe('smoothscroll', function()
{0:<<<}{1:aaaaaa^a }|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaa |
- |
- |
+ |*2
bbb |
ccc |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
feed('2<C-E>')
screen:expect([[
{0:<<<}{1:aaaaaa^a }|
- |
- |
+ |*2
bbb |
ccc |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
|
]])
end)
@@ -944,10 +865,10 @@ describe('smoothscroll', function()
it('does not divide by zero in zero-width window', function()
screen:try_resize(40, 19)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Brown}; -- LineNr
- [2] = {bold = true, foreground = Screen.colors.Blue}; -- NonText
- [3] = {bold = true, reverse = true}; -- StatusLine
- [4] = {reverse = true}; -- StatusLineNC
+ [1] = { foreground = Screen.colors.Brown }, -- LineNr
+ [2] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [3] = { bold = true, reverse = true }, -- StatusLine
+ [4] = { reverse = true }, -- StatusLineNC
})
exec([[
silent normal yy
@@ -962,21 +883,7 @@ describe('smoothscroll', function()
]])
screen:expect([[
{1: }│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
+ {2:@}│ |*15
{2:^@}│ |
{3:< }{4:[No Name] [+] }|
|
@@ -1001,8 +908,7 @@ describe('smoothscroll', function()
line3line3line3line3line3line3line3line3|
line3line3line3line3 |
line4 |
- ~ |
- ~ |
+ ~ |*2
[No Name] [+] |
|
]])
@@ -1023,7 +929,7 @@ describe('smoothscroll', function()
assert_alive()
end)
- it("works with virt_lines above and below", function()
+ it('works with virt_lines above and below', function()
screen:try_resize(55, 7)
exec([=[
call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(3))
@@ -1096,6 +1002,22 @@ describe('smoothscroll', function()
]])
end)
+ it('works in Insert mode at bottom of window', function()
+ screen:try_resize(40, 9)
+ exec([[
+ call setline(1, repeat([repeat('A very long line ...', 10)], 5))
+ set wrap smoothscroll scrolloff=0
+ ]])
+ feed('Go123456789<CR>')
+ screen:expect([[
+ <<<ery long line ...A very long line ...|
+ A very long line ...A very long line ...|*5
+ 123456789 |
+ ^ |
+ -- INSERT -- |
+ ]])
+ end)
+
it('<<< marker shows with tabline, winbar and splits', function()
screen:try_resize(40, 12)
exec([[
@@ -1153,8 +1075,8 @@ describe('smoothscroll', function()
it('works with very long line', function()
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Brown},
- [2] = {foreground = Screen.colors.Blue1, bold = true},
+ [1] = { foreground = Screen.colors.Brown },
+ [2] = { foreground = Screen.colors.Blue1, bold = true },
})
exec([[
edit test/functional/fixtures/bigfile_oneline.txt
diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua
index 25620f5262..2fda341123 100644
--- a/test/functional/legacy/search_spec.lua
+++ b/test/functional/legacy/search_spec.lua
@@ -5,7 +5,7 @@ local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
-local funcs = helpers.funcs
+local fn = helpers.fn
local poke_eventloop = helpers.poke_eventloop
local exec = helpers.exec
@@ -18,7 +18,7 @@ describe('search cmdline', function()
screen = Screen.new(20, 3)
screen:attach()
screen:set_default_attr_ids({
- inc = {reverse = true},
+ inc = { reverse = true },
err = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
more = { bold = true, foreground = Screen.colors.SeaGreen4 },
tilde = { bold = true, foreground = Screen.colors.Blue1 },
@@ -27,9 +27,17 @@ describe('search cmdline', function()
end)
local function tenlines()
- funcs.setline(1, {
- ' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there',
- ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar'
+ fn.setline(1, {
+ ' 1',
+ ' 2 these',
+ ' 3 the',
+ ' 4 their',
+ ' 5 there',
+ ' 6 their',
+ ' 7 the',
+ ' 8 them',
+ ' 9 these',
+ ' 10 foobar',
})
command('1')
end
@@ -47,7 +55,7 @@ describe('search cmdline', function()
describe('can traverse matches', function()
before_each(tenlines)
local function forwarditer(wrapscan)
- command('set incsearch '..wrapscan)
+ command('set incsearch ' .. wrapscan)
feed('/the')
screen:expect([[
1 |
@@ -60,7 +68,7 @@ describe('search cmdline', function()
3 {inc:the} |
/the^ |
]])
- eq({0, 0, 0, 0}, funcs.getpos('"'))
+ eq({ 0, 0, 0, 0 }, fn.getpos('"'))
feed('<C-G>')
screen:expect([[
3 the |
@@ -106,20 +114,23 @@ describe('search cmdline', function()
/the^ |
]])
else
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
8 them |
9 {inc:the}se |
/the^ |
- ]], condition=function()
- eq(true, screen.bell)
- end}
+ ]],
+ condition = function()
+ eq(true, screen.bell)
+ end,
+ }
feed('<CR>')
- eq({0, 0, 0, 0}, funcs.getpos('"'))
+ eq({ 0, 0, 0, 0 }, fn.getpos('"'))
end
end
local function backiter(wrapscan)
- command('set incsearch '..wrapscan)
+ command('set incsearch ' .. wrapscan)
command('$')
feed('?the')
@@ -144,13 +155,16 @@ describe('search cmdline', function()
]])
else
feed('<C-G>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
9 {inc:the}se |
10 foobar |
?the^ |
- ]], condition=function()
- eq(true, screen.bell)
- end}
+ ]],
+ condition = function()
+ eq(true, screen.bell)
+ end,
+ }
feed('<CR>')
screen:expect([[
9 ^these |
@@ -193,13 +207,16 @@ describe('search cmdline', function()
?the^ |
]])
else
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
2 {inc:the}se |
3 the |
?the^ |
- ]], condition=function()
- eq(true, screen.bell)
- end}
+ ]],
+ condition = function()
+ eq(true, screen.bell)
+ end,
+ }
end
end
@@ -351,7 +368,7 @@ describe('search cmdline', function()
end)
it('can traverse matches in the same line with <C-G>/<C-T>', function()
- funcs.setline(1, { ' 1', ' 2 these', ' 3 the theother' })
+ fn.setline(1, { ' 1', ' 2 these', ' 3 the theother' })
command('1')
command('set incsearch')
@@ -439,9 +456,16 @@ describe('search cmdline', function()
10 ^foobar |
/fo |
]])
- eq({lnum = 10, leftcol = 0, col = 4, topfill = 0, topline = 6,
- coladd = 0, skipcol = 0, curswant = 4},
- funcs.winsaveview())
+ eq({
+ lnum = 10,
+ leftcol = 0,
+ col = 4,
+ topfill = 0,
+ topline = 6,
+ coladd = 0,
+ skipcol = 0,
+ curswant = 4,
+ }, fn.winsaveview())
end)
it('restores original view after failed search', function()
@@ -467,16 +491,23 @@ describe('search cmdline', function()
{more:Press ENTER or type command to continue}^ |
]])
feed('<CR>')
- eq({lnum = 1, leftcol = 0, col = 0, topfill = 0, topline = 1,
- coladd = 0, skipcol = 0, curswant = 0},
- funcs.winsaveview())
+ eq({
+ lnum = 1,
+ leftcol = 0,
+ col = 0,
+ topfill = 0,
+ topline = 1,
+ coladd = 0,
+ skipcol = 0,
+ curswant = 0,
+ }, fn.winsaveview())
end)
-- oldtest: Test_search_cmdline4().
it("CTRL-G with 'incsearch' and ? goes in the right direction", function()
screen:try_resize(40, 4)
command('enew!')
- funcs.setline(1, {' 1 the first', ' 2 the second', ' 3 the third'})
+ fn.setline(1, { ' 1 the first', ' 2 the second', ' 3 the third' })
command('set laststatus=0 shortmess+=s')
command('set incsearch')
command('$')
@@ -577,7 +608,7 @@ describe('search cmdline', function()
it('incsearch works with :sort', function()
screen:try_resize(20, 4)
command('set incsearch hlsearch scrolloff=0')
- funcs.setline(1, {'another one 2', 'that one 3', 'the one 1'})
+ fn.setline(1, { 'another one 2', 'that one 3', 'the one 1' })
feed(':sort ni u /on')
screen:expect([[
@@ -593,7 +624,7 @@ describe('search cmdline', function()
it('incsearch works with :vimgrep family', function()
screen:try_resize(30, 4)
command('set incsearch hlsearch scrolloff=0')
- funcs.setline(1, {'another one 2', 'that one 3', 'the one 1'})
+ fn.setline(1, { 'another one 2', 'that one 3', 'the one 1' })
feed(':vimgrep on')
screen:expect([[
@@ -688,27 +719,18 @@ describe('search cmdline', function()
local s = [[
{tilde:<<<} 18 19 20 21 22 2|
^3 24 |
- |
- |
- |
- |
+ |*4
]]
screen:expect(s)
feed('/xx')
screen:expect([[
- |
- |
- |
- |
+ |*4
{inc:xx}x |
/xx^ |
]])
feed('x')
screen:expect([[
- |
- |
- |
- |
+ |*4
{inc:xxx} |
/xxx^ |
]])
@@ -724,9 +746,9 @@ describe('Search highlight', function()
it('beyond line end vim-patch:8.2.2542', function()
local screen = Screen.new(50, 6)
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [2] = {background = Screen.colors.Yellow}, -- Search
- [3] = {background = Screen.colors.Grey90}, -- CursorLine
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [2] = { background = Screen.colors.Yellow }, -- Search
+ [3] = { background = Screen.colors.Grey90 }, -- CursorLine
})
screen:attach()
exec([[
@@ -737,11 +759,9 @@ describe('Search highlight', function()
]])
feed([[/\_.*<CR>]])
screen:expect([[
- {2:xxx } |
- {2:xxx } |
+ {2:xxx } |*2
{2:^xxx }{3: }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*2
/\_.* |
]])
end)
@@ -750,11 +770,11 @@ describe('Search highlight', function()
it('is combined with Visual highlight vim-patch:8.2.2797', function()
local screen = Screen.new(40, 6)
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [2] = {bold = true}, -- ModeMsg, Search
- [3] = {background = Screen.colors.LightGrey}, -- Visual
- [4] = {background = Screen.colors.Yellow, bold = true}, -- Search
- [5] = {background = Screen.colors.LightGrey, bold = true}, -- Visual + Search
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [2] = { bold = true }, -- ModeMsg, Search
+ [3] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
+ [4] = { background = Screen.colors.Yellow, bold = true }, -- Search
+ [5] = { background = Screen.colors.LightGrey, bold = true, foreground = Screen.colors.Black },
})
screen:attach()
exec([[
@@ -769,8 +789,7 @@ describe('Search highlight', function()
xxx {4:y}{5:yy}{3: zzz} |
{3:xxx }{5:yyy}{3: zzz} |
{3:xxx }{5:y}{4:^yy} zzz |
- {1:~ }|
- {1:~ }|
+ {1:~ }|*2
{2:-- VISUAL --} |
]])
end)
diff --git a/test/functional/legacy/search_stat_spec.lua b/test/functional/legacy/search_stat_spec.lua
index bd5ab68e5c..378060d316 100644
--- a/test/functional/legacy/search_stat_spec.lua
+++ b/test/functional/legacy/search_stat_spec.lua
@@ -8,11 +8,11 @@ describe('search stat', function()
clear()
screen = Screen.new(30, 10)
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [2] = {background = Screen.colors.Yellow}, -- Search
- [3] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}, -- Folded
- [4] = {reverse = true}, -- IncSearch, TabLineFill
- [5] = {foreground = Screen.colors.Red}, -- WarningMsg
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [2] = { background = Screen.colors.Yellow }, -- Search
+ [3] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey }, -- Folded
+ [4] = { reverse = true }, -- IncSearch, TabLineFill
+ [5] = { foreground = Screen.colors.Red }, -- WarningMsg
})
screen:attach()
end)
@@ -35,8 +35,7 @@ describe('search stat', function()
{2:^find this} |
fooooobar |
foba |
- foobar |
- foobar |
+ foobar |*2
foo |
fooooobar |
foba |
@@ -49,8 +48,7 @@ describe('search stat', function()
{2:^find this} |
fooooobar |
foba |
- foobar |
- foobar |
+ foobar |*2
foo |
fooooobar |
foba |
@@ -73,11 +71,7 @@ describe('search stat', function()
{3:^+-- 2 lines: foo·············}|
endif |
|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*5
/foo [1/2] |
]])
-- Note: there is an intermediate state where the search stat disappears.
@@ -99,12 +93,7 @@ describe('search stat', function()
int cat; |
int {2:^dog}; |
cat = {2:dog}; |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*6
/dog [1/2] |
]])
feed('G0gD')
@@ -112,12 +101,7 @@ describe('search stat', function()
int {2:^cat}; |
int dog; |
{2:cat} = dog; |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*6
|
]])
end)
@@ -148,11 +132,7 @@ describe('search stat', function()
{2:abc}--c |
--------{4:abc} |
--{2:abc} |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*5
/abc^ |
]])
@@ -162,11 +142,7 @@ describe('search stat', function()
{2:abc}--c |
--------{2:abc} |
--{4:abc} |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*5
/abc^ |
]])
@@ -176,11 +152,7 @@ describe('search stat', function()
{4:abc}--c |
--------{2:abc} |
--{2:abc} |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*5
/abc^ |
]])
end)
@@ -197,13 +169,7 @@ describe('search stat', function()
screen:expect([[
{2:^test} |
|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*7
/\<test\> [1/1] |
]])
@@ -211,13 +177,7 @@ describe('search stat', function()
screen:expect([[
{2:^test} |
|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*7
?\<test\> [1/1] |
]])
@@ -227,13 +187,7 @@ describe('search stat', function()
screen:expect([[
{2:^test} |
|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*7
{5:search hit TOP, continuing at BOTTOM} |
]])
end)
diff --git a/test/functional/legacy/source_spec.lua b/test/functional/legacy/source_spec.lua
index f31521607d..7a19541a77 100644
--- a/test/functional/legacy/source_spec.lua
+++ b/test/functional/legacy/source_spec.lua
@@ -9,22 +9,22 @@ before_each(clear)
describe(':source!', function()
-- oldtest: Test_nested_script()
it('gives E22 when scripts nested too deep', function()
- write_file('Xscript.vim', [[
+ write_file(
+ 'Xscript.vim',
+ [[
:source! Xscript.vim
- ]])
+ ]]
+ )
local screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach()
feed(':source! Xscript.vim\n')
screen:expect([[
^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{1:E22: Scripts nested too deep} |
]])
os.remove('Xscript.vim')
diff --git a/test/functional/legacy/statusline_spec.lua b/test/functional/legacy/statusline_spec.lua
index c5b17f8749..567e829879 100644
--- a/test/functional/legacy/statusline_spec.lua
+++ b/test/functional/legacy/statusline_spec.lua
@@ -16,9 +16,9 @@ describe('statusline', function()
it('is updated in cmdline mode when using window-local statusline vim-patch:8.2.2737', function()
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [2] = {bold = true, reverse = true}, -- StatusLine
- [3] = {reverse = true}, -- StatusLineNC
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [2] = { bold = true, reverse = true }, -- StatusLine
+ [3] = { reverse = true }, -- StatusLineNC
})
exec([[
setlocal statusline=-%{mode()}-
@@ -48,9 +48,9 @@ describe('statusline', function()
it('truncated item does not cause off-by-one highlight vim-patch:8.2.4929', function()
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [2] = {foreground = Screen.colors.Blue}, -- User1
- [3] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- User2
+ [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [2] = { foreground = Screen.colors.Blue }, -- User1
+ [3] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- User2
})
exec([[
set laststatus=2
@@ -60,10 +60,7 @@ describe('statusline', function()
]])
screen:expect([[
^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {1:~ }|*4
{3:<F}{2:GHI }|
|
]])
@@ -72,11 +69,11 @@ describe('statusline', function()
-- oldtest: Test_statusline_showcmd()
it('showcmdloc=statusline works', function()
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.LightGrey}, -- Visual
- [2] = {bold = true}, -- MoreMsg
- [3] = {bold = true, reverse = true}, -- StatusLine
- [5] = {background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue}, -- Folded
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
+ [2] = { bold = true }, -- MoreMsg
+ [3] = { bold = true, reverse = true }, -- StatusLine
+ [5] = { background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue }, -- Folded
})
exec([[
func MyStatusLine()
@@ -97,9 +94,7 @@ describe('statusline', function()
screen:expect([[
{5:+-- 2 lines: a···································}|
^c |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{3:g }|
|
]])
@@ -110,8 +105,7 @@ describe('statusline', function()
^a |
b |
c |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3: }|
|
]])
@@ -121,8 +115,7 @@ describe('statusline', function()
{1:a} |
{1:b} |
{1:c}^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:3x2 }|
{2:-- VISUAL BLOCK --} |
]])
@@ -132,8 +125,7 @@ describe('statusline', function()
a |
b |
^c |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:1234 }|
|
]])
@@ -145,8 +137,7 @@ describe('statusline', function()
a |
b |
^c |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{3:[No Name] [+] 1234 }|
: |
]])
diff --git a/test/functional/legacy/substitute_spec.lua b/test/functional/legacy/substitute_spec.lua
index f3ce343680..b462c10202 100644
--- a/test/functional/legacy/substitute_spec.lua
+++ b/test/functional/legacy/substitute_spec.lua
@@ -20,9 +20,14 @@ describe('substitute()', function()
local function test_1_and_2()
eq('AA', eval("substitute('A', 'A', '&&', '')"))
eq('&', eval([[substitute('B', 'B', '\&', '')]]))
- eq('C123456789987654321', eval([[substitute('C123456789', ]] ..
- [['C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', ]] ..
- [['\0\9\8\7\6\5\4\3\2\1', '')]]))
+ eq(
+ 'C123456789987654321',
+ eval(
+ [[substitute('C123456789', ]]
+ .. [['C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', ]]
+ .. [['\0\9\8\7\6\5\4\3\2\1', '')]]
+ )
+ )
eq('d', eval("substitute('D', 'D', 'd', '')"))
eq('~', eval("substitute('E', 'E', '~', '')"))
eq('~', eval([[substitute('F', 'F', '\~', '')]]))
@@ -61,10 +66,9 @@ describe('substitute()', function()
feed_command('set magic&')
eq('a\\a', eval([[substitute('aAa', 'A', '\="\\"', '')]]))
eq('b\\\\b', eval([[substitute('bBb', 'B', '\="\\\\"', '')]]))
- eq('c\rc', eval([[substitute('cCc', 'C', '\="]]..'\r'..[["', '')]]))
- eq('d\\\rd', eval([[substitute('dDd', 'D', '\="\\]]..'\r'..[["', '')]]))
- eq('e\\\\\re',
- eval([[substitute('eEe', 'E', '\="\\\\]]..'\r'..[["', '')]]))
+ eq('c\rc', eval([[substitute('cCc', 'C', '\="]] .. '\r' .. [["', '')]]))
+ eq('d\\\rd', eval([[substitute('dDd', 'D', '\="\\]] .. '\r' .. [["', '')]]))
+ eq('e\\\\\re', eval([[substitute('eEe', 'E', '\="\\\\]] .. '\r' .. [["', '')]]))
eq('f\\rf', eval([[substitute('fFf', 'F', '\="\\r"', '')]]))
eq('j\\nj', eval([[substitute('jJj', 'J', '\="\\n"', '')]]))
eq('k\rk', eval([[substitute('kKk', 'K', '\="\r"', '')]]))
@@ -73,39 +77,81 @@ describe('substitute()', function()
it('with submatch() (TEST_4)', function()
feed_command('set magic&')
- eq('a\\a', eval([[substitute('aAa', 'A', ]] ..
- [['\=substitute(submatch(0), ".", "\\", "")', '')]]))
- eq('b\\b', eval([[substitute('bBb', 'B', ]] ..
- [['\=substitute(submatch(0), ".", "\\\\", "")', '')]]))
- eq('c\rc', eval([[substitute('cCc', 'C', ]] ..
- [['\=substitute(submatch(0), ".", "]]..'\r'..[[", "")', '')]]))
- eq('d\rd', eval([[substitute('dDd', 'D', ]] ..
- [['\=substitute(submatch(0), ".", "\\]]..'\r'..[[", "")', '')]]))
- eq('e\\\re', eval([[substitute('eEe', 'E', ]] ..
- [['\=substitute(submatch(0), ".", "\\\\]]..'\r'..[[", "")', '')]]))
- eq('f\rf', eval([[substitute('fFf', 'F', ]] ..
- [['\=substitute(submatch(0), ".", "\\r", "")', '')]]))
- eq('j\nj', eval([[substitute('jJj', 'J', ]] ..
- [['\=substitute(submatch(0), ".", "\\n", "")', '')]]))
- eq('k\rk', eval([[substitute('kKk', 'K', ]] ..
- [['\=substitute(submatch(0), ".", "\r", "")', '')]]))
- eq('l\nl', eval([[substitute('lLl', 'L', ]] ..
- [['\=substitute(submatch(0), ".", "\n", "")', '')]]))
+ eq(
+ 'a\\a',
+ eval([[substitute('aAa', 'A', ]] .. [['\=substitute(submatch(0), ".", "\\", "")', '')]])
+ )
+ eq(
+ 'b\\b',
+ eval([[substitute('bBb', 'B', ]] .. [['\=substitute(submatch(0), ".", "\\\\", "")', '')]])
+ )
+ eq(
+ 'c\rc',
+ eval(
+ [[substitute('cCc', 'C', ]]
+ .. [['\=substitute(submatch(0), ".", "]]
+ .. '\r'
+ .. [[", "")', '')]]
+ )
+ )
+ eq(
+ 'd\rd',
+ eval(
+ [[substitute('dDd', 'D', ]]
+ .. [['\=substitute(submatch(0), ".", "\\]]
+ .. '\r'
+ .. [[", "")', '')]]
+ )
+ )
+ eq(
+ 'e\\\re',
+ eval(
+ [[substitute('eEe', 'E', ]]
+ .. [['\=substitute(submatch(0), ".", "\\\\]]
+ .. '\r'
+ .. [[", "")', '')]]
+ )
+ )
+ eq(
+ 'f\rf',
+ eval([[substitute('fFf', 'F', ]] .. [['\=substitute(submatch(0), ".", "\\r", "")', '')]])
+ )
+ eq(
+ 'j\nj',
+ eval([[substitute('jJj', 'J', ]] .. [['\=substitute(submatch(0), ".", "\\n", "")', '')]])
+ )
+ eq(
+ 'k\rk',
+ eval([[substitute('kKk', 'K', ]] .. [['\=substitute(submatch(0), ".", "\r", "")', '')]])
+ )
+ eq(
+ 'l\nl',
+ eval([[substitute('lLl', 'L', ]] .. [['\=substitute(submatch(0), ".", "\n", "")', '')]])
+ )
end)
it('with submatch() (TEST_5)', function()
feed_command('set magic&')
- eq('A123456789987654321', eval([[substitute('A123456789', ]] ..
- [['A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', ]] ..
- [['\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . ]] ..
- [[submatch(6) . submatch(5) . submatch(4) . submatch(3) . ]] ..
- [[submatch(2) . submatch(1)', '')]]))
- eq("[['A123456789'], ['9'], ['8'], ['7'], ['6'], ['5'], ['4'], ['3'], " ..
- "['2'], ['1']]", eval([[substitute('A123456789', ]] ..
- [['A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', ]] ..
- [['\=string([submatch(0, 1), submatch(9, 1), submatch(8, 1), ]] ..
- [[submatch(7, 1), submatch(6, 1), submatch(5, 1), submatch(4, 1), ]] ..
- [[submatch(3, 1), submatch(2, 1), submatch(1, 1)])', '')]]))
+ eq(
+ 'A123456789987654321',
+ eval(
+ [[substitute('A123456789', ]]
+ .. [['A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', ]]
+ .. [['\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . ]]
+ .. [[submatch(6) . submatch(5) . submatch(4) . submatch(3) . ]]
+ .. [[submatch(2) . submatch(1)', '')]]
+ )
+ )
+ eq(
+ "[['A123456789'], ['9'], ['8'], ['7'], ['6'], ['5'], ['4'], ['3'], " .. "['2'], ['1']]",
+ eval(
+ [[substitute('A123456789', ]]
+ .. [['A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', ]]
+ .. [['\=string([submatch(0, 1), submatch(9, 1), submatch(8, 1), ]]
+ .. [[submatch(7, 1), submatch(6, 1), submatch(5, 1), submatch(4, 1), ]]
+ .. [[submatch(3, 1), submatch(2, 1), submatch(1, 1)])', '')]]
+ )
+ )
end)
-- TEST_6 was about the 'cpoptions' flag / which was removed in pull request
@@ -115,8 +161,7 @@ describe('substitute()', function()
feed_command('set magic&')
eq('A\rA', eval("substitute('A\rA', 'A.', '\\=submatch(0)', '')"))
eq('B\nB', eval([[substitute("B\nB", 'B.', '\=submatch(0)', '')]]))
- eq("['B\n']B",
- eval([[substitute("B\nB", 'B.', '\=string(submatch(0, 1))', '')]]))
+ eq("['B\n']B", eval([[substitute("B\nB", 'B.', '\=string(submatch(0, 1))', '')]]))
eq('-abab', eval([[substitute('-bb', '\zeb', 'a', 'g')]]))
eq('c-cbcbc', eval([[substitute('-bb', '\ze', 'c', 'g')]]))
end)
@@ -145,9 +190,9 @@ describe(':substitute', function()
feed_command('set magic&')
feed_command([[1s/\(^\|,\)\ze\(,\|X\)/\1N/g]])
feed_command([[2s/\(^\|,\)\ze\(,\|Y\)/\1N/gc]])
- feed('a') -- For the dialog of the previous :s command.
+ feed('a') -- For the dialog of the previous :s command.
feed_command([[3s/\(^\|,\)\ze\(,\|Z\)/\1N/gc]])
- feed('yy') -- For the dialog of the previous :s command.
+ feed('yy') -- For the dialog of the previous :s command.
expect([[
N,,NX
N,,NY
@@ -158,16 +203,16 @@ describe(':substitute', function()
insert('xxx')
feed_command('set magic&')
feed_command('s/x/X/gc')
- feed('yyq') -- For the dialog of the previous :s command.
+ feed('yyq') -- For the dialog of the previous :s command.
expect('XXx')
end)
it('first char is highlighted with confirmation dialog and empty match', function()
local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {reverse = true}, -- IncSearch
- [2] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { reverse = true }, -- IncSearch
+ [2] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach()
exec([[
@@ -179,10 +224,7 @@ describe(':substitute', function()
{1:o}ne |
two |
three |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
{2:replace with (y/n/a/q/l/^E/^Y)?}^ |
]])
end)
diff --git a/test/functional/legacy/syn_attr_spec.lua b/test/functional/legacy/syn_attr_spec.lua
index e6573da5d3..ec47bdf9af 100644
--- a/test/functional/legacy/syn_attr_spec.lua
+++ b/test/functional/legacy/syn_attr_spec.lua
@@ -37,12 +37,12 @@ describe('synIDattr()', function()
end)
end
- for _, mode in ipairs({'cterm', 'gui'}) do
+ for _, mode in ipairs({ 'cterm', 'gui' }) do
describe(('"%s"'):format(mode), function()
for _, attr in ipairs(bool_attrs) do
none_test(attr, mode)
end
- for _, attr in ipairs({'inverse', 'bg', 'fg', 'sp'}) do
+ for _, attr in ipairs({ 'inverse', 'bg', 'fg', 'sp' }) do
none_test(attr, mode)
end
end)
diff --git a/test/functional/legacy/tabline_spec.lua b/test/functional/legacy/tabline_spec.lua
index 6b368d1857..683c7d9bd7 100644
--- a/test/functional/legacy/tabline_spec.lua
+++ b/test/functional/legacy/tabline_spec.lua
@@ -17,12 +17,12 @@ describe('tabline', function()
-- oldtest: Test_tabline_showcmd()
it('showcmdloc=tabline works', function()
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
- [1] = {background = Screen.colors.LightGrey}, -- Visual
- [2] = {bold = true}, -- MoreMsg, TabLineSel
- [3] = {reverse = true}, -- TabLineFill
- [4] = {background = Screen.colors.LightGrey, underline = true}, -- TabLine
- [5] = {background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue}, -- Folded
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
+ [2] = { bold = true }, -- MoreMsg, TabLineSel
+ [3] = { reverse = true }, -- TabLineFill
+ [4] = { background = Screen.colors.LightGrey, underline = true }, -- TabLine
+ [5] = { background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue }, -- Folded
})
exec([[
func MyTabLine()
@@ -44,9 +44,7 @@ describe('tabline', function()
{3:g }|
{5:+-- 2 lines: a···································}|
^c |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
|
]])
@@ -57,8 +55,7 @@ describe('tabline', function()
^a |
b |
c |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
@@ -68,8 +65,7 @@ describe('tabline', function()
{1:a} |
{1:b} |
{1:c}^ |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{2:-- VISUAL BLOCK --} |
]])
@@ -79,8 +75,7 @@ describe('tabline', function()
a |
b |
^c |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
@@ -92,8 +87,7 @@ describe('tabline', function()
a |
b |
^c |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
: |
]])
end)
diff --git a/test/functional/legacy/tagcase_spec.lua b/test/functional/legacy/tagcase_spec.lua
index 9ca0e0009f..f84fc673cf 100644
--- a/test/functional/legacy/tagcase_spec.lua
+++ b/test/functional/legacy/tagcase_spec.lua
@@ -10,10 +10,13 @@ local write_file = helpers.write_file
describe("'tagcase' option", function()
setup(function()
- write_file('Xtags', [[
+ write_file(
+ 'Xtags',
+ [[
Bar Xtext 3
Foo Xtext 2
- foo Xtext 4]])
+ foo Xtext 4]]
+ )
end)
before_each(function()
diff --git a/test/functional/legacy/undolevels_spec.lua b/test/functional/legacy/undolevels_spec.lua
index 1dfc4c17ba..e8badc6864 100644
--- a/test/functional/legacy/undolevels_spec.lua
+++ b/test/functional/legacy/undolevels_spec.lua
@@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
local source, clear = helpers.source, helpers.clear
-local eq, nvim = helpers.eq, helpers.meths
+local eq, nvim = helpers.eq, helpers.api
describe('undolevel', function()
setup(clear)
@@ -57,6 +57,6 @@ describe('undolevel', function()
call Test_global_local_undolevels()
]])
- eq({}, nvim.get_vvar('errors'))
+ eq({}, nvim.nvim_get_vvar('errors'))
end)
end)
diff --git a/test/functional/legacy/vimscript_spec.lua b/test/functional/legacy/vimscript_spec.lua
index 16a1080396..8b0a920a3e 100644
--- a/test/functional/legacy/vimscript_spec.lua
+++ b/test/functional/legacy/vimscript_spec.lua
@@ -3,16 +3,16 @@ local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local exec = helpers.exec
local feed = helpers.feed
-local meths = helpers.meths
+local api = helpers.api
before_each(clear)
describe('Vim script', function()
-- oldtest: Test_deep_nest()
- it('Error when if/for/while/try/function is nested too deep',function()
+ it('Error when if/for/while/try/function is nested too deep', function()
local screen = Screen.new(80, 24)
screen:attach()
- meths.set_option_value('laststatus', 2, {})
+ api.nvim_set_option_value('laststatus', 2, {})
exec([[
" Deep nesting of if ... endif
func Test1()
@@ -59,25 +59,25 @@ describe('Vim script', function()
let @a = ''
endfunc
]])
- screen:expect({any = '%[No Name%]'})
+ screen:expect({ any = '%[No Name%]' })
feed(':call Test1()<CR>')
- screen:expect({any = 'E579: '})
+ screen:expect({ any = 'E579: ' })
feed('<C-C>')
- screen:expect({any = '%[No Name%]'})
+ screen:expect({ any = '%[No Name%]' })
feed(':call Test2()<CR>')
- screen:expect({any = 'E585: '})
+ screen:expect({ any = 'E585: ' })
feed('<C-C>')
- screen:expect({any = '%[No Name%]'})
+ screen:expect({ any = '%[No Name%]' })
feed(':call Test3()<CR>')
- screen:expect({any = 'E585: '})
+ screen:expect({ any = 'E585: ' })
feed('<C-C>')
- screen:expect({any = '%[No Name%]'})
+ screen:expect({ any = '%[No Name%]' })
feed(':call Test4()<CR>')
- screen:expect({any = 'E601: '})
+ screen:expect({ any = 'E601: ' })
feed('<C-C>')
- screen:expect({any = '%[No Name%]'})
+ screen:expect({ any = '%[No Name%]' })
feed(':call Test5()<CR>')
- screen:expect({any = 'E1058: '})
+ screen:expect({ any = 'E1058: ' })
end)
-- oldtest: Test_typed_script_var()
@@ -85,6 +85,6 @@ describe('Vim script', function()
local screen = Screen.new(80, 24)
screen:attach()
feed(":echo get(s:, 'foo', 'x')\n")
- screen:expect({any = 'E116: '})
+ screen:expect({ any = 'E116: ' })
end)
end)
diff --git a/test/functional/legacy/visual_spec.lua b/test/functional/legacy/visual_spec.lua
index 629fab5eb5..151e5874e1 100644
--- a/test/functional/legacy/visual_spec.lua
+++ b/test/functional/legacy/visual_spec.lua
@@ -13,9 +13,9 @@ describe('Visual highlight', function()
before_each(function()
screen = Screen.new(50, 6)
screen:set_default_attr_ids({
- [0] = {foreground = Screen.colors.Blue, bold = true}, -- NonText
- [1] = {bold = true}, -- ModeMsg
- [2] = {background = Screen.colors.LightGrey}, -- Visual
+ [0] = { foreground = Screen.colors.Blue, bold = true }, -- NonText
+ [1] = { bold = true }, -- ModeMsg
+ [2] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
})
screen:attach()
end)
@@ -33,8 +33,7 @@ describe('Visual highlight', function()
{2:aaaaaa}^ |
{2:bbbb } |
{2:cc } |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{1:-- VISUAL BLOCK --} |
]])
@@ -43,8 +42,7 @@ describe('Visual highlight', function()
{2:aaaaaa } |
{2:bbbb } |
{2:cc}^ {2: } |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
{1:-- VISUAL BLOCK --} |
]])
end)
@@ -60,9 +58,7 @@ describe('Visual highlight', function()
screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a|
{0:+}{2:aaaa}aaaaaa |
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*3
{1:-- VISUAL --} |
]])
end)
diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua
index 979b46ae47..7fe4ec8eb6 100644
--- a/test/functional/legacy/window_cmd_spec.lua
+++ b/test/functional/legacy/window_cmd_spec.lua
@@ -11,7 +11,7 @@ it('scrolling with laststatus=0 and :botright split', function()
clear('--cmd', 'set ruler')
local screen = Screen.new(40, 10)
screen:set_default_attr_ids({
- [1] = {reverse = true}, -- StatusLineNC
+ [1] = { reverse = true }, -- StatusLineNC
})
screen:attach()
exec([[
@@ -296,10 +296,7 @@ describe('splitkeep', function()
a |
b |
c |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
[No Name] |
^a |
b |
@@ -328,8 +325,7 @@ describe('splitkeep', function()
<<<e line with lots of text in one line |
^with lots of text in one line with lots |
of text in one line |
- ~ |
- ~ |
+ ~ |*2
[No Name] [+] |
|
]])
diff --git a/test/functional/legacy/wordcount_spec.lua b/test/functional/legacy/wordcount_spec.lua
index 21f96628c0..82021dd98d 100644
--- a/test/functional/legacy/wordcount_spec.lua
+++ b/test/functional/legacy/wordcount_spec.lua
@@ -50,75 +50,83 @@ describe('wordcount', function()
]=])
-- Test 1: empty window
- eq(eval([=[
+ eq(
+ eval([=[
[[''], {'chars': 0, 'cursor_chars': 0, 'words': 0, 'cursor_words': 0, 'bytes': 0, 'cursor_bytes': 0}]
]=]),
- eval('DoRecordWin()')
- )
+ eval('DoRecordWin()')
+ )
-- Test 2: some words, cursor at start
command([[call PutInWindow('one two three')]])
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'one two three'], {'chars': 15, 'cursor_chars': 1, 'words': 3, 'cursor_words': 0, 'bytes': 15, 'cursor_bytes': 1}]
]=]),
- eval('DoRecordWin([1, 1, 0])')
- )
+ eval('DoRecordWin([1, 1, 0])')
+ )
-- Test 3: some words, cursor at end
command([[call PutInWindow('one two three')]])
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 14}]
]=]),
- eval('DoRecordWin([2, 99, 0])')
- )
+ eval('DoRecordWin([2, 99, 0])')
+ )
-- Test 4: some words, cursor at end, ve=all
command('set ve=all')
command([[call PutInWindow('one two three')]])
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'one two three'], {'chars': 15, 'cursor_chars': 15, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 15}]
]=]),
- eval('DoRecordWin([2,99,0])')
- )
+ eval('DoRecordWin([2,99,0])')
+ )
command('set ve=')
-- Test 5: several lines with words
command([=[call PutInWindow(['one two three', 'one two three', 'one two three'])]=])
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'one two three', 'one two three', 'one two three'], {'chars': 43, 'cursor_chars': 42, 'words': 9, 'cursor_words': 9, 'bytes': 43, 'cursor_bytes': 42}]
]=]),
- eval('DoRecordWin([4,99,0])')
- )
+ eval('DoRecordWin([4,99,0])')
+ )
-- Test 6: one line with BOM set
command([[call PutInWindow('one two three')]])
command('wincmd k')
command('set bomb')
command('wincmd j')
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 18, 'cursor_bytes': 14}]
]=]),
- eval('DoRecordWin([2,99,0])')
- )
+ eval('DoRecordWin([2,99,0])')
+ )
command('wincmd k')
command('set nobomb')
command('wincmd j')
-- Test 7: one line with multibyte words
command([=[call PutInWindow(['Äne M¤ne Müh'])]=])
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'Äne M¤ne Müh'], {'chars': 14, 'cursor_chars': 13, 'words': 3, 'cursor_words': 3, 'bytes': 17, 'cursor_bytes': 16}]
]=]),
- eval('DoRecordWin([2,99,0])')
- )
+ eval('DoRecordWin([2,99,0])')
+ )
-- Test 8: several lines with multibyte words
command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'cursor_chars': 31, 'words': 7, 'cursor_words': 7, 'bytes': 36, 'cursor_bytes': 35}]
]=]),
- eval('DoRecordWin([3,99,0])')
- )
+ eval('DoRecordWin([3,99,0])')
+ )
-- Test 9: visual mode, complete buffer
command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
@@ -131,11 +139,12 @@ describe('wordcount', function()
command('set stl= ls=1')
command('let log=DoRecordWin([3,99,0])')
command('let log[1]=g:visual_stat')
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 32, 'visual_words': 7, 'visual_bytes': 36}]
]=]),
- eval('log')
- )
+ eval('log')
+ )
-- Test 10: visual mode (empty)
command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
@@ -148,11 +157,12 @@ describe('wordcount', function()
command('set stl= ls=1')
command('let log=DoRecordWin([3,99,0])')
command('let log[1]=g:visual_stat')
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 1, 'visual_words': 0, 'visual_bytes': 1}]
]=]),
- eval('log')
- )
+ eval('log')
+ )
-- Test 11: visual mode, single line
command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
@@ -165,10 +175,11 @@ describe('wordcount', function()
command('set stl= ls=1')
command('let log=DoRecordWin([3,99,0])')
command('let log[1]=g:visual_stat')
- eq(eval([=[
+ eq(
+ eval([=[
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 13, 'visual_words': 3, 'visual_bytes': 16}]
]=]),
- eval('log')
- )
+ eval('log')
+ )
end)
end)