mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #6191 from jamessan/vim-42ebd06
vim-patch:42ebd06,7.4.2098,6f1d9a0,7.4.2095
This commit is contained in:
commit
2872e57af2
@ -1197,7 +1197,7 @@ lambda expression *expr-lambda* *lambda*
|
|||||||
{args -> expr1} lambda expression
|
{args -> expr1} lambda expression
|
||||||
|
|
||||||
A lambda expression creates a new unnamed function which returns the result of
|
A lambda expression creates a new unnamed function which returns the result of
|
||||||
evaluating |expr1|. Lambda expressions are differ from |user-functions| in
|
evaluating |expr1|. Lambda expressions differ from |user-functions| in
|
||||||
the following ways:
|
the following ways:
|
||||||
|
|
||||||
1. The body of the lambda expression is an |expr1| and not a sequence of |Ex|
|
1. The body of the lambda expression is an |expr1| and not a sequence of |Ex|
|
||||||
@ -1946,6 +1946,8 @@ assert_equal({exp}, {act} [, {msg}]) none assert {exp} is equal to {act}
|
|||||||
assert_exception( {error} [, {msg}]) none assert {error} is in v:exception
|
assert_exception( {error} [, {msg}]) none assert {error} is in v:exception
|
||||||
assert_fails( {cmd} [, {error}]) none assert {cmd} fails
|
assert_fails( {cmd} [, {error}]) none assert {cmd} fails
|
||||||
assert_false({actual} [, {msg}]) none assert {actual} is false
|
assert_false({actual} [, {msg}]) none assert {actual} is false
|
||||||
|
assert_inrange({lower}, {upper}, {actual} [, {msg}])
|
||||||
|
none assert {actual} is inside the range
|
||||||
assert_match( {pat}, {text} [, {msg}]) none assert {pat} matches {text}
|
assert_match( {pat}, {text} [, {msg}]) none assert {pat} matches {text}
|
||||||
assert_notequal( {exp}, {act} [, {msg}]) none assert {exp} is not equal {act}
|
assert_notequal( {exp}, {act} [, {msg}]) none assert {exp} is not equal {act}
|
||||||
assert_notmatch( {pat}, {text} [, {msg}]) none assert {pat} not matches {text}
|
assert_notmatch( {pat}, {text} [, {msg}]) none assert {pat} not matches {text}
|
||||||
@ -2460,8 +2462,16 @@ assert_false({actual} [, {msg}]) *assert_false()*
|
|||||||
|v:errors|, like with |assert_equal()|.
|
|v:errors|, like with |assert_equal()|.
|
||||||
A value is false when it is zero or |v:false|. When "{actual}"
|
A value is false when it is zero or |v:false|. When "{actual}"
|
||||||
is not a number or |v:false| the assert fails.
|
is not a number or |v:false| the assert fails.
|
||||||
When {msg} is omitted an error in the form "Expected False but
|
When {msg} is omitted an error in the form
|
||||||
got {actual}" is produced.
|
"Expected False but got {actual}" is produced.
|
||||||
|
|
||||||
|
assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()*
|
||||||
|
This asserts number values. When {actual} is lower than
|
||||||
|
{lower} or higher than {upper} an error message is added to
|
||||||
|
|v:errors|.
|
||||||
|
When {msg} is omitted an error in the form
|
||||||
|
"Expected range {lower} - {upper}, but got {actual}" is
|
||||||
|
produced.
|
||||||
|
|
||||||
*assert_match()*
|
*assert_match()*
|
||||||
assert_match({pattern}, {actual} [, {msg}])
|
assert_match({pattern}, {actual} [, {msg}])
|
||||||
@ -2476,8 +2486,8 @@ assert_match({pattern}, {actual} [, {msg}])
|
|||||||
Use "^" and "$" to match with the start and end of the text.
|
Use "^" and "$" to match with the start and end of the text.
|
||||||
Use both to match the whole text.
|
Use both to match the whole text.
|
||||||
|
|
||||||
When {msg} is omitted an error in the form "Pattern {pattern}
|
When {msg} is omitted an error in the form
|
||||||
does not match {actual}" is produced.
|
"Pattern {pattern} does not match {actual}" is produced.
|
||||||
Example: >
|
Example: >
|
||||||
assert_match('^f.*o$', 'foobar')
|
assert_match('^f.*o$', 'foobar')
|
||||||
< Will result in a string to be added to |v:errors|:
|
< Will result in a string to be added to |v:errors|:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*index.txt* For Vim version 7.4. Last change: 2016 Jun 12
|
*index.txt* For Vim version 7.4. Last change: 2016 Jul 16
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -1152,6 +1152,7 @@ tag command action ~
|
|||||||
|:chdir| :chd[ir] change directory
|
|:chdir| :chd[ir] change directory
|
||||||
|:checkpath| :che[ckpath] list included files
|
|:checkpath| :che[ckpath] list included files
|
||||||
|:checktime| :checkt[ime] check timestamp of loaded buffers
|
|:checktime| :checkt[ime] check timestamp of loaded buffers
|
||||||
|
|:chistory| :chi[story] list the error lists
|
||||||
|:clast| :cla[st] go to the specified error, default last one
|
|:clast| :cla[st] go to the specified error, default last one
|
||||||
|:clearjumps| :cle[arjumps] clear the jump list
|
|:clearjumps| :cle[arjumps] clear the jump list
|
||||||
|:clist| :cl[ist] list all errors
|
|:clist| :cl[ist] list all errors
|
||||||
@ -1313,6 +1314,7 @@ tag command action ~
|
|||||||
|:lgrep| :lgr[ep] run 'grepprg' and jump to first match
|
|:lgrep| :lgr[ep] run 'grepprg' and jump to first match
|
||||||
|:lgrepadd| :lgrepa[dd] like :grep, but append to current list
|
|:lgrepadd| :lgrepa[dd] like :grep, but append to current list
|
||||||
|:lhelpgrep| :lh[elpgrep] like ":helpgrep" but uses location list
|
|:lhelpgrep| :lh[elpgrep] like ":helpgrep" but uses location list
|
||||||
|
|:lhistory| :lhi[story] list the location lists
|
||||||
|:ll| :ll go to specific location
|
|:ll| :ll go to specific location
|
||||||
|:llast| :lla[st] go to the specified location, default last one
|
|:llast| :lla[st] go to the specified location, default last one
|
||||||
|:llist| :lli[st] list all locations
|
|:llist| :lli[st] list all locations
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*message.txt* For Vim version 7.4. Last change: 2016 Jul 14
|
*message.txt* For Vim version 7.4. Last change: 2016 Jul 16
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -668,7 +668,7 @@ Vim and restart it.
|
|||||||
*E931* >
|
*E931* >
|
||||||
Buffer cannot be registered
|
Buffer cannot be registered
|
||||||
|
|
||||||
Out of memory or a duplicate buffer number. May habben after W14. Looking up
|
Out of memory or a duplicate buffer number. May happen after W14. Looking up
|
||||||
a buffer will not always work, better restart Vim.
|
a buffer will not always work, better restart Vim.
|
||||||
|
|
||||||
*E296* *E297* >
|
*E296* *E297* >
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 07
|
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 17
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -525,7 +525,7 @@ lists. They set one of the existing error lists as the current one.
|
|||||||
list, an error message is given.
|
list, an error message is given.
|
||||||
|
|
||||||
*:lolder* *:lol*
|
*:lolder* *:lol*
|
||||||
:lol[der] [count] Same as ":colder", except use the location list for
|
:lol[der] [count] Same as `:colder`, except use the location list for
|
||||||
the current window instead of the quickfix list.
|
the current window instead of the quickfix list.
|
||||||
|
|
||||||
*:cnewer* *:cnew* *E381*
|
*:cnewer* *:cnew* *E381*
|
||||||
@ -534,9 +534,20 @@ lists. They set one of the existing error lists as the current one.
|
|||||||
list, an error message is given.
|
list, an error message is given.
|
||||||
|
|
||||||
*:lnewer* *:lnew*
|
*:lnewer* *:lnew*
|
||||||
:lnew[er] [count] Same as ":cnewer", except use the location list for
|
:lnew[er] [count] Same as `:cnewer`, except use the location list for
|
||||||
the current window instead of the quickfix list.
|
the current window instead of the quickfix list.
|
||||||
|
|
||||||
|
*:chistory* *:chi*
|
||||||
|
:chi[story] Show the list of error lists. The current list is
|
||||||
|
marked with ">". The output looks like:
|
||||||
|
error list 1 of 3; 43 errors ~
|
||||||
|
> error list 2 of 3; 0 errors ~
|
||||||
|
error list 3 of 3; 15 errors ~
|
||||||
|
|
||||||
|
*:lhistory* *:lhi*
|
||||||
|
:lhi[story] Show the list of location lists, otherwise like
|
||||||
|
`:chistory`.
|
||||||
|
|
||||||
When adding a new error list, it becomes the current list.
|
When adding a new error list, it becomes the current list.
|
||||||
|
|
||||||
When ":colder" has been used and ":make" or ":grep" is used to add a new error
|
When ":colder" has been used and ":make" or ":grep" is used to add a new error
|
||||||
|
@ -2642,6 +2642,8 @@ au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby')
|
|||||||
" Mail (also matches muttrc.vim, so this is below the other checks)
|
" Mail (also matches muttrc.vim, so this is below the other checks)
|
||||||
au BufNewFile,BufRead mutt[[:alnum:]._-]\\\{6\} setf mail
|
au BufNewFile,BufRead mutt[[:alnum:]._-]\\\{6\} setf mail
|
||||||
|
|
||||||
|
au BufNewFile,BufRead reportbug-* call s:StarSetf('mail')
|
||||||
|
|
||||||
" Modconf
|
" Modconf
|
||||||
au BufNewFile,BufRead */etc/modutils/*
|
au BufNewFile,BufRead */etc/modutils/*
|
||||||
\ if executable(expand("<afile>")) != 1
|
\ if executable(expand("<afile>")) != 1
|
||||||
|
@ -188,7 +188,7 @@ an 20.435 &Edit.Startup\ &Settings :call <SID>EditVimrc()<CR>
|
|||||||
fun! s:EditVimrc()
|
fun! s:EditVimrc()
|
||||||
if $MYVIMRC != ''
|
if $MYVIMRC != ''
|
||||||
let fname = $MYVIMRC
|
let fname = $MYVIMRC
|
||||||
elseif has("win32") || has("dos32") || has("dos16")
|
elseif has("win32")
|
||||||
if $HOME != ''
|
if $HOME != ''
|
||||||
let fname = $HOME . "/_vimrc"
|
let fname = $HOME . "/_vimrc"
|
||||||
else
|
else
|
||||||
@ -552,7 +552,7 @@ endfun
|
|||||||
func! s:XxdFind()
|
func! s:XxdFind()
|
||||||
if !exists("g:xxdprogram")
|
if !exists("g:xxdprogram")
|
||||||
" On the PC xxd may not be in the path but in the install directory
|
" On the PC xxd may not be in the path but in the install directory
|
||||||
if (has("win32") || has("dos32")) && !executable("xxd")
|
if has("win32") && !executable("xxd")
|
||||||
let g:xxdprogram = $VIMRUNTIME . (&shellslash ? '/' : '\') . "xxd.exe"
|
let g:xxdprogram = $VIMRUNTIME . (&shellslash ? '/' : '\') . "xxd.exe"
|
||||||
else
|
else
|
||||||
let g:xxdprogram = "xxd"
|
let g:xxdprogram = "xxd"
|
||||||
|
@ -8111,6 +8111,30 @@ static void f_assert_fails(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
set_vim_var_string(VV_ERRMSG, NULL, 0);
|
set_vim_var_string(VV_ERRMSG, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void assert_inrange(typval_T *argvars)
|
||||||
|
{
|
||||||
|
int error = (int)false;
|
||||||
|
varnumber_T lower = get_tv_number_chk(&argvars[0], &error);
|
||||||
|
varnumber_T upper = get_tv_number_chk(&argvars[1], &error);
|
||||||
|
varnumber_T actual = get_tv_number_chk(&argvars[2], &error);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (actual < lower || actual > upper) {
|
||||||
|
garray_T ga;
|
||||||
|
prepare_assert_error(&ga);
|
||||||
|
|
||||||
|
char msg[55];
|
||||||
|
vim_snprintf(msg, sizeof(msg), "range %" PRId64 " - %" PRId64 ",",
|
||||||
|
(int64_t)lower, (int64_t)upper);
|
||||||
|
fill_assert_error(&ga, &argvars[3], (char_u *)msg, NULL, &argvars[2],
|
||||||
|
ASSERT_INRANGE);
|
||||||
|
assert_error(&ga);
|
||||||
|
ga_clear(&ga);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Common for assert_true() and assert_false().
|
// Common for assert_true() and assert_false().
|
||||||
static void assert_bool(typval_T *argvars, bool is_true)
|
static void assert_bool(typval_T *argvars, bool is_true)
|
||||||
{
|
{
|
||||||
@ -8158,6 +8182,12 @@ static void assert_match_common(typval_T *argvars, assert_type_T atype)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// "assert_inrange(lower, upper[, msg])" function
|
||||||
|
static void f_assert_inrange(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||||
|
{
|
||||||
|
assert_inrange(argvars);
|
||||||
|
}
|
||||||
|
|
||||||
/// "assert_match(pattern, actual[, msg])" function
|
/// "assert_match(pattern, actual[, msg])" function
|
||||||
static void f_assert_match(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
static void f_assert_match(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,7 @@ return {
|
|||||||
assert_exception={args={1, 2}},
|
assert_exception={args={1, 2}},
|
||||||
assert_fails={args={1, 2}},
|
assert_fails={args={1, 2}},
|
||||||
assert_false={args={1, 2}},
|
assert_false={args={1, 2}},
|
||||||
|
assert_inrange={args={2, 3}},
|
||||||
assert_match={args={2, 3}},
|
assert_match={args={2, 3}},
|
||||||
assert_notequal={args={2, 3}},
|
assert_notequal={args={2, 3}},
|
||||||
assert_notmatch={args={2, 3}},
|
assert_notmatch={args={2, 3}},
|
||||||
|
@ -278,6 +278,7 @@ typedef enum
|
|||||||
ASSERT_NOTEQUAL,
|
ASSERT_NOTEQUAL,
|
||||||
ASSERT_MATCH,
|
ASSERT_MATCH,
|
||||||
ASSERT_NOTMATCH,
|
ASSERT_NOTMATCH,
|
||||||
|
ASSERT_INRANGE,
|
||||||
ASSERT_OTHER,
|
ASSERT_OTHER,
|
||||||
} assert_type_T;
|
} assert_type_T;
|
||||||
|
|
||||||
|
@ -41,13 +41,14 @@ NEW_TESTS ?= \
|
|||||||
test_history.res \
|
test_history.res \
|
||||||
test_increment.res \
|
test_increment.res \
|
||||||
test_increment_dbcs.res \
|
test_increment_dbcs.res \
|
||||||
test_lambda.res \
|
test_lambda.res \
|
||||||
test_langmap.res \
|
test_langmap.res \
|
||||||
test_match.res \
|
test_match.res \
|
||||||
test_matchadd_conceal.res \
|
test_matchadd_conceal.res \
|
||||||
test_quickfix.res \
|
test_quickfix.res \
|
||||||
test_signs.res \
|
test_signs.res \
|
||||||
test_syntax.res \
|
test_syntax.res \
|
||||||
|
test_textobjects.res \
|
||||||
test_timers.res \
|
test_timers.res \
|
||||||
test_usercommands.res \
|
test_usercommands.res \
|
||||||
test_viml.res \
|
test_viml.res \
|
||||||
|
43
src/nvim/testdir/test_textobjects.vim
Normal file
43
src/nvim/testdir/test_textobjects.vim
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
" Test for textobjects
|
||||||
|
|
||||||
|
if !has('textobjects')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! CpoM(line, useM, expected)
|
||||||
|
new
|
||||||
|
|
||||||
|
if a:useM
|
||||||
|
set cpoptions+=M
|
||||||
|
else
|
||||||
|
set cpoptions-=M
|
||||||
|
endif
|
||||||
|
|
||||||
|
call setline(1, a:line)
|
||||||
|
|
||||||
|
call setreg('"', '')
|
||||||
|
normal! ggfrmavi)y
|
||||||
|
call assert_equal(getreg('"'), a:expected[0])
|
||||||
|
|
||||||
|
call setreg('"', '')
|
||||||
|
normal! `afbmavi)y
|
||||||
|
call assert_equal(getreg('"'), a:expected[1])
|
||||||
|
|
||||||
|
call setreg('"', '')
|
||||||
|
normal! `afgmavi)y
|
||||||
|
call assert_equal(getreg('"'), a:expected[2])
|
||||||
|
|
||||||
|
q!
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! Test_inner_block_without_cpo_M()
|
||||||
|
call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', ''])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! Test_inner_block_with_cpo_M_left_backslash()
|
||||||
|
call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red \(blue) green'])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! Test_inner_block_with_cpo_M_right_backslash()
|
||||||
|
call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green'])
|
||||||
|
endfunction
|
@ -342,10 +342,10 @@ static int included_patches[] = {
|
|||||||
// 2101,
|
// 2101,
|
||||||
2100,
|
2100,
|
||||||
2099,
|
2099,
|
||||||
// 2098,
|
2098,
|
||||||
// 2097,
|
// 2097,
|
||||||
2096,
|
2096,
|
||||||
// 2095,
|
2095,
|
||||||
// 2094 NA
|
// 2094 NA
|
||||||
// 2093 NA
|
// 2093 NA
|
||||||
// 2092 NA
|
// 2092 NA
|
||||||
|
@ -235,6 +235,26 @@ describe('assert function:', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- assert_inrange({lower}, {upper}, {actual}[, {msg}])
|
||||||
|
describe('assert_inrange()', function()
|
||||||
|
it('should not change v:errors when actual is in range', function()
|
||||||
|
call('assert_inrange', 7, 7, 7)
|
||||||
|
call('assert_inrange', 5, 7, 5)
|
||||||
|
call('assert_inrange', 5, 7, 6)
|
||||||
|
call('assert_inrange', 5, 7, 7)
|
||||||
|
expected_empty()
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('should change v:errors when actual is not in range', function()
|
||||||
|
call('assert_inrange', 5, 7, 4)
|
||||||
|
call('assert_inrange', 5, 7, 8)
|
||||||
|
expected_errors({
|
||||||
|
"Expected range 5 - 7, but got 4",
|
||||||
|
"Expected range 5 - 7, but got 8",
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
-- assert_exception({cmd}, [, {error}])
|
-- assert_exception({cmd}, [, {error}])
|
||||||
describe('assert_exception()', function()
|
describe('assert_exception()', function()
|
||||||
it('should assert thrown exceptions properly', function()
|
it('should assert thrown exceptions properly', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user