Mercurial > vim
diff src/testdir/test_codestyle.vim @ 31849:dbec60b8c253 v9.0.1257
patch 9.0.1257: code style is not check in test scripts
Commit: https://github.com/vim/vim/commit/94722c510745a0cfd494c51625a514b92dd2bfb2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 28 19:19:03 2023 +0000
patch 9.0.1257: code style is not check in test scripts
Problem: Code style is not check in test scripts.
Solution: Add basic code style check for test files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 28 Jan 2023 20:30:04 +0100 |
parents | 50555279168b |
children | 9fec560a63ef |
line wrap: on
line diff
--- 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