Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
31848:b83cac410fcf | 31849:dbec60b8c253 |
---|---|
39 endfor | 39 endfor |
40 | 40 |
41 bwipe! | 41 bwipe! |
42 enddef | 42 enddef |
43 | 43 |
44 def Test_test_files() | |
45 for fname in glob('*.vim', 0, 1) | |
46 exe 'edit ' .. fname | |
47 | |
48 # some files intentionally have misplaced white space | |
49 if fname =~ 'test_cindent.vim' || fname =~ 'test_join.vim' | |
50 continue | |
51 endif | |
52 | |
53 # skip files that are known to have a space before a tab | |
54 if fname !~ 'test_comments.vim' | |
55 && fname !~ 'test_listchars.vim' | |
56 && fname !~ 'test_visual.vim' | |
57 cursor(1, 1) | |
58 var lnum = search(fname =~ "test_regexp_latin" ? '[^รก] \t' : ' \t') | |
59 assert_equal(0, lnum, 'testdir/' .. fname .. ': space before tab') | |
60 endif | |
61 | |
62 # skip files that are known to have trailing white space | |
63 if fname !~ 'test_cmdline.vim' | |
64 && fname !~ 'test_let.vim' | |
65 && fname !~ 'test_tagjump.vim' | |
66 && fname !~ 'test_vim9_cmd.vim' | |
67 cursor(1, 1) | |
68 var lnum = search( | |
69 fname =~ 'test_vim9_assign.vim' ? '[^=]\s$' | |
70 : fname =~ 'test_vim9_class.vim' ? '[^)]\s$' | |
71 : fname =~ 'test_vim9_script.vim' ? '[^,:3]\s$' | |
72 : fname =~ 'test_visual.vim' ? '[^/]\s$' | |
73 : '[^\\]\s$') | |
74 assert_equal(0, lnum, 'testdir/' .. fname .. ': trailing white space') | |
75 endif | |
76 endfor | |
77 | |
78 bwipe! | |
79 enddef | |
80 | |
44 | 81 |
45 " vim: shiftwidth=2 sts=2 expandtab | 82 " vim: shiftwidth=2 sts=2 expandtab |