mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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.
94722c5107
Use Test_test_files() from latest Vim.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
f17d819330
commit
457ab65ff3
@ -48,8 +48,18 @@
|
||||
" call add(v:errors, "this happened")
|
||||
|
||||
|
||||
" Without the +eval feature we can't run these tests, bail out.
|
||||
silent! while 0
|
||||
qa!
|
||||
silent! endwhile
|
||||
|
||||
" In the GUI we can always change the screen size.
|
||||
if has('gui_running')
|
||||
set columns=80 lines=25
|
||||
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
|
||||
|
@ -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, [
|
||||
|
@ -273,8 +273,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')
|
||||
@ -3770,7 +3770,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()
|
||||
|
@ -850,7 +850,7 @@ func Test_indexof()
|
||||
call assert_equal(-1, indexof(v:_null_blob, "v:val == 0xde"))
|
||||
call assert_equal(-1, indexof(b, v:_null_string))
|
||||
" Nvim doesn't have null functions
|
||||
" call assert_equal(-1, indexof(b, test_null_function()))
|
||||
" call assert_equal(-1, indexof(b, test_null_function()))
|
||||
|
||||
let b = 0z01020102
|
||||
call assert_equal(1, indexof(b, "v:val == 0x02", #{startidx: 0}))
|
||||
|
@ -53,7 +53,7 @@ func Test_blockinsert_autoindent()
|
||||
let expected =<< trim END
|
||||
vim9script
|
||||
var d = {
|
||||
a: (): asdf => 0,
|
||||
a: (): asdf => 0,
|
||||
b: (): asdf => 0,
|
||||
c: (): asdf => 0,
|
||||
}
|
||||
|
@ -6,6 +6,45 @@ func s:ReportError(fname, lnum, msg)
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_test_files()
|
||||
for fname in glob('*.vim', 0, 1)
|
||||
let g:ignoreSwapExists = 'e'
|
||||
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'
|
||||
call cursor(1, 1)
|
||||
let skip = 'getline(".") =~ "codestyle: ignore"'
|
||||
let lnum = search(fname =~ "test_regexp_latin" ? '[^á] \t' : ' \t', 'W', 0, 0, skip)
|
||||
call s:ReportError('testdir/' .. fname, lnum, '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'
|
||||
call cursor(1, 1)
|
||||
let 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$')
|
||||
call s:ReportError('testdir/' .. fname, lnum, 'trailing white space')
|
||||
endif
|
||||
endfor
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_help_files()
|
||||
set nowrapscan
|
||||
|
||||
|
@ -1332,12 +1332,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
|
||||
|
@ -2112,7 +2112,7 @@ func Test_edit_overlong_file_name()
|
||||
file %%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
file %%%%%%
|
||||
set readonly
|
||||
set ls=2
|
||||
set ls=2
|
||||
|
||||
redraw!
|
||||
set noreadonly ls&
|
||||
|
@ -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.
|
||||
|
@ -499,7 +499,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
|
||||
|
||||
@ -748,7 +748,7 @@ func Test_fold_create_marker_in_C()
|
||||
let content =<< trim [CODE]
|
||||
/*
|
||||
* comment
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
int f(int* p) {
|
||||
|
@ -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]
|
||||
@ -305,7 +305,7 @@ func Test_gd_string_only()
|
||||
int func(void)
|
||||
{
|
||||
char *s = "x";
|
||||
|
||||
|
||||
return x;
|
||||
}
|
||||
[CODE]
|
||||
@ -347,7 +347,7 @@ func Test_gd_local_block()
|
||||
char *b = "NULL";
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
[CODE]
|
||||
|
@ -705,7 +705,7 @@ endfunc
|
||||
" Text:
|
||||
" 1 23
|
||||
" 4 56
|
||||
"
|
||||
"
|
||||
" Expected:
|
||||
" 1) f2 Ctrl-V jl <ctrl-a>, repeat twice afterwards with .
|
||||
" 1 26
|
||||
|
@ -176,7 +176,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)
|
||||
@ -187,7 +187,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
|
||||
@ -249,7 +249,7 @@ func Test_indent_func_with_gq()
|
||||
|
||||
bwipe!
|
||||
delmark ab
|
||||
delfunction GetTeXIndent
|
||||
delfunction GetTeXIndent
|
||||
endfu
|
||||
|
||||
func Test_formatting_keeps_first_line_indent()
|
||||
|
@ -2382,7 +2382,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
|
||||
|
||||
|
@ -20,7 +20,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',
|
||||
|
@ -128,7 +128,7 @@ endfunc
|
||||
|
||||
func Test_method_syntax()
|
||||
eval [1, 2, 3] ->sort( )
|
||||
eval [1, 2, 3]
|
||||
eval [1, 2, 3]
|
||||
\ ->sort(
|
||||
\ )
|
||||
call assert_fails('eval [1, 2, 3]-> sort()', 'E15:')
|
||||
|
@ -16,7 +16,7 @@ func ListMonths()
|
||||
if !empty(entered)
|
||||
let mth = filter(mth, 'v:val=~"^".entered')
|
||||
endif
|
||||
call complete(1, mth)
|
||||
call complete(1, mth)
|
||||
return ''
|
||||
endfunc
|
||||
|
||||
@ -74,7 +74,7 @@ func Test_popup_complete()
|
||||
call feedkeys("aJu\<f5>\<c-p>l\<c-y>", 'tx')
|
||||
call assert_equal(["Jul"], getline(1,2))
|
||||
%d
|
||||
|
||||
|
||||
" any-non printable, non-white character: Add this character and
|
||||
" reduce number of matches
|
||||
call feedkeys("aJu\<f5>\<c-p>l\<c-n>\<c-y>", 'tx')
|
||||
@ -96,7 +96,7 @@ func Test_popup_complete()
|
||||
call feedkeys("aJ\<f5>".repeat("\<c-n>",3)."\<c-l>\<esc>", 'tx')
|
||||
call assert_equal(["J"], getline(1,2))
|
||||
%d
|
||||
|
||||
|
||||
" <c-l> - Insert one character from the current match
|
||||
call feedkeys("aJ\<f5>".repeat("\<c-n>",4)."\<c-l>\<esc>", 'tx')
|
||||
call assert_equal(["January"], getline(1,2))
|
||||
@ -857,7 +857,7 @@ func Test_popup_position()
|
||||
call term_sendkeys(buf, "jI123456789_\<Esc>")
|
||||
call term_sendkeys(buf, "GA\<C-N>")
|
||||
call VerifyScreenDump(buf, 'Test_popup_position_04', {'rows': 10})
|
||||
|
||||
|
||||
call term_sendkeys(buf, "\<Esc>u")
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xtest')
|
||||
|
@ -1020,52 +1020,50 @@ endfunc
|
||||
|
||||
" More tests for 'errorformat'
|
||||
func Test_efm1()
|
||||
if !has('unix')
|
||||
" The 'errorformat' setting is different on non-Unix systems.
|
||||
" This test works only on Unix-like systems.
|
||||
return
|
||||
endif
|
||||
" The 'errorformat' setting is different on non-Unix systems.
|
||||
" This test works only on Unix-like systems.
|
||||
CheckUnix
|
||||
|
||||
let l =<< trim [DATA]
|
||||
"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.
|
||||
"Xtestfile", line 6 col 19; this is an error
|
||||
gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c
|
||||
Xtestfile:9: parse error before `asd'
|
||||
make: *** [src/vim/testdir/Makefile:100: test_quickfix] Error 1
|
||||
in file "Xtestfile" linenr 10: there is an error
|
||||
let l =<< trim [DATA]
|
||||
"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.
|
||||
"Xtestfile", line 6 col 19; this is an error
|
||||
gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c
|
||||
Xtestfile:9: parse error before `asd'
|
||||
make: *** [src/vim/testdir/Makefile:100: test_quickfix] Error 1
|
||||
in file "Xtestfile" linenr 10: there is an error
|
||||
|
||||
2 returned
|
||||
"Xtestfile", line 11 col 1; this is an error
|
||||
"Xtestfile", line 12 col 2; this is another error
|
||||
"Xtestfile", line 14:10; this is an error in column 10
|
||||
=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time
|
||||
"Xtestfile", linenr 16: yet another problem
|
||||
Error in "Xtestfile" at line 17:
|
||||
x should be a dot
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17
|
||||
^
|
||||
Error in "Xtestfile" at line 18:
|
||||
x should be a dot
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18
|
||||
.............^
|
||||
Error in "Xtestfile" at line 19:
|
||||
x should be a dot
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19
|
||||
--------------^
|
||||
Error in "Xtestfile" at line 20:
|
||||
x should be a dot
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20
|
||||
^
|
||||
2 returned
|
||||
"Xtestfile", line 11 col 1; this is an error
|
||||
"Xtestfile", line 12 col 2; this is another error
|
||||
"Xtestfile", line 14:10; this is an error in column 10
|
||||
=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time
|
||||
"Xtestfile", linenr 16: yet another problem
|
||||
Error in "Xtestfile" at line 17:
|
||||
x should be a dot
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17
|
||||
^
|
||||
Error in "Xtestfile" at line 18:
|
||||
x should be a dot
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18
|
||||
.............^
|
||||
Error in "Xtestfile" at line 19:
|
||||
x should be a dot
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19
|
||||
--------------^
|
||||
Error in "Xtestfile" at line 20:
|
||||
x should be a dot
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20
|
||||
^
|
||||
|
||||
Does anyone know what is the problem and how to correction it?
|
||||
"Xtestfile", line 21 col 9: What is the title of the quickfix window?
|
||||
"Xtestfile", line 22 col 9: What is the title of the quickfix window?
|
||||
[DATA]
|
||||
Does anyone know what is the problem and how to correction it?
|
||||
"Xtestfile", line 21 col 9: What is the title of the quickfix window?
|
||||
"Xtestfile", line 22 col 9: What is the title of the quickfix window?
|
||||
[DATA]
|
||||
|
||||
call writefile(l, 'Xerrorfile1')
|
||||
call writefile(l[:-2], 'Xerrorfile2')
|
||||
call writefile(l, 'Xerrorfile1')
|
||||
call writefile(l[:-2], 'Xerrorfile2')
|
||||
|
||||
let m =<< [DATA]
|
||||
let m =<< [DATA]
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4
|
||||
@ -1088,55 +1086,55 @@ func Test_efm1()
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22
|
||||
[DATA]
|
||||
call writefile(m, 'Xtestfile')
|
||||
call writefile(m, 'Xtestfile')
|
||||
|
||||
let save_efm = &efm
|
||||
set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m
|
||||
set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m
|
||||
let save_efm = &efm
|
||||
set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m
|
||||
set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m
|
||||
|
||||
exe 'cf Xerrorfile2'
|
||||
clast
|
||||
copen
|
||||
call assert_equal(':cf Xerrorfile2', w:quickfix_title)
|
||||
wincmd p
|
||||
exe 'cf Xerrorfile2'
|
||||
clast
|
||||
copen
|
||||
call assert_equal(':cf Xerrorfile2', w:quickfix_title)
|
||||
wincmd p
|
||||
|
||||
exe 'cf Xerrorfile1'
|
||||
call assert_equal([4, 12], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([6, 19], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([9, 2], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([10, 2], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([11, 1], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([12, 2], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([14, 10], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([15, 3, 10], [line('.'), col('.'), virtcol('.')])
|
||||
cn
|
||||
call assert_equal([16, 2], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([17, 6], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([18, 7], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([19, 8], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([20, 9], [line('.'), col('.')])
|
||||
clast
|
||||
cprev
|
||||
cprev
|
||||
wincmd w
|
||||
call assert_equal(':cf Xerrorfile1', w:quickfix_title)
|
||||
wincmd p
|
||||
exe 'cf Xerrorfile1'
|
||||
call assert_equal([4, 12], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([6, 19], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([9, 2], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([10, 2], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([11, 1], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([12, 2], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([14, 10], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([15, 3, 10], [line('.'), col('.'), virtcol('.')])
|
||||
cn
|
||||
call assert_equal([16, 2], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([17, 6], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([18, 7], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([19, 8], [line('.'), col('.')])
|
||||
cn
|
||||
call assert_equal([20, 9], [line('.'), col('.')])
|
||||
clast
|
||||
cprev
|
||||
cprev
|
||||
wincmd w
|
||||
call assert_equal(':cf Xerrorfile1', w:quickfix_title)
|
||||
wincmd p
|
||||
|
||||
let &efm = save_efm
|
||||
call delete('Xerrorfile1')
|
||||
call delete('Xerrorfile2')
|
||||
call delete('Xtestfile')
|
||||
let &efm = save_efm
|
||||
call delete('Xerrorfile1')
|
||||
call delete('Xerrorfile2')
|
||||
call delete('Xtestfile')
|
||||
endfunc
|
||||
|
||||
" Test for quickfix directory stack support
|
||||
@ -1410,7 +1408,7 @@ func Test_efm2()
|
||||
failUnlessEqual
|
||||
raise self.failureException, \\
|
||||
W:AssertionError: 34 != 33
|
||||
|
||||
|
||||
--------------------------------------------------------------
|
||||
Ran 27 tests in 0.063s
|
||||
[DATA]
|
||||
|
@ -1164,7 +1164,7 @@ func Test_compare_column_matchstr()
|
||||
" matchstr().
|
||||
enew
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
:3
|
||||
:3
|
||||
:/ee
|
||||
bwipe!
|
||||
set re=1
|
||||
|
@ -369,18 +369,18 @@ func Test_smoothscroll_wrap_long_line()
|
||||
call term_sendkeys(buf, ":set scrolloff=1\<CR>")
|
||||
call term_sendkeys(buf, "10|\<C-E>")
|
||||
call VerifyScreenDump(buf, 'Test_smooth_long_6', {})
|
||||
|
||||
|
||||
" 'scrolloff' set to 1, scrolling down, cursor moves screen line up
|
||||
call term_sendkeys(buf, "\<C-E>")
|
||||
call term_sendkeys(buf, "gjgj")
|
||||
call term_sendkeys(buf, "\<C-Y>")
|
||||
call VerifyScreenDump(buf, 'Test_smooth_long_7', {})
|
||||
|
||||
|
||||
" 'scrolloff' set to 2, scrolling up, cursor moves screen line down
|
||||
call term_sendkeys(buf, ":set scrolloff=2\<CR>")
|
||||
call term_sendkeys(buf, "10|\<C-E>")
|
||||
call VerifyScreenDump(buf, 'Test_smooth_long_8', {})
|
||||
|
||||
|
||||
" 'scrolloff' set to 2, scrolling down, cursor moves screen line up
|
||||
call term_sendkeys(buf, "\<C-E>")
|
||||
call term_sendkeys(buf, "gj")
|
||||
@ -421,7 +421,7 @@ func Test_smoothscroll_wrap_long_line()
|
||||
call term_sendkeys(buf, "3Gzt")
|
||||
call term_sendkeys(buf, "\<C-E>j")
|
||||
call VerifyScreenDump(buf, 'Test_smooth_long_16', {})
|
||||
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
@ -436,7 +436,7 @@ func Test_smoothscroll_one_long_line()
|
||||
call writefile(lines, 'XSmoothOneLong', 'D')
|
||||
let buf = RunVimInTerminal('-S XSmoothOneLong', #{rows: 6, cols: 40})
|
||||
call VerifyScreenDump(buf, 'Test_smooth_one_long_1', {})
|
||||
|
||||
|
||||
call term_sendkeys(buf, "\<C-E>")
|
||||
call VerifyScreenDump(buf, 'Test_smooth_one_long_2', {})
|
||||
|
||||
@ -458,7 +458,7 @@ func Test_smoothscroll_long_line_showbreak()
|
||||
call writefile(lines, 'XSmoothLongShowbreak', 'D')
|
||||
let buf = RunVimInTerminal('-S XSmoothLongShowbreak', #{rows: 6, cols: 40})
|
||||
call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {})
|
||||
|
||||
|
||||
call term_sendkeys(buf, "\<C-E>")
|
||||
call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_2', {})
|
||||
|
||||
@ -648,7 +648,7 @@ func Test_smoothscroll_cursor_scrolloff()
|
||||
call NewWindow(10, 20)
|
||||
setl smoothscroll wrap
|
||||
setl scrolloff=3
|
||||
|
||||
|
||||
" 120 chars are 6 screen lines
|
||||
call setline(1, "abcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRST")
|
||||
call setline(2, "below")
|
||||
|
@ -134,7 +134,7 @@ func Test_signal_TSTP()
|
||||
sleep 100m
|
||||
|
||||
" We resume after the suspend. Sleep a bit for the signal to take effect,
|
||||
" also when running under valgrind.
|
||||
" also when running under valgrind.
|
||||
exe 'silent !kill -s CONT ' .. pid_vim
|
||||
call WaitForAssert({-> assert_true(filereadable('XautoOut2'))})
|
||||
sleep 10m
|
||||
|
@ -1808,10 +1808,10 @@ func Test_sign_cursor_position()
|
||||
let lines =<< trim END
|
||||
call setline(1, [repeat('x', 75), 'mmmm', 'yyyy'])
|
||||
call cursor(2,1)
|
||||
sign define s1 texthl=Search text==>
|
||||
sign define s2 linehl=Pmenu
|
||||
sign define s1 texthl=Search text==>
|
||||
sign define s2 linehl=Pmenu
|
||||
redraw
|
||||
sign place 10 line=2 name=s1
|
||||
sign place 10 line=2 name=s1
|
||||
END
|
||||
call writefile(lines, 'XtestSigncolumn', 'D')
|
||||
let buf = RunVimInTerminal('-S XtestSigncolumn', {'rows': 6})
|
||||
|
@ -417,7 +417,7 @@ func Test_statusline()
|
||||
" Test statusline works with 80+ items
|
||||
function! StatusLabel()
|
||||
redrawstatus
|
||||
return '[label]'
|
||||
return '[label]'
|
||||
endfunc
|
||||
let statusline = '%{StatusLabel()}'
|
||||
for i in range(150)
|
||||
|
@ -743,7 +743,7 @@ func Test_sub_highlight_zero_match()
|
||||
endfunc
|
||||
|
||||
func Test_nocatch_sub_failure_handling()
|
||||
" normal error results in all replacements
|
||||
" normal error results in all replacements
|
||||
func Foo()
|
||||
foobar
|
||||
endfunc
|
||||
|
@ -89,11 +89,11 @@ func Test_tagfunc()
|
||||
return v:null
|
||||
endfunc
|
||||
set tags= tfu=NullTagFunc
|
||||
call assert_fails('tag nothing', 'E433')
|
||||
call assert_fails('tag nothing', 'E433:')
|
||||
delf NullTagFunc
|
||||
|
||||
bwipe!
|
||||
set tags& tfu& cpt&
|
||||
set tags& tfu& cpt&
|
||||
call delete('Xfile1')
|
||||
endfunc
|
||||
|
||||
|
@ -777,7 +777,7 @@ func Test_tag_guess()
|
||||
let code =<< trim [CODE]
|
||||
|
||||
int FUNC1 (int x) { }
|
||||
int
|
||||
int
|
||||
func2 (int y) { }
|
||||
int * func3 () { }
|
||||
|
||||
|
@ -348,8 +348,15 @@ endfunc
|
||||
" Test that the garbage collector isn't triggered if a timer callback invokes
|
||||
" vgetc().
|
||||
func Test_nocatch_timer_garbage_collect()
|
||||
" skipped: Nvim does not support test_garbagecollect_soon(), test_override()
|
||||
return
|
||||
" FIXME: why does this fail only on MacOS M1?
|
||||
try
|
||||
CheckNotMacM1
|
||||
throw 'Skipped: Nvim does not support test_garbagecollect_soon(), test_override()'
|
||||
catch /Skipped/
|
||||
let g:skipped_reason = v:exception
|
||||
return
|
||||
endtry
|
||||
|
||||
" 'uptimetime. must be bigger than the timer timeout
|
||||
set ut=200
|
||||
call test_garbagecollect_soon()
|
||||
|
@ -49,11 +49,11 @@ func Test_if()
|
||||
endfunc
|
||||
|
||||
function Try_arg_true_false(expr, false_val, true_val)
|
||||
for v in ['v:false', '0', '"0"', '"foo"', '" "']
|
||||
for v in ['v:false', '0', '"0"', '"foo"', '" "']
|
||||
let r = eval(substitute(a:expr, '%v%', v, ''))
|
||||
call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . string(a:false_val) . ' but ' . string(r))
|
||||
endfor
|
||||
for v in ['v:true', '1', '"1"', '"1foo"']
|
||||
for v in ['v:true', '1', '"1"', '"1foo"']
|
||||
let r = eval(substitute(a:expr, '%v%', v, ''))
|
||||
call assert_equal(a:true_val, r, 'result for ' . v . ' is not ' . string(a:true_val) . ' but ' . string(r))
|
||||
endfor
|
||||
@ -117,12 +117,11 @@ func Test_true_false_arg()
|
||||
endfunc
|
||||
|
||||
function Try_arg_non_zero(expr, false_val, true_val)
|
||||
CheckFeature float
|
||||
for v in ['v:false', '0', '[1]', '{2:3}', '3.4']
|
||||
for v in ['v:false', '0', '[1]', '{2:3}', '3.4']
|
||||
let r = eval(substitute(a:expr, '%v%', v, ''))
|
||||
call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . a:false_val . ' but ' . r)
|
||||
endfor
|
||||
for v in ['v:true', '1', '" "', '"0"']
|
||||
for v in ['v:true', '1', '" "', '"0"']
|
||||
let r = eval(substitute(a:expr, '%v%', v, ''))
|
||||
call assert_equal(a:true_val, r, 'result for ' . v . ' is not ' . a:true_val . ' but ' . r)
|
||||
endfor
|
||||
@ -138,14 +137,14 @@ func Test_non_zero_arg()
|
||||
call Try_arg_non_zero("shellescape('foo%', %v%)", "'foo%'", "'foo\\%'")
|
||||
|
||||
" visualmode() needs to be called twice to check
|
||||
for v in [v:false, 0, [1], {2:3}, 3.4]
|
||||
for v in [v:false, 0, [1], {2:3}, 3.4]
|
||||
normal vv
|
||||
let r = visualmode(v)
|
||||
call assert_equal('v', r, 'result for ' . string(v) . ' is not "v" but ' . r)
|
||||
let r = visualmode(v)
|
||||
call assert_equal('v', r, 'result for ' . string(v) . ' is not "v" but ' . r)
|
||||
endfor
|
||||
for v in [v:true, 1, " ", "0"]
|
||||
for v in [v:true, 1, " ", "0"]
|
||||
normal vv
|
||||
let r = visualmode(v)
|
||||
call assert_equal('v', r, 'result for ' . v . ' is not "v" but ' . r)
|
||||
|
@ -1,5 +1,5 @@
|
||||
" Tests for Unicode manipulations
|
||||
|
||||
|
||||
source check.vim
|
||||
source view_util.vim
|
||||
source screendump.vim
|
||||
@ -112,7 +112,7 @@ func Test_list2str_str2list_latin1()
|
||||
|
||||
let save_encoding = &encoding
|
||||
" set encoding=latin1
|
||||
|
||||
|
||||
let lres = str2list(s, 1)
|
||||
let sres = list2str(l, 1)
|
||||
call assert_equal([65, 66, 67], str2list("ABC"))
|
||||
|
@ -696,14 +696,14 @@ func Test_virtualedit_mouse()
|
||||
set virtualedit&
|
||||
endfunc
|
||||
|
||||
" this was replacing the NUL at the end of the line
|
||||
" this was replacing the NUL at the end of the line
|
||||
func Test_virtualedit_replace_after_tab()
|
||||
new
|
||||
s/\v/ 0
|
||||
set ve=all
|
||||
let @" = ''
|
||||
sil! norm vPvr0
|
||||
|
||||
|
||||
call assert_equal("\t0", getline(1))
|
||||
set ve&
|
||||
bwipe!
|
||||
|
@ -1170,8 +1170,8 @@ endfunc
|
||||
func Test_visual_put_in_block_using_zp()
|
||||
new
|
||||
" paste using zP
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
\ '/subdir',
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
\ '/subdir',
|
||||
\ '/longsubdir',
|
||||
\ '/longlongsubdir'])
|
||||
exe "normal! 5G\<c-v>2j$y"
|
||||
@ -1179,8 +1179,8 @@ func Test_visual_put_in_block_using_zp()
|
||||
call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3))
|
||||
%d
|
||||
" paste using zP
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
\ '/subdir',
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
\ '/subdir',
|
||||
\ '/longsubdir',
|
||||
\ '/longlongsubdir'])
|
||||
exe "normal! 5G\<c-v>2j$y"
|
||||
@ -1193,7 +1193,7 @@ func Test_visual_put_in_block_using_zy_and_zp()
|
||||
new
|
||||
|
||||
" Test 1) Paste using zp - after the cursor without trailing spaces
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
\ 'texttext /subdir columntext',
|
||||
\ 'texttext /longsubdir columntext',
|
||||
\ 'texttext /longlongsubdir columntext'])
|
||||
@ -1203,7 +1203,7 @@ func Test_visual_put_in_block_using_zy_and_zp()
|
||||
|
||||
" Test 2) Paste using zP - in front of the cursor without trailing spaces
|
||||
%d
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
\ 'texttext /subdir columntext',
|
||||
\ 'texttext /longsubdir columntext',
|
||||
\ 'texttext /longlongsubdir columntext'])
|
||||
@ -1213,7 +1213,7 @@ func Test_visual_put_in_block_using_zy_and_zp()
|
||||
|
||||
" Test 3) Paste using p - with trailing spaces
|
||||
%d
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
\ 'texttext /subdir columntext',
|
||||
\ 'texttext /longsubdir columntext',
|
||||
\ 'texttext /longlongsubdir columntext'])
|
||||
@ -1223,7 +1223,7 @@ func Test_visual_put_in_block_using_zy_and_zp()
|
||||
|
||||
" Test 4) Paste using P - with trailing spaces
|
||||
%d
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
\ 'texttext /subdir columntext',
|
||||
\ 'texttext /longsubdir columntext',
|
||||
\ 'texttext /longlongsubdir columntext'])
|
||||
@ -1233,7 +1233,7 @@ func Test_visual_put_in_block_using_zy_and_zp()
|
||||
|
||||
" Test 5) Yank with spaces inside the block
|
||||
%d
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
call setline(1, ['/path;text', '/path;text', '/path;text', '',
|
||||
\ 'texttext /sub dir/ columntext',
|
||||
\ 'texttext /lon gsubdir/ columntext',
|
||||
\ 'texttext /lon glongsubdir/ columntext'])
|
||||
|
@ -223,7 +223,7 @@ func Test_window_close_splitright_noequalalways()
|
||||
execute "normal \<c-w>b"
|
||||
let h = winheight(0)
|
||||
let w = win_getid()
|
||||
new
|
||||
new
|
||||
q
|
||||
call assert_equal(h, winheight(0), "Window height does not match eight before opening and closing another window")
|
||||
call assert_equal(w, win_getid(), "Did not return to original window after opening and closing a window")
|
||||
|
Loading…
Reference in New Issue
Block a user