mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 08:18:17 +00:00
vim-patch:7.4.2333
Problem: Outdated comments in test.
Solution: Cleanup normal mode test. (Christian Brabandt)
31845093b7
This commit is contained in:
@@ -3847,6 +3847,7 @@ fex_format (
|
|||||||
int use_sandbox = was_set_insecurely((char_u *)"formatexpr",
|
int use_sandbox = was_set_insecurely((char_u *)"formatexpr",
|
||||||
OPT_LOCAL);
|
OPT_LOCAL);
|
||||||
int r;
|
int r;
|
||||||
|
char_u *fex;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set v:lnum to the first line number and v:count to the number of lines.
|
* Set v:lnum to the first line number and v:count to the number of lines.
|
||||||
@@ -3856,16 +3857,22 @@ fex_format (
|
|||||||
set_vim_var_nr(VV_COUNT, (varnumber_T)count);
|
set_vim_var_nr(VV_COUNT, (varnumber_T)count);
|
||||||
set_vim_var_char(c);
|
set_vim_var_char(c);
|
||||||
|
|
||||||
|
// Make a copy, the option could be changed while calling it.
|
||||||
|
fex = vim_strsave(curbuf->b_p_fex);
|
||||||
|
if (fex == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Evaluate the function.
|
* Evaluate the function.
|
||||||
*/
|
*/
|
||||||
if (use_sandbox)
|
if (use_sandbox)
|
||||||
++sandbox;
|
++sandbox;
|
||||||
r = eval_to_number(curbuf->b_p_fex);
|
r = (int)eval_to_number(fex);
|
||||||
if (use_sandbox)
|
if (use_sandbox)
|
||||||
--sandbox;
|
--sandbox;
|
||||||
|
|
||||||
set_vim_var_string(VV_CHAR, NULL, -1);
|
set_vim_var_string(VV_CHAR, NULL, -1);
|
||||||
|
xfree(fex);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@@ -36,47 +36,14 @@ function! CountSpaces(type, ...)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
fun! Test_normal00_optrans()
|
fun! Test_normal00_optrans()
|
||||||
" Attention: This needs to be the very first test,
|
|
||||||
" it will fail, if it runs later, don't know why!
|
|
||||||
" Test for S s and alike comamnds, that are internally handled aliased
|
|
||||||
new
|
new
|
||||||
call append(0, ['1 This is a simple test: abcd', '2 This is the second line', '3 this is the third line'])
|
call append(0, ['1 This is a simple test: abcd', '2 This is the second line', '3 this is the third line'])
|
||||||
1
|
1
|
||||||
exe "norm! Sfoobar\<esc>"
|
exe "norm! Sfoobar\<esc>"
|
||||||
call assert_equal(['foobar', '2 This is the second line', '3 this is the third line', ''], getline(1,'$'))
|
call assert_equal(['foobar', '2 This is the second line', '3 this is the third line', ''], getline(1,'$'))
|
||||||
2
|
2
|
||||||
" Test does not work
|
|
||||||
" TODO: Why does it not work?
|
|
||||||
" Adds an additional linebreak if used in visual mode...
|
|
||||||
" When run in the test, this returns:
|
|
||||||
" ,--------
|
|
||||||
" |foobar
|
|
||||||
" |2 This is
|
|
||||||
" |the second
|
|
||||||
" |one
|
|
||||||
" |3 this is the third line
|
|
||||||
" `-----------
|
|
||||||
" instead of
|
|
||||||
" ,--------
|
|
||||||
" |foobar
|
|
||||||
" |2 This is the second one
|
|
||||||
" |3 this is the third line
|
|
||||||
" `-----------
|
|
||||||
exe "norm! $vbsone"
|
exe "norm! $vbsone"
|
||||||
call assert_equal(['foobar', '2 This is the second one', '3 this is the third line', ''], getline(1,'$'))
|
call assert_equal(['foobar', '2 This is the second one', '3 this is the third line', ''], getline(1,'$'))
|
||||||
" When run in the test, this returns:
|
|
||||||
" ,--------
|
|
||||||
" |foobar
|
|
||||||
" |Second line
|
|
||||||
" |here
|
|
||||||
" |3 this is the third line
|
|
||||||
" `-----------
|
|
||||||
" instead of
|
|
||||||
" ,--------
|
|
||||||
" |foobar
|
|
||||||
" |Second line here
|
|
||||||
" |3 this is the third line
|
|
||||||
" `-----------
|
|
||||||
norm! VS Second line here
|
norm! VS Second line here
|
||||||
call assert_equal(['foobar', ' Second line here', '3 this is the third line', ''], getline(1, '$'))
|
call assert_equal(['foobar', ' Second line here', '3 this is the third line', ''], getline(1, '$'))
|
||||||
%d
|
%d
|
||||||
@@ -192,6 +159,30 @@ func! Test_normal05_formatexpr()
|
|||||||
bw!
|
bw!
|
||||||
endfu
|
endfu
|
||||||
|
|
||||||
|
func Test_normal05_formatexpr_newbuf()
|
||||||
|
" Edit another buffer in the 'formatexpr' function
|
||||||
|
new
|
||||||
|
func! Format()
|
||||||
|
edit another
|
||||||
|
endfunc
|
||||||
|
set formatexpr=Format()
|
||||||
|
norm gqG
|
||||||
|
bw!
|
||||||
|
set formatexpr=
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_normal05_formatexpr_setopt()
|
||||||
|
" Change the 'formatexpr' value in the function
|
||||||
|
new
|
||||||
|
func! Format()
|
||||||
|
set formatexpr=
|
||||||
|
endfunc
|
||||||
|
set formatexpr=Format()
|
||||||
|
norm gqG
|
||||||
|
bw!
|
||||||
|
set formatexpr=
|
||||||
|
endfunc
|
||||||
|
|
||||||
func! Test_normal06_formatprg()
|
func! Test_normal06_formatprg()
|
||||||
" basic test for formatprg
|
" basic test for formatprg
|
||||||
" only test on non windows platform
|
" only test on non windows platform
|
||||||
@@ -224,7 +215,7 @@ func! Test_normal07_internalfmt()
|
|||||||
norm! gggqG
|
norm! gggqG
|
||||||
call assert_equal(['1 2 3', '4 5 6', '7 8 9', '10 11 '], getline(1, '$'))
|
call assert_equal(['1 2 3', '4 5 6', '7 8 9', '10 11 '], getline(1, '$'))
|
||||||
" clean up
|
" clean up
|
||||||
set formatprg=
|
set formatprg= tw=0
|
||||||
bw!
|
bw!
|
||||||
endfu
|
endfu
|
||||||
|
|
||||||
@@ -1695,7 +1686,7 @@ fun! Test_normal35_g_cmd4()
|
|||||||
" Test for g<
|
" Test for g<
|
||||||
" Cannot capture its output,
|
" Cannot capture its output,
|
||||||
" probably a bug, therefore, test disabled:
|
" probably a bug, therefore, test disabled:
|
||||||
return
|
throw "Skipped: output of g< can't be tested currently"
|
||||||
echo "a\nb\nc\nd"
|
echo "a\nb\nc\nd"
|
||||||
let b=execute(':norm! g<')
|
let b=execute(':norm! g<')
|
||||||
call assert_true(!empty(b), 'failed `execute(g<)`')
|
call assert_true(!empty(b), 'failed `execute(g<)`')
|
||||||
@@ -1853,7 +1844,7 @@ fun! Test_normal41_insert_reg()
|
|||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
set sts=0 sw=8 ts=8
|
set sts=0 sw=8 ts=8
|
||||||
"bw!
|
bw!
|
||||||
endfu
|
endfu
|
||||||
|
|
||||||
func! Test_normal42_halfpage()
|
func! Test_normal42_halfpage()
|
||||||
|
@@ -108,7 +108,7 @@ static int included_patches[] = {
|
|||||||
// 2336,
|
// 2336,
|
||||||
2335,
|
2335,
|
||||||
// 2334,
|
// 2334,
|
||||||
// 2333,
|
2333,
|
||||||
// 2332 NA
|
// 2332 NA
|
||||||
2331,
|
2331,
|
||||||
// 2330,
|
// 2330,
|
||||||
@@ -118,7 +118,7 @@ static int included_patches[] = {
|
|||||||
2326,
|
2326,
|
||||||
// 2325 NA
|
// 2325 NA
|
||||||
// 2324,
|
// 2324,
|
||||||
// 2323,
|
2323,
|
||||||
2322,
|
2322,
|
||||||
2321,
|
2321,
|
||||||
// 2320,
|
// 2320,
|
||||||
|
Reference in New Issue
Block a user