diff options
Diffstat (limited to 'test/functional/legacy')
76 files changed, 1374 insertions, 953 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..0cce6bcd11 100644 --- a/test/functional/legacy/011_autocommands_spec.lua +++ b/test/functional/legacy/011_autocommands_spec.lua @@ -12,11 +12,17 @@ -- 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 helpers = require('test.functional.helpers')(after_each) local luv = require('luv') 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,11 +33,11 @@ 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')) + neq(nil, luv.fs_stat(name .. '.gz')) eq(nil, luv.fs_stat(name)) end @@ -49,14 +55,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 +76,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 +83,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 +108,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 +131,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 +178,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..f78648a328 100644 --- a/test/functional/legacy/012_directory_spec.lua +++ b/test/functional/legacy/012_directory_spec.lua @@ -21,7 +21,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 @@ -78,7 +78,7 @@ describe("'directory' option", function() -- swapfile should no longer exist in CWD. eq(nil, luv.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', {}) command('bdelete') @@ -86,7 +86,7 @@ describe("'directory' option", function() eq(true, meths.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..ae2cc1abbe 100644 --- a/test/functional/legacy/039_visual_block_mode_commands_spec.lua +++ b/test/functional/legacy/039_visual_block_mode_commands_spec.lua @@ -8,7 +8,6 @@ local clear, expect = helpers.clear, helpers.expect local feed_command = helpers.feed_command describe('Visual block mode', function() - before_each(function() clear() @@ -208,11 +207,11 @@ describe('Visual block mode', function() local cpos = 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 f17a32406f..0c2b59932b 100644 --- a/test/functional/legacy/063_match_and_matchadd_spec.lua +++ b/test/functional/legacy/063_match_and_matchadd_spec.lua @@ -13,13 +13,13 @@ 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') @@ -30,7 +30,7 @@ describe('063: Test for ":match", "matchadd()" and related functions', function( | ]]) - command("call clearmatches()") + command('call clearmatches()') command("call setline(1, 'abcdΣabcdef')") command("call matchaddpos('MyGroup1', [[1, 4, 2], [1, 9, 2]])") screen:expect([[ @@ -40,4 +40,3 @@ describe('063: Test for ":match", "matchadd()" and related functions', function( ]]) 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..3a4ab31bea 100644 --- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua +++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua @@ -3,8 +3,7 @@ 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 +13,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. 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/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/assert_spec.lua b/test/functional/legacy/assert_spec.lua index d49d7d665a..006f71aa4f 100644 --- a/test/functional/legacy/assert_spec.lua +++ b/test/functional/legacy/assert_spec.lua @@ -14,7 +14,6 @@ local function expected_empty() 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..c6517a20aa 100644 --- a/test/functional/legacy/autochdir_spec.lua +++ b/test/functional/legacy/autochdir_spec.lua @@ -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..88618aeb2c 100644 --- a/test/functional/legacy/autocmd_option_spec.lua +++ b/test/functional/legacy/autocmd_option_spec.lua @@ -29,9 +29,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 @@ -47,19 +45,19 @@ 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 +117,6 @@ end describe('au OptionSet', function() describe('with any option (*)', function() - before_each(function() clear() declare_hook_function() @@ -129,44 +126,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 +174,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,7 +205,7 @@ 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() @@ -216,7 +213,16 @@ describe('au OptionSet', function() local new_bufnr = 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 +230,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 +261,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 +278,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 +292,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 +341,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 +355,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 +619,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,7 +640,7 @@ 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() @@ -606,8 +650,16 @@ describe('au OptionSet', function() local new_bufnr = 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 +675,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.set_option_value('autochdir', true, { scope = 'global' }) + eq(true, 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.set_option_value('cmdheight', 5, { scope = 'global' }) + eq(5, 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.set_option_value('ambiwidth', 'double', { scope = 'global' }) + eq('double', nvim.get_option_value('ambiwidth', { scope = 'global' })) + expected_combination({ + 'ambiwidth', + 'single', + '', + 'single', + 'double', + 'global', + 'setglobal', + }) end) end) end) diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua index 8bf08bca7f..274fdfe2e2 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([[ @@ -68,11 +68,11 @@ describe('breakindent', function() 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}, -- Visual - [2] = {bold = true, reverse = true}, -- StatusLine - [3] = {reverse = true}, -- StatusLineNC - [4] = {bold = true}, -- ModeMsg + [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText + [1] = { background = Screen.colors.LightGrey }, -- Visual + [2] = { bold = true, reverse = true }, -- StatusLine + [3] = { reverse = true }, -- StatusLineNC + [4] = { bold = true }, -- ModeMsg }) screen:attach() 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 54ca4205c3..99731bb80b 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -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,23 +37,28 @@ describe('cmdline', function() ]]) feed [[:tabnew<cr>]] - screen:expect{grid=[[ + screen:expect { + grid = [[ {1: + [No Name] }{2: [No Name] }{3: }{1:X}| ^ | {4:~ }|*7 :tabnew | - ]]} + ]], + } feed [[<C-w>-<C-w>-]] - screen:expect{grid=[[ + screen:expect { + grid = [[ {1: + [No Name] }{2: [No Name] }{3: }{1:X}| ^ | {4:~ }|*5 |*3 - ]]} + ]], + } feed [[gt]] - screen:expect{grid=[[ + screen:expect { + grid = [[ {2: + [No Name] }{1: [No Name] }{3: }{1:X}| ^0 | 1 | @@ -64,7 +69,8 @@ describe('cmdline', function() 6 | 7 | | - ]]} + ]], + } feed [[gt]] screen:expect([[ @@ -104,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([[ @@ -125,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([[ @@ -152,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([[ @@ -186,10 +192,10 @@ 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, {}) @@ -208,7 +214,7 @@ 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, {}) @@ -231,17 +237,17 @@ 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([[ | diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua index bcd7e0063b..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 @@ -437,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([[ @@ -465,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([[ diff --git a/test/functional/legacy/debugger_spec.lua b/test/functional/legacy/debugger_spec.lua index 65f6bd7221..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,13 +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: *}}|*8 :source %{MATCH: *}| - ]]} + ]], + } feed(':source %<CR>') - screen:expect{grid=[[ + screen:expect { + grid = [[ let g:Xtest_var += 1{MATCH: *}| {0:~{MATCH: *}}| {1:{MATCH: *}}| @@ -47,15 +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: *}}|*8 {MATCH: *}| - ]]} + ]], + } feed(':source %<CR>') - screen:expect{grid=[[ + screen:expect { + grid = [[ let g:Xtest_var += 1{MATCH: *}| {0:~{MATCH: *}}| {1:{MATCH: *}}| @@ -66,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 a0399847bd..015f144b74 100644 --- a/test/functional/legacy/digraph_spec.lua +++ b/test/functional/legacy/digraph_spec.lua @@ -10,9 +10,9 @@ 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>') diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua index ab6b1906c5..b44e1fd601 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 }, -- Visual + [3] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, -- SignColumn }) exec([[ @@ -56,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([[ diff --git a/test/functional/legacy/edit_spec.lua b/test/functional/legacy/edit_spec.lua index 0cf2ec006d..59e9805a91 100644 --- a/test/functional/legacy/edit_spec.lua +++ b/test/functional/legacy/edit_spec.lua @@ -31,9 +31,9 @@ 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>') @@ -54,13 +54,13 @@ 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() 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 8f8d958530..90abf9ebd7 100644 --- a/test/functional/legacy/ex_mode_spec.lua +++ b/test/functional/legacy/ex_mode_spec.lua @@ -14,7 +14,7 @@ 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) end @@ -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'])]]) @@ -126,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') @@ -142,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. | diff --git a/test/functional/legacy/excmd_spec.lua b/test/functional/legacy/excmd_spec.lua index 41a478e793..ba41a983e2 100644 --- a/test/functional/legacy/excmd_spec.lua +++ b/test/functional/legacy/excmd_spec.lua @@ -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({}, meths.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 @@ -335,7 +337,7 @@ 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--') @@ -375,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) 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/fold_spec.lua b/test/functional/legacy/fold_spec.lua index 96fad8520c..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 {{{ @@ -78,10 +78,9 @@ describe('folding', function() 1 |*2 | ]]) - end) - it("foldmethod=indent", function() + it('foldmethod=indent', function() screen:try_resize(20, 8) feed_command('set fdm=indent sw=2') insert([[ @@ -107,7 +106,7 @@ describe('folding', function() ]]) end) - it("foldmethod=syntax", function() + it('foldmethod=syntax', function() screen:try_resize(35, 15) insert([[ 1 aa @@ -146,7 +145,7 @@ describe('folding', function() a jj]]) end) - it("foldmethod=expression", function() + it('foldmethod=expression', function() insert([[ 1 aa 2 bb @@ -228,7 +227,7 @@ describe('folding', function() {1:~ }|*5 | ]]) - feed("j") + feed('j') screen:expect([[ {3:+ }{4: 1 }{2:+-- 2 lines: ·························}| {3:+ }{4: 0 }{2:^+-- 2 lines: ·························}| 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 0619d5fb30..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,7 +24,7 @@ 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 | @@ -34,7 +34,7 @@ describe(':global', function() -- 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 1e5017fcc1..2416477673 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 }, -- Visual + [2] = { bold = true }, -- ModeMsg }) screen:attach() exec([[ diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua index d35f4bdae6..212ad041c0 100644 --- a/test/functional/legacy/increment_spec.lua +++ b/test/functional/legacy/increment_spec.lua @@ -6,7 +6,6 @@ local call, clear = helpers.call, helpers.clear local eq, nvim = helpers.eq, helpers.meths describe('Ctrl-A/Ctrl-X on visual selections', function() - before_each(function() clear() source([=[ 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 c35d765eae..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([[ diff --git a/test/functional/legacy/listlbr_spec.lua b/test/functional/legacy/listlbr_spec.lua index d8821417b9..fb5fb24380 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 }, -- Visual + [2] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg }) screen:attach() diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua index c1f23ab0a6..28efb912f8 100644 --- a/test/functional/legacy/mapping_spec.lua +++ b/test/functional/legacy/mapping_spec.lua @@ -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([[ diff --git a/test/functional/legacy/match_spec.lua b/test/functional/legacy/match_spec.lua index 312490e643..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([=[ @@ -63,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([[ @@ -95,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([[ diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua index f5f7fa55f8..bdc6cb77a2 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 }, }) exec([[ @@ -40,8 +40,8 @@ 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() @@ -82,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([[ @@ -97,7 +97,8 @@ describe('matchparen', function() ]]) feed('i<C-X><C-N><C-N>') - screen:expect{grid=[[ + screen:expect { + grid = [[ aa | aaa | aaaa | @@ -107,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 d7781d4b44..97c6d23494 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -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,11 +32,14 @@ describe('messages', function() command('enew') command('set readonly') feed('u') - screen:expect({grid = [[ + screen:expect({ + grid = [[ | {0:~ }|*4 {3:W10: Warning: Changing a readonly file}^ | - ]], timeout = 500}) + ]], + timeout = 500, + }) screen:expect([[ ^ | {0:~ }|*4 @@ -48,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([[ @@ -104,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() @@ -401,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) + 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 + meths.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>]]) @@ -455,7 +458,7 @@ 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 + command('mode') -- FIXME: bottom is invalid after scrolling screen:expect([[ ^ | {0:~ }|*7 @@ -506,9 +509,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() @@ -538,9 +541,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) @@ -613,9 +616,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=') @@ -671,10 +674,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() @@ -685,7 +688,7 @@ describe('messages', function() tabnew set cmdheight=2 ]]) - command('mode') -- FIXME: bottom is invalid after scrolling + command('mode') -- FIXME: bottom is invalid after scrolling screen:expect([[ {2: [No Name] }{1: [No Name] }{3: }{2:X}| ^ | @@ -707,7 +710,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() diff --git a/test/functional/legacy/move_spec.lua b/test/functional/legacy/move_spec.lua index 868f4a4644..512823be6c 100644 --- a/test/functional/legacy/move_spec.lua +++ b/test/functional/legacy/move_spec.lua @@ -11,11 +11,11 @@ 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'}) + funcs.setline(1, { 'First', 'Second', 'Third', 'Fourth' }) feed('gg:move +1<CR>') screen:expect([[ Second | diff --git a/test/functional/legacy/normal_spec.lua b/test/functional/legacy/normal_spec.lua index df96d64708..1dddeed033 100644 --- a/test/functional/legacy/normal_spec.lua +++ b/test/functional/legacy/normal_spec.lua @@ -7,16 +7,18 @@ 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|*4 {1: }22222222222222222222 | @@ -28,5 +30,6 @@ describe('normal', function() {1: }44444444444444444444 | | ]]) - end) + end + ) end) diff --git a/test/functional/legacy/options_spec.lua b/test/functional/legacy/options_spec.lua index 46c3f804a5..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() diff --git a/test/functional/legacy/prompt_buffer_spec.lua b/test/functional/legacy/prompt_buffer_spec.lua index ba594801cb..76c57a23b9 100644 --- a/test/functional/legacy/prompt_buffer_spec.lua +++ b/test/functional/legacy/prompt_buffer_spec.lua @@ -72,7 +72,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" | @@ -83,7 +83,7 @@ describe('prompt buffer', function() ~ |*3 -- INSERT -- | ]]) - feed("exit\n") + feed('exit\n') screen:expect([[ ^other buffer | ~ |*8 @@ -94,7 +94,7 @@ 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 @@ -103,7 +103,7 @@ describe('prompt buffer', function() ~ |*3 -- INSERT -- | ]]) - feed("<Left><Left><Left><BS>-") + feed('<Left><Left><Left><BS>-') screen:expect([[ cmd: -^hel | ~ |*3 @@ -112,7 +112,7 @@ describe('prompt buffer', function() ~ |*3 -- INSERT -- | ]]) - feed("<C-O>lz") + feed('<C-O>lz') screen:expect([[ cmd: -hz^el | ~ |*3 @@ -121,7 +121,7 @@ describe('prompt buffer', function() ~ |*3 -- INSERT -- | ]]) - feed("<End>x") + feed('<End>x') screen:expect([[ cmd: -hzelx^ | ~ |*3 @@ -130,7 +130,7 @@ describe('prompt buffer', function() ~ |*3 -- INSERT -- | ]]) - feed("<C-U>exit\n") + feed('<C-U>exit\n') screen:expect([[ ^other buffer | ~ |*8 @@ -141,16 +141,18 @@ 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 @@ -159,7 +161,7 @@ describe('prompt buffer', function() ~ |*3 -- INSERT -- | ]]) - feed("<Esc>") + feed('<Esc>') screen:expect([[ cmd:^ | ~ |*3 diff --git a/test/functional/legacy/put_spec.lua b/test/functional/legacy/put_spec.lua index e630604d60..791656cc03 100644 --- a/test/functional/legacy/put_spec.lua +++ b/test/functional/legacy/put_spec.lua @@ -15,7 +15,9 @@ end describe('put', function() before_each(clear) - after_each(function() eq({}, meths.get_vvar('errors')) end) + after_each(function() + eq({}, meths.get_vvar('errors')) + end) it('very large count 64-bit', function() if sizeoflong() < 8 then diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 9e62fb55c9..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() @@ -314,7 +314,7 @@ describe('smoothscroll', function() 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 @@ -344,7 +344,7 @@ describe('smoothscroll', function() 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' @@ -425,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']) @@ -553,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() @@ -575,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)) @@ -603,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))") @@ -652,11 +654,11 @@ describe('smoothscroll', function() 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)]) @@ -678,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 @@ -702,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 @@ -725,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 @@ -750,13 +752,13 @@ describe('smoothscroll', function() 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 @@ -814,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 @@ -863,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 @@ -927,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)) @@ -1073,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 9bf3c466b7..7ddf81cff8 100644 --- a/test/functional/legacy/search_spec.lua +++ b/test/functional/legacy/search_spec.lua @@ -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 }, @@ -28,8 +28,16 @@ describe('search cmdline', function() 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' + ' 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 }, funcs.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 }, funcs.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 @@ -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, + }, funcs.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, + }, funcs.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'}) + funcs.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'}) + funcs.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'}) + funcs.setline(1, { 'another one 2', 'that one 3', 'the one 1' }) feed(':vimgrep on') screen:expect([[ @@ -715,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([[ @@ -739,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 }, -- Visual + [4] = { background = Screen.colors.Yellow, bold = true }, -- Search + [5] = { background = Screen.colors.LightGrey, bold = true }, -- Visual + Search }) screen:attach() exec([[ diff --git a/test/functional/legacy/search_stat_spec.lua b/test/functional/legacy/search_stat_spec.lua index 791ae64b8d..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) diff --git a/test/functional/legacy/source_spec.lua b/test/functional/legacy/source_spec.lua index 4b7d2d361a..7a19541a77 100644 --- a/test/functional/legacy/source_spec.lua +++ b/test/functional/legacy/source_spec.lua @@ -9,13 +9,16 @@ 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') diff --git a/test/functional/legacy/statusline_spec.lua b/test/functional/legacy/statusline_spec.lua index f5119f5e23..1330d63dbd 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 @@ -69,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 }, -- Visual + [2] = { bold = true }, -- MoreMsg + [3] = { bold = true, reverse = true }, -- StatusLine + [5] = { background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue }, -- Folded }) exec([[ func MyStatusLine() diff --git a/test/functional/legacy/substitute_spec.lua b/test/functional/legacy/substitute_spec.lua index bba3df82d8..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([[ 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 f9e813255a..07e64d1d4a 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 }, -- 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() 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/vimscript_spec.lua b/test/functional/legacy/vimscript_spec.lua index 16a1080396..c97208059b 100644 --- a/test/functional/legacy/vimscript_spec.lua +++ b/test/functional/legacy/vimscript_spec.lua @@ -9,7 +9,7 @@ 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, {}) @@ -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 4b1f44661f..924ab8dbbe 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 }, -- Visual }) screen:attach() end) diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua index 14129b386b..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([[ 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) |