diff options
56 files changed, 247 insertions, 208 deletions
diff --git a/src/testdir/keycode_check.vim b/src/testdir/keycode_check.vim index 6ad7b773bb..8320341d2f 100644 --- a/src/testdir/keycode_check.vim +++ b/src/testdir/keycode_check.vim @@ -4,8 +4,8 @@ vim9script # # Usage: vim -u NONE -S keycode_check.vim # -# Author: Bram Moolenaar -# Last Update: 2022 Nov 15 +# Author: Bram Moolenaar +# Last Update: 2022 Nov 15 # # The codes are stored in the file "keycode_check.json", so that you can # compare the results of various terminals. @@ -449,7 +449,7 @@ enddef # The main loop while true var action = inputlist(['Select operation:', - '1. List results', + '1. List results', '2. Add results for a new terminal', '3. Replace results', '4. Clear results', diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index 5fe391b8f3..1cdeeef5aa 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -59,7 +59,7 @@ if has('gui_running') endif " Check that the screen size is at least 24 x 80 characters. -if &lines < 24 || &columns < 80 +if &lines < 24 || &columns < 80 let error = 'Screen size too small! Tests require at least 24 lines with 80 characters, got ' .. &lines .. ' lines with ' .. &columns .. ' characters' echoerr error split test.log diff --git a/src/testdir/setup.vim b/src/testdir/setup.vim index 5b8f3f1104..ca94bae275 100644 --- a/src/testdir/setup.vim +++ b/src/testdir/setup.vim @@ -20,7 +20,7 @@ if has('packages') let &packpath = &rtp endif -" Only when the +eval feature is present. +" Only when the +eval feature is present. if 1 " Make sure the .Xauthority file can be found after changing $HOME. if $XAUTHORITY == '' diff --git a/src/testdir/summarize.vim b/src/testdir/summarize.vim index da5856a2e7..d0d4e00b2c 100644 --- a/src/testdir/summarize.vim +++ b/src/testdir/summarize.vim @@ -33,7 +33,7 @@ if 1 silent %s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn silent %s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn - call extend(output, ["Skipped:"]) + call extend(output, ["Skipped:"]) call extend(output, skipped_output) call extend(output, [ diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim index 8222d0c06f..ecf5024fdb 100644 --- a/src/testdir/test_assert.vim +++ b/src/testdir/test_assert.vim @@ -190,9 +190,9 @@ func Test_wrong_error_type() endfunc func Test_compare_fail() - let s:v = {} - let s:x = {"a": s:v} - let s:v["b"] = s:x + let s:v = {} + let s:x = {"a": s:v} + let s:v["b"] = s:x let s:w = {"c": s:x, "d": ''} try call assert_equal(s:w, '') diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 12fbcb7ad7..8931678d74 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -269,8 +269,8 @@ func Test_win_tab_autocmd() augroup testing au WinNew * call add(g:record, 'WinNew') au WinClosed * call add(g:record, 'WinClosed') - au WinEnter * call add(g:record, 'WinEnter') - au WinLeave * call add(g:record, 'WinLeave') + au WinEnter * call add(g:record, 'WinEnter') + au WinLeave * call add(g:record, 'WinLeave') au TabNew * call add(g:record, 'TabNew') au TabClosed * call add(g:record, 'TabClosed') au TabEnter * call add(g:record, 'TabEnter') @@ -3406,7 +3406,7 @@ endfunc func Test_Visual_doautoall_redraw() call setline(1, ['a', 'b']) - new + new wincmd p call feedkeys("G\<C-V>", 'txn') autocmd User Explode ++once redraw @@ -4121,7 +4121,7 @@ endfunc func Test_autocmd_split_dummy() " Autocommand trying to split a window containing a dummy buffer. - auto BufReadPre * exe "sbuf " .. expand("<abuf>") + auto BufReadPre * exe "sbuf " .. expand("<abuf>") " Avoid the "W11" prompt au FileChangedShell * let v:fcs_choice = 'reload' func Xautocmd_changelist() diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim index 4a957aa721..cccecb7611 100644 --- a/src/testdir/test_blob.vim +++ b/src/testdir/test_blob.vim @@ -498,7 +498,7 @@ func Test_blob_read_write() call assert_equal(b[-3 :], br5) VAR br6 = readblob('Xblob', -3, 2) call assert_equal(b[-3 : -2], br6) - + #" reading past end of file, empty result VAR br1e = readblob('Xblob', 10000) call assert_equal(0z, br1e) diff --git a/src/testdir/test_blockedit.vim b/src/testdir/test_blockedit.vim index 8497efb083..71f687b7c2 100644 --- a/src/testdir/test_blockedit.vim +++ b/src/testdir/test_blockedit.vim @@ -52,7 +52,7 @@ func Test_blockinsert_autoindent() let expected =<< trim END vim9script var d = { - a: (): asdf => 0, + a: (): asdf => 0, b: (): asdf => 0, c: (): asdf => 0, } diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index 438db8e196..a6b25c9a78 100644 --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -20,7 +20,7 @@ endif " call ch_logfile('channellog', 'w') func SetUp() - if g:testfunc =~ '_ipv6()$' + if g:testfunc =~ '_ipv6()$' let s:localhost = '[::1]:' let s:testscript = 'test_channel_6.py' elseif g:testfunc =~ '_unix()$' @@ -1220,7 +1220,7 @@ endfunc func Test_pipe_to_buffer_raw() let options = {'out_mode': 'raw', 'out_io': 'buffer', 'out_name': 'testout'} split testout - let job = job_start([s:python, '-c', + let job = job_start([s:python, '-c', \ 'import sys; [sys.stdout.write(".") and sys.stdout.flush() for _ in range(10000)]'], options) " the job may be done quickly, also accept "dead" call assert_match('^\%(dead\|run\)$', job_status(job)) diff --git a/src/testdir/test_cmd_lists.vim b/src/testdir/test_cmd_lists.vim index 8a7d54fe6c..77ae85ea2c 100644 --- a/src/testdir/test_cmd_lists.vim +++ b/src/testdir/test_cmd_lists.vim @@ -50,7 +50,7 @@ func Test_cmd_lists() \ 'interface', \ 'public', \ 'static', - \ 'this', + \ 'this', \ 'type', \ '++', \ '--', diff --git a/src/testdir/test_codestyle.vim b/src/testdir/test_codestyle.vim index beb4a6818d..c643ff2e84 100644 --- a/src/testdir/test_codestyle.vim +++ b/src/testdir/test_codestyle.vim @@ -41,5 +41,42 @@ def Test_source_files() bwipe! enddef +def Test_test_files() + for fname in glob('*.vim', 0, 1) + exe 'edit ' .. fname + + # some files intentionally have misplaced white space + if fname =~ 'test_cindent.vim' || fname =~ 'test_join.vim' + continue + endif + + # skip files that are known to have a space before a tab + if fname !~ 'test_comments.vim' + && fname !~ 'test_listchars.vim' + && fname !~ 'test_visual.vim' + cursor(1, 1) + var lnum = search(fname =~ "test_regexp_latin" ? '[^á] \t' : ' \t') + assert_equal(0, lnum, 'testdir/' .. fname .. ': space before tab') + endif + + # skip files that are known to have trailing white space + if fname !~ 'test_cmdline.vim' + && fname !~ 'test_let.vim' + && fname !~ 'test_tagjump.vim' + && fname !~ 'test_vim9_cmd.vim' + cursor(1, 1) + var lnum = search( + fname =~ 'test_vim9_assign.vim' ? '[^=]\s$' + : fname =~ 'test_vim9_class.vim' ? '[^)]\s$' + : fname =~ 'test_vim9_script.vim' ? '[^,:3]\s$' + : fname =~ 'test_visual.vim' ? '[^/]\s$' + : '[^\\]\s$') + assert_equal(0, lnum, 'testdir/' .. fname .. ': trailing white space') + endif + endfor + + bwipe! +enddef + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim index 9308d0492b..d9ffbb3798 100644 --- a/src/testdir/test_diffmode.vim +++ b/src/testdir/test_diffmode.vim @@ -360,7 +360,7 @@ func Test_dp_do_buffer() call assert_equal('10', getline('.')) 21 call assert_equal('two', getline('.')) - diffget one + diffget one call assert_equal('20', getline('.')) 31 @@ -1113,7 +1113,7 @@ func Test_diff_with_syntax() CheckScreendump let lines =<< trim END - void doNothing() { + void doNothing() { int x = 0; char *s = "hello"; return 5; @@ -1121,7 +1121,7 @@ func Test_diff_with_syntax() END call writefile(lines, 'Xprogram1.c', 'D') let lines =<< trim END - void doSomething() { + void doSomething() { int x = 0; char *s = "there"; return 5; @@ -1130,7 +1130,7 @@ func Test_diff_with_syntax() call writefile(lines, 'Xprogram2.c', 'D') let lines =<< trim END - edit Xprogram1.c + edit Xprogram1.c diffsplit Xprogram2.c END call writefile(lines, 'Xtest_diff_syntax', 'D') @@ -1307,12 +1307,12 @@ endfunc func Test_diff_and_scroll() " this was causing an ml_get error set ls=2 - for i in range(winheight(0) * 2) - call setline(i, i < winheight(0) - 10 ? i : i + 10) + for i in range(winheight(0) * 2) + call setline(i, i < winheight(0) - 10 ? i : i + 10) endfor vnew - for i in range(winheight(0)*2 + 10) - call setline(i, i < winheight(0) - 10 ? 0 : i) + for i in range(winheight(0)*2 + 10) + call setline(i, i < winheight(0) - 10 ? 0 : i) endfor diffthis wincmd p diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim index ec824b077a..9caa93128a 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -2072,7 +2072,7 @@ func Test_edit_overlong_file_name() file %%%%%%%%%%%%%%%%%%%%%%%%%% file %%%%%% set readonly - set ls=2 + set ls=2 redraw! set noreadonly ls& diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim index c1140aaabb..d7c393a04e 100644 --- a/src/testdir/test_expand.vim +++ b/src/testdir/test_expand.vim @@ -45,9 +45,9 @@ endfunc func Test_expand_tilde_filename() split ~ - call assert_equal('~', expand('%')) + call assert_equal('~', expand('%')) call assert_notequal(expand('%:p'), expand('~/')) - call assert_match('\~', expand('%:p')) + call assert_match('\~', expand('%:p')) bwipe! endfunc diff --git a/src/testdir/test_expand_dllpath.vim b/src/testdir/test_expand_dllpath.vim index 76bd787ad8..8e489724bd 100644 --- a/src/testdir/test_expand_dllpath.vim +++ b/src/testdir/test_expand_dllpath.vim @@ -4,12 +4,12 @@ func s:test_expand_dllpath(optname) let $TEST_EXPAND_DLLPATH = '/dllpath/lib' . substitute(a:optname, '\zedll$', '.', '') execute 'let dllpath_save = &' . a:optname try - execute 'set ' . a:optname . '=$TEST_EXPAND_DLLPATH' - execute 'call assert_equal("' . $TEST_EXPAND_DLLPATH . '", &' . a:optname . ')' + execute 'set ' . a:optname . '=$TEST_EXPAND_DLLPATH' + execute 'call assert_equal("' . $TEST_EXPAND_DLLPATH . '", &' . a:optname . ')' execute 'set ' . a:optname . '=~' . $TEST_EXPAND_DLLPATH let home = substitute($HOME, '\\', '/', 'g') - execute 'call assert_equal("' . home . $TEST_EXPAND_DLLPATH . '", &' . a:optname . ')' + execute 'call assert_equal("' . home . $TEST_EXPAND_DLLPATH . '", &' . a:optname . ')' finally execute 'let &' . a:optname . ' = dllpath_save' let $TEST_EXPAND_DLLPATH = '' diff --git a/src/testdir/test_expand_func.vim b/src/testdir/test_expand_func.vim index c9e802a1e0..112809ab2d 100644 --- a/src/testdir/test_expand_func.vim +++ b/src/testdir/test_expand_func.vim @@ -7,15 +7,15 @@ let s:slnum = str2nr(expand('<slnum>')) let s:sflnum = str2nr(expand('<sflnum>')) func s:expand_sfile() - return expand('<sfile>') + return expand('<sfile>') endfunc func s:expand_slnum() - return str2nr(expand('<slnum>')) + return str2nr(expand('<slnum>')) endfunc func s:expand_sflnum() - return str2nr(expand('<sflnum>')) + return str2nr(expand('<sflnum>')) endfunc " This test depends on the location in the test file, put it first. diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim index a0291a0ab3..a35ea1e3b8 100644 --- a/src/testdir/test_fold.vim +++ b/src/testdir/test_fold.vim @@ -456,7 +456,7 @@ func Test_move_folds_around_manual() %foldopen! 13m7 call Check_foldlevels([1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 0]) - + bw! endfunc @@ -705,7 +705,7 @@ func Test_fold_create_marker_in_C() let content =<< trim [CODE] /* * comment - * + * * */ int f(int* p) { diff --git a/src/testdir/test_goto.vim b/src/testdir/test_goto.vim index c74a021446..85c156ac7a 100644 --- a/src/testdir/test_goto.vim +++ b/src/testdir/test_goto.vim @@ -17,7 +17,7 @@ endfunc func Test_gD() let lines =<< trim [CODE] int x; - + int func(void) { return x; @@ -30,7 +30,7 @@ endfunc func Test_gD_too() let lines =<< trim [CODE] Filename x; - + int Filename int func() { Filename x; @@ -44,7 +44,7 @@ func Test_gD_comment() let lines =<< trim [CODE] /* int x; */ int x; - + int func(void) { return x; @@ -58,7 +58,7 @@ func Test_gD_inline_comment() let lines =<< trim [CODE] int y /* , x */; int x; - + int func(void) { return x; @@ -72,7 +72,7 @@ func Test_gD_string() let lines =<< trim [CODE] char *s[] = "x"; int x = 1; - + int func(void) { return x; @@ -85,7 +85,7 @@ endfunc func Test_gD_string_same_line() let lines =<< trim [CODE] char *s[] = "x", int x = 1; - + int func(void) { return x; @@ -99,7 +99,7 @@ func Test_gD_char() let lines =<< trim [CODE] char c = 'x'; int x = 1; - + int func(void) { return x; @@ -112,7 +112,7 @@ endfunc func Test_gd() let lines =<< trim [CODE] int x; - + int func(int x) { return x; @@ -146,7 +146,7 @@ func Test_gd_not_local() { return x; } - + int func2(int x) { return x; @@ -173,9 +173,9 @@ func Test_gd_missing_braces() def func1(a) a + 1 end - + a = 1 - + def func2() return a end @@ -252,11 +252,11 @@ func Test_gd_inline_comment_body() int func(void) { int y /* , x */; - + for (/* int x = 0 */; y < 2; y++); - + int x = 0; - + return x; } [CODE] @@ -292,7 +292,7 @@ func Test_gd_string() { char *s = "x"; int x = 1; - + return x; } [CODE] @@ -304,7 +304,7 @@ func Test_gd_string_only() int func(void) { char *s = "x"; - + return x; } [CODE] @@ -341,7 +341,7 @@ func Test_gd_local_block() char *b = "NULL"; return b; } - + return 0; } [CODE] diff --git a/src/testdir/test_increment.vim b/src/testdir/test_increment.vim index beacb0a44e..c367f2bab5 100644 --- a/src/testdir/test_increment.vim +++ b/src/testdir/test_increment.vim @@ -704,7 +704,7 @@ endfunc " Text: " 1 23 " 4 56 -" +" " Expected: " 1) f2 Ctrl-V jl <ctrl-a>, repeat twice afterwards with . " 1 26 diff --git a/src/testdir/test_indent.vim b/src/testdir/test_indent.vim index 290855ed93..96e9d23008 100644 --- a/src/testdir/test_indent.vim +++ b/src/testdir/test_indent.vim @@ -175,7 +175,7 @@ func Test_modeline_indent_expr() endfunc func Test_indent_func_with_gq() - + function GetTeXIndent() " Sample indent expression for TeX files let lnum = prevnonblank(v:lnum - 1) @@ -186,7 +186,7 @@ func Test_indent_func_with_gq() let line = getline(lnum) let ind = indent(lnum) " Add a 'shiftwidth' after beginning of environments. - if line =~ '\\begin{center}' + if line =~ '\\begin{center}' let ind = ind + shiftwidth() endif return ind @@ -248,7 +248,7 @@ func Test_indent_func_with_gq() bwipe! delmark ab - delfunction GetTeXIndent + delfunction GetTeXIndent endfu func Test_formatting_keeps_first_line_indent() diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index 1452e4d31b..fc7e8cb0ed 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -2149,7 +2149,7 @@ endfunc func Test_ins_complete_end_of_line() " this was reading past the end of the line - new + new norm 8oý sil! norm o diff --git a/src/testdir/test_listchars.vim b/src/testdir/test_listchars.vim index b9b078c0a1..2f495c3ab1 100644 --- a/src/testdir/test_listchars.vim +++ b/src/testdir/test_listchars.vim @@ -506,7 +506,7 @@ func Test_listchars_composing() set list set listchars=eol:$,space:_,nbsp:= - + let nbsp1 = nr2char(0xa0) let nbsp2 = nr2char(0x202f) call append(0, [ diff --git a/src/testdir/test_map_functions.vim b/src/testdir/test_map_functions.vim index 13e61f207b..a750cd79cd 100644 --- a/src/testdir/test_map_functions.vim +++ b/src/testdir/test_map_functions.vim @@ -1,7 +1,7 @@ " Tests for maparg(), mapcheck(), mapset(), maplist() " Also test utf8 map with a 0x80 byte. -func s:SID() +func s:SID() return str2nr(matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')) endfunc @@ -18,7 +18,7 @@ func Test_maparg() call assert_equal({'silent': 0, 'noremap': 0, 'script': 0, 'lhs': 'foo<C-V>', \ 'lhsraw': "foo\x80\xfc\x04V", 'lhsrawalt': "foo\x16", \ 'mode': ' ', 'nowait': 0, 'expr': 0, 'sid': sid, 'scriptversion': 1, - \ 'lnum': lnum + 1, + \ 'lnum': lnum + 1, \ 'rhs': 'is<F4>foo', 'buffer': 0, 'abbr': 0, 'mode_bits': 0x47}, \ maparg('foo<C-V>', '', 0, 1)) call assert_equal({'silent': 1, 'noremap': 1, 'script': 1, 'lhs': 'bar', diff --git a/src/testdir/test_method.vim b/src/testdir/test_method.vim index 29734e0498..2ca66fd77e 100644 --- a/src/testdir/test_method.vim +++ b/src/testdir/test_method.vim @@ -127,7 +127,7 @@ endfunc func Test_method_syntax() eval [1, 2, 3] ->sort( ) - eval [1, 2, 3] + eval [1, 2, 3] \ ->sort( \ ) eval [1, 2, 3]->sort() diff --git a/src/testdir/test_mswin_event.vim b/src/testdir/test_mswin_event.vim index fd5143a58a..e2add3b2c2 100644 --- a/src/testdir/test_mswin_event.vim +++ b/src/testdir/test_mswin_event.vim @@ -43,7 +43,7 @@ func SendKeyStr(keystring) endfor endfunc -" This tells Vim to execute the buffered keys as user commands, +" This tells Vim to execute the buffered keys as user commands, " ie. same as feekdeys with mode X would do. func ExecuteBufferedKeys() if has('gui_running') @@ -158,7 +158,7 @@ let s:VK = { let s:MOD_MASK_SHIFT = 0x02 let s:MOD_MASK_CTRL = 0x04 let s:MOD_MASK_ALT = 0x08 - + let s:vim_key_modifiers = [ \ ["", |