mirror of
https://github.com/neovim/neovim.git
synced 2026-02-20 01:09:56 +10:00
Merge #3857 'Vim 7.4.{944,945,946,950,953,1032,1055}'.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.4. Last change: 2015 Jan 29
|
||||
*eval.txt* For Vim version 7.4. Last change: 2015 Nov 30
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1375,6 +1375,15 @@ v:errmsg Last given error message. It's allowed to set this variable.
|
||||
: ... handle error
|
||||
< "errmsg" also works, for backwards compatibility.
|
||||
|
||||
*v:errors* *errors-variable*
|
||||
v:errors Errors found by assert functions, such as |assert_true()|.
|
||||
This is a list of strings.
|
||||
The assert functions append an item when an assert fails.
|
||||
To remove old results make it empty: >
|
||||
:let v:errors = []
|
||||
< If v:errors is set to anything but a list it is made an empty
|
||||
list by the assert function.
|
||||
|
||||
*v:exception* *exception-variable*
|
||||
v:exception The value of the exception most recently caught and not
|
||||
finished. See also |v:throwpoint| and |throw-variables|.
|
||||
@@ -1728,10 +1737,13 @@ append( {lnum}, {string}) Number append {string} below line {lnum}
|
||||
append( {lnum}, {list}) Number append lines {list} below line {lnum}
|
||||
argc() Number number of files in the argument list
|
||||
argidx() Number current index in the argument list
|
||||
arglistid( [{winnr}, [ {tabnr}]])
|
||||
arglistid( [{winnr} [, {tabnr}]])
|
||||
Number argument list id
|
||||
argv( {nr}) String {nr} entry of the argument list
|
||||
argv( ) List the argument list
|
||||
assert_equal( {exp}, {act} [, {msg}]) none assert that {exp} equals {act}
|
||||
assert_false( {actual} [, {msg}]) none assert that {actual} is false
|
||||
assert_true( {actual} [, {msg}]) none assert that {actual} is true
|
||||
asin( {expr}) Float arc sine of {expr}
|
||||
atan( {expr}) Float arc tangent of {expr}
|
||||
atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2}
|
||||
@@ -2161,6 +2173,37 @@ argv([{nr}]) The result is the {nr}th file in the argument list of the
|
||||
< Without the {nr} argument a |List| with the whole |arglist| is
|
||||
returned.
|
||||
|
||||
*assert_equal()*
|
||||
assert_equal({expected}, {actual}, [, {msg}])
|
||||
When {expected} and {actual} are not equal an error message is
|
||||
added to |v:errors|.
|
||||
There is no automatic conversion, the String "4" is different
|
||||
from the Number 4. And the number 4 is different from the
|
||||
Float 4.0. The value of 'ignorecase' is not used here, case
|
||||
always matters.
|
||||
When {msg} is omitted an error in the form "Expected
|
||||
{expected} but got {actual}" is produced.
|
||||
Example: >
|
||||
assert_equal('foo', 'bar')
|
||||
< Will result in a string to be added to |v:errors|:
|
||||
test.vim line 12: Expected 'foo' but got 'bar' ~
|
||||
|
||||
assert_false({actual}, [, {msg}]) *assert_false()*
|
||||
When {actual} is not false an error message is added to
|
||||
|v:errors|, like with |assert_equal()|..
|
||||
A value is false when it is zero. When "{actual}" is not a
|
||||
number the assert fails.
|
||||
When {msg} is omitted an error in the form "Expected False but
|
||||
got {actual}" is produced.
|
||||
|
||||
assert_true({actual}, [, {msg}]) *assert_true()*
|
||||
When {actual} is not true an error message is added to
|
||||
|v:errors|, like with |assert_equal()|..
|
||||
A value is true when it is a non-zeron number. When {actual}
|
||||
is not a number the assert fails.
|
||||
When {msg} is omitted an error in the form "Expected True but
|
||||
got {actual}" is produced.
|
||||
|
||||
asin({expr}) *asin()*
|
||||
Return the arc sine of {expr} measured in radians, as a |Float|
|
||||
in the range of [-pi/2, pi/2].
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 7.4. Last change: 2014 Aug 16
|
||||
*usr_41.txt* For Vim version 7.4. Last change: 2015 Nov 30
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -888,6 +888,11 @@ Mappings: *mapping-functions*
|
||||
maparg() get rhs of a mapping
|
||||
wildmenumode() check if the wildmode is active
|
||||
|
||||
Testing: *test-functions*
|
||||
assert_equal() assert that two expressions values are equal
|
||||
assert_false() assert that an expression is false
|
||||
assert_true() assert that an expression is true
|
||||
|
||||
Various: *various-functions*
|
||||
mode() get current editing mode
|
||||
visualmode() last visual mode used
|
||||
|
||||
815
src/nvim/eval.c
815
src/nvim/eval.c
@@ -313,70 +313,71 @@ static struct vimvar {
|
||||
* The order here must match the VV_ defines in eval.h!
|
||||
* Initializing a union does not work, leave tv.vval empty to get zero's.
|
||||
*/
|
||||
{VV_NAME("count", VAR_NUMBER), VV_COMPAT+VV_RO},
|
||||
{VV_NAME("count1", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("prevcount", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("errmsg", VAR_STRING), VV_COMPAT},
|
||||
{VV_NAME("warningmsg", VAR_STRING), 0},
|
||||
{VV_NAME("statusmsg", VAR_STRING), 0},
|
||||
{VV_NAME("shell_error", VAR_NUMBER), VV_COMPAT+VV_RO},
|
||||
{VV_NAME("this_session", VAR_STRING), VV_COMPAT},
|
||||
{VV_NAME("version", VAR_NUMBER), VV_COMPAT+VV_RO},
|
||||
{VV_NAME("lnum", VAR_NUMBER), VV_RO_SBX},
|
||||
{VV_NAME("termresponse", VAR_STRING), VV_RO},
|
||||
{VV_NAME("fname", VAR_STRING), VV_RO},
|
||||
{VV_NAME("lang", VAR_STRING), VV_RO},
|
||||
{VV_NAME("lc_time", VAR_STRING), VV_RO},
|
||||
{VV_NAME("ctype", VAR_STRING), VV_RO},
|
||||
{VV_NAME("charconvert_from", VAR_STRING), VV_RO},
|
||||
{VV_NAME("charconvert_to", VAR_STRING), VV_RO},
|
||||
{VV_NAME("fname_in", VAR_STRING), VV_RO},
|
||||
{VV_NAME("fname_out", VAR_STRING), VV_RO},
|
||||
{VV_NAME("fname_new", VAR_STRING), VV_RO},
|
||||
{VV_NAME("fname_diff", VAR_STRING), VV_RO},
|
||||
{VV_NAME("cmdarg", VAR_STRING), VV_RO},
|
||||
{VV_NAME("foldstart", VAR_NUMBER), VV_RO_SBX},
|
||||
{VV_NAME("foldend", VAR_NUMBER), VV_RO_SBX},
|
||||
{VV_NAME("folddashes", VAR_STRING), VV_RO_SBX},
|
||||
{VV_NAME("foldlevel", VAR_NUMBER), VV_RO_SBX},
|
||||
{VV_NAME("progname", VAR_STRING), VV_RO},
|
||||
{VV_NAME("servername", VAR_STRING), VV_RO},
|
||||
{VV_NAME("dying", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("exception", VAR_STRING), VV_RO},
|
||||
{VV_NAME("throwpoint", VAR_STRING), VV_RO},
|
||||
{VV_NAME("register", VAR_STRING), VV_RO},
|
||||
{VV_NAME("cmdbang", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("insertmode", VAR_STRING), VV_RO},
|
||||
{VV_NAME("val", VAR_UNKNOWN), VV_RO},
|
||||
{VV_NAME("key", VAR_UNKNOWN), VV_RO},
|
||||
{VV_NAME("profiling", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("fcs_reason", VAR_STRING), VV_RO},
|
||||
{VV_NAME("fcs_choice", VAR_STRING), 0},
|
||||
{VV_NAME("beval_bufnr", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("beval_winnr", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("beval_lnum", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("beval_col", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("beval_text", VAR_STRING), VV_RO},
|
||||
{VV_NAME("scrollstart", VAR_STRING), 0},
|
||||
{VV_NAME("swapname", VAR_STRING), VV_RO},
|
||||
{VV_NAME("swapchoice", VAR_STRING), 0},
|
||||
{VV_NAME("swapcommand", VAR_STRING), VV_RO},
|
||||
{VV_NAME("char", VAR_STRING), 0},
|
||||
{VV_NAME("mouse_win", VAR_NUMBER), 0},
|
||||
{VV_NAME("mouse_lnum", VAR_NUMBER), 0},
|
||||
{VV_NAME("mouse_col", VAR_NUMBER), 0},
|
||||
{VV_NAME("operator", VAR_STRING), VV_RO},
|
||||
{VV_NAME("searchforward", VAR_NUMBER), 0},
|
||||
{VV_NAME("hlsearch", VAR_NUMBER), 0},
|
||||
{VV_NAME("oldfiles", VAR_LIST), 0},
|
||||
{VV_NAME("windowid", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("progpath", VAR_STRING), VV_RO},
|
||||
{VV_NAME("command_output", VAR_STRING), 0},
|
||||
{VV_NAME("completed_item", VAR_DICT), VV_RO},
|
||||
{VV_NAME("option_new", VAR_STRING), VV_RO},
|
||||
{VV_NAME("option_old", VAR_STRING), VV_RO},
|
||||
{VV_NAME("option_type", VAR_STRING), VV_RO},
|
||||
{VV_NAME("msgpack_types", VAR_DICT), VV_RO},
|
||||
{ VV_NAME("count", VAR_NUMBER), VV_COMPAT+VV_RO },
|
||||
{ VV_NAME("count1", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("prevcount", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("errmsg", VAR_STRING), VV_COMPAT },
|
||||
{ VV_NAME("warningmsg", VAR_STRING), 0 },
|
||||
{ VV_NAME("statusmsg", VAR_STRING), 0 },
|
||||
{ VV_NAME("shell_error", VAR_NUMBER), VV_COMPAT+VV_RO },
|
||||
{ VV_NAME("this_session", VAR_STRING), VV_COMPAT },
|
||||
{ VV_NAME("version", VAR_NUMBER), VV_COMPAT+VV_RO },
|
||||
{ VV_NAME("lnum", VAR_NUMBER), VV_RO_SBX },
|
||||
{ VV_NAME("termresponse", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("fname", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("lang", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("lc_time", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("ctype", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("charconvert_from", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("charconvert_to", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("fname_in", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("fname_out", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("fname_new", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("fname_diff", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("cmdarg", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("foldstart", VAR_NUMBER), VV_RO_SBX },
|
||||
{ VV_NAME("foldend", VAR_NUMBER), VV_RO_SBX },
|
||||
{ VV_NAME("folddashes", VAR_STRING), VV_RO_SBX },
|
||||
{ VV_NAME("foldlevel", VAR_NUMBER), VV_RO_SBX },
|
||||
{ VV_NAME("progname", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("servername", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("dying", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("exception", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("throwpoint", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("register", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("cmdbang", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("insertmode", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("val", VAR_UNKNOWN), VV_RO },
|
||||
{ VV_NAME("key", VAR_UNKNOWN), VV_RO },
|
||||
{ VV_NAME("profiling", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("fcs_reason", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("fcs_choice", VAR_STRING), 0 },
|
||||
{ VV_NAME("beval_bufnr", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("beval_winnr", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("beval_lnum", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("beval_col", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("beval_text", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("scrollstart", VAR_STRING), 0 },
|
||||
{ VV_NAME("swapname", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("swapchoice", VAR_STRING), 0 },
|
||||
{ VV_NAME("swapcommand", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("char", VAR_STRING), 0 },
|
||||
{ VV_NAME("mouse_win", VAR_NUMBER), 0 },
|
||||
{ VV_NAME("mouse_lnum", VAR_NUMBER), 0 },
|
||||
{ VV_NAME("mouse_col", VAR_NUMBER), 0 },
|
||||
{ VV_NAME("operator", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("searchforward", VAR_NUMBER), 0 },
|
||||
{ VV_NAME("hlsearch", VAR_NUMBER), 0 },
|
||||
{ VV_NAME("oldfiles", VAR_LIST), 0 },
|
||||
{ VV_NAME("windowid", VAR_NUMBER), VV_RO },
|
||||
{ VV_NAME("progpath", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("command_output", VAR_STRING), 0 },
|
||||
{ VV_NAME("completed_item", VAR_DICT), VV_RO },
|
||||
{ VV_NAME("option_new", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("option_old", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("option_type", VAR_STRING), VV_RO },
|
||||
{ VV_NAME("errors", VAR_LIST), 0 },
|
||||
{ VV_NAME("msgpack_types", VAR_DICT), VV_RO },
|
||||
};
|
||||
|
||||
/* shorthand */
|
||||
@@ -544,6 +545,7 @@ void eval_init(void)
|
||||
|
||||
set_vim_var_dict(VV_MSGPACK_TYPES, msgpack_types_dict);
|
||||
set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc());
|
||||
set_vim_var_list(VV_ERRORS, list_alloc());
|
||||
set_vim_var_nr(VV_SEARCHFORWARD, 1L);
|
||||
set_vim_var_nr(VV_HLSEARCH, 1L);
|
||||
set_reg_var(0); /* default for v:register is not 0 but '"' */
|
||||
@@ -7090,295 +7092,298 @@ static struct fst {
|
||||
/* implementation of function */
|
||||
} functions[] =
|
||||
{
|
||||
{"abs", 1, 1, f_abs},
|
||||
{"acos", 1, 1, f_acos}, /* WJMc */
|
||||
{"add", 2, 2, f_add},
|
||||
{"and", 2, 2, f_and},
|
||||
{"append", 2, 2, f_append},
|
||||
{"argc", 0, 0, f_argc},
|
||||
{"argidx", 0, 0, f_argidx},
|
||||
{"arglistid", 0, 2, f_arglistid},
|
||||
{"argv", 0, 1, f_argv},
|
||||
{"asin", 1, 1, f_asin}, /* WJMc */
|
||||
{"atan", 1, 1, f_atan},
|
||||
{"atan2", 2, 2, f_atan2},
|
||||
{"browse", 4, 4, f_browse},
|
||||
{"browsedir", 2, 2, f_browsedir},
|
||||
{"bufexists", 1, 1, f_bufexists},
|
||||
{"buffer_exists", 1, 1, f_bufexists}, /* obsolete */
|
||||
{"buffer_name", 1, 1, f_bufname}, /* obsolete */
|
||||
{"buffer_number", 1, 1, f_bufnr}, /* obsolete */
|
||||
{"buflisted", 1, 1, f_buflisted},
|
||||
{"bufloaded", 1, 1, f_bufloaded},
|
||||
{"bufname", 1, 1, f_bufname},
|
||||
{"bufnr", 1, 2, f_bufnr},
|
||||
{"bufwinnr", 1, 1, f_bufwinnr},
|
||||
{"byte2line", 1, 1, f_byte2line},
|
||||
{"byteidx", 2, 2, f_byteidx},
|
||||
{"byteidxcomp", 2, 2, f_byteidxcomp},
|
||||
{"call", 2, 3, f_call},
|
||||
{"ceil", 1, 1, f_ceil},
|
||||
{"changenr", 0, 0, f_changenr},
|
||||
{"char2nr", 1, 2, f_char2nr},
|
||||
{"cindent", 1, 1, f_cindent},
|
||||
{"clearmatches", 0, 0, f_clearmatches},
|
||||
{"col", 1, 1, f_col},
|
||||
{"complete", 2, 2, f_complete},
|
||||
{"complete_add", 1, 1, f_complete_add},
|
||||
{"complete_check", 0, 0, f_complete_check},
|
||||
{"confirm", 1, 4, f_confirm},
|
||||
{"copy", 1, 1, f_copy},
|
||||
{"cos", 1, 1, f_cos},
|
||||
{"cosh", 1, 1, f_cosh},
|
||||
{"count", 2, 4, f_count},
|
||||
{"cscope_connection",0,3, f_cscope_connection},
|
||||
{"cursor", 1, 3, f_cursor},
|
||||
{"deepcopy", 1, 2, f_deepcopy},
|
||||
{"delete", 1, 1, f_delete},
|
||||
{"dictwatcheradd", 3, 3, f_dictwatcheradd},
|
||||
{"dictwatcherdel", 3, 3, f_dictwatcherdel},
|
||||
{"did_filetype", 0, 0, f_did_filetype},
|
||||
{"diff_filler", 1, 1, f_diff_filler},
|
||||
{"diff_hlID", 2, 2, f_diff_hlID},
|
||||
{"empty", 1, 1, f_empty},
|
||||
{"escape", 2, 2, f_escape},
|
||||
{"eval", 1, 1, f_eval},
|
||||
{"eventhandler", 0, 0, f_eventhandler},
|
||||
{"executable", 1, 1, f_executable},
|
||||
{"exepath", 1, 1, f_exepath},
|
||||
{"exists", 1, 1, f_exists},
|
||||
{"exp", 1, 1, f_exp},
|
||||
{"expand", 1, 3, f_expand},
|
||||
{"extend", 2, 3, f_extend},
|
||||
{"feedkeys", 1, 2, f_feedkeys},
|
||||
{"file_readable", 1, 1, f_filereadable}, /* obsolete */
|
||||
{"filereadable", 1, 1, f_filereadable},
|
||||
{"filewritable", 1, 1, f_filewritable},
|
||||
{"filter", 2, 2, f_filter},
|
||||
{"finddir", 1, 3, f_finddir},
|
||||
{"findfile", 1, 3, f_findfile},
|
||||
{"float2nr", 1, 1, f_float2nr},
|
||||
{"floor", 1, 1, f_floor},
|
||||
{"fmod", 2, 2, f_fmod},
|
||||
{"fnameescape", 1, 1, f_fnameescape},
|
||||
{"fnamemodify", 2, 2, f_fnamemodify},
|
||||
{"foldclosed", 1, 1, f_foldclosed},
|
||||
{"foldclosedend", 1, 1, f_foldclosedend},
|
||||
{"foldlevel", 1, 1, f_foldlevel},
|
||||
{"foldtext", 0, 0, f_foldtext},
|
||||
{"foldtextresult", 1, 1, f_foldtextresult},
|
||||
{"foreground", 0, 0, f_foreground},
|
||||
{"function", 1, 1, f_function},
|
||||
{"garbagecollect", 0, 1, f_garbagecollect},
|
||||
{"get", 2, 3, f_get},
|
||||
{"getbufline", 2, 3, f_getbufline},
|
||||
{"getbufvar", 2, 3, f_getbufvar},
|
||||
{"getchar", 0, 1, f_getchar},
|
||||
{"getcharmod", 0, 0, f_getcharmod},
|
||||
{"getcharsearch", 0, 0, f_getcharsearch},
|
||||
{"getcmdline", 0, 0, f_getcmdline},
|
||||
{"getcmdpos", 0, 0, f_getcmdpos},
|
||||
{"getcmdtype", 0, 0, f_getcmdtype},
|
||||
{"getcmdwintype", 0, 0, f_getcmdwintype},
|
||||
{"getcurpos", 0, 0, f_getcurpos},
|
||||
{"getcwd", 0, 0, f_getcwd},
|
||||
{"getfontname", 0, 1, f_getfontname},
|
||||
{"getfperm", 1, 1, f_getfperm},
|
||||
{"getfsize", 1, 1, f_getfsize},
|
||||
{"getftime", 1, 1, f_getftime},
|
||||
{"getftype", 1, 1, f_getftype},
|
||||
{"getline", 1, 2, f_getline},
|
||||
{"getloclist", 1, 1, f_getqflist},
|
||||
{"getmatches", 0, 0, f_getmatches},
|
||||
{"getpid", 0, 0, f_getpid},
|
||||
{"getpos", 1, 1, f_getpos},
|
||||
{"getqflist", 0, 0, f_getqflist},
|
||||
{"getreg", 0, 3, f_getreg},
|
||||
{"getregtype", 0, 1, f_getregtype},
|
||||
{"gettabvar", 2, 3, f_gettabvar},
|
||||
{"gettabwinvar", 3, 4, f_gettabwinvar},
|
||||
{"getwinposx", 0, 0, f_getwinposx},
|
||||
{"getwinposy", 0, 0, f_getwinposy},
|
||||
{"getwinvar", 2, 3, f_getwinvar},
|
||||
{"glob", 1, 3, f_glob},
|
||||
{"glob2regpat", 1, 1, f_glob2regpat},
|
||||
{"globpath", 2, 4, f_globpath},
|
||||
{"has", 1, 1, f_has},
|
||||
{"has_key", 2, 2, f_has_key},
|
||||
{"haslocaldir", 0, 0, f_haslocaldir},
|
||||
{"hasmapto", 1, 3, f_hasmapto},
|
||||
{"highlightID", 1, 1, f_hlID}, /* obsolete */
|
||||
{"highlight_exists",1, 1, f_hlexists}, /* obsolete */
|
||||
{"histadd", 2, 2, f_histadd},
|
||||
{"histdel", 1, 2, f_histdel},
|
||||
{"histget", 1, 2, f_histget},
|
||||
{"histnr", 1, 1, f_histnr},
|
||||
{"hlID", 1, 1, f_hlID},
|
||||
{"hlexists", 1, 1, f_hlexists},
|
||||
{"hostname", 0, 0, f_hostname},
|
||||
{"iconv", 3, 3, f_iconv},
|
||||
{"indent", 1, 1, f_indent},
|
||||
{"index", 2, 4, f_index},
|
||||
{"input", 1, 3, f_input},
|
||||
{"inputdialog", 1, 3, f_inputdialog},
|
||||
{"inputlist", 1, 1, f_inputlist},
|
||||
{"inputrestore", 0, 0, f_inputrestore},
|
||||
{"inputsave", 0, 0, f_inputsave},
|
||||
{"inputsecret", 1, 2, f_inputsecret},
|
||||
{"insert", 2, 3, f_insert},
|
||||
{"invert", 1, 1, f_invert},
|
||||
{"isdirectory", 1, 1, f_isdirectory},
|
||||
{"islocked", 1, 1, f_islocked},
|
||||
{"items", 1, 1, f_items},
|
||||
{"jobclose", 1, 2, f_jobclose},
|
||||
{"jobresize", 3, 3, f_jobresize},
|
||||
{"jobsend", 2, 2, f_jobsend},
|
||||
{"jobstart", 1, 2, f_jobstart},
|
||||
{"jobstop", 1, 1, f_jobstop},
|
||||
{"jobwait", 1, 2, f_jobwait},
|
||||
{"join", 1, 2, f_join},
|
||||
{"keys", 1, 1, f_keys},
|
||||
{"last_buffer_nr", 0, 0, f_last_buffer_nr}, /* obsolete */
|
||||
{"len", 1, 1, f_len},
|
||||
{"libcall", 3, 3, f_libcall},
|
||||
{"libcallnr", 3, 3, f_libcallnr},
|
||||
{"line", 1, 1, f_line},
|
||||
{"line2byte", 1, 1, f_line2byte},
|
||||
{"lispindent", 1, 1, f_lispindent},
|
||||
{"localtime", 0, 0, f_localtime},
|
||||
{"log", 1, 1, f_log},
|
||||
{"log10", 1, 1, f_log10},
|
||||
{"map", 2, 2, f_map},
|
||||
{"maparg", 1, 4, f_maparg},
|
||||
{"mapcheck", 1, 3, f_mapcheck},
|
||||
{"match", 2, 4, f_match},
|
||||
{"matchadd", 2, 4, f_matchadd},
|
||||
{"matchaddpos", 2, 4, f_matchaddpos},
|
||||
{"matcharg", 1, 1, f_matcharg},
|
||||
{"matchdelete", 1, 1, f_matchdelete},
|
||||
{"matchend", 2, 4, f_matchend},
|
||||
{"matchlist", 2, 4, f_matchlist},
|
||||
{"matchstr", 2, 4, f_matchstr},
|
||||
{"max", 1, 1, f_max},
|
||||
{"min", 1, 1, f_min},
|
||||
{"mkdir", 1, 3, f_mkdir},
|
||||
{"mode", 0, 1, f_mode},
|
||||
{"msgpackdump", 1, 1, f_msgpackdump},
|
||||
{"msgpackparse", 1, 1, f_msgpackparse},
|
||||
{"nextnonblank", 1, 1, f_nextnonblank},
|
||||
{"nr2char", 1, 2, f_nr2char},
|
||||
{"or", 2, 2, f_or},
|
||||
{"pathshorten", 1, 1, f_pathshorten},
|
||||
{"pow", 2, 2, f_pow},
|
||||
{"prevnonblank", 1, 1, f_prevnonblank},
|
||||
{"printf", 2, 19, f_printf},
|
||||
{"pumvisible", 0, 0, f_pumvisible},
|
||||
{"py3eval", 1, 1, f_py3eval},
|
||||
{"pyeval", 1, 1, f_pyeval},
|
||||
{"range", 1, 3, f_range},
|
||||
{"readfile", 1, 3, f_readfile},
|
||||
{"reltime", 0, 2, f_reltime},
|
||||
{"reltimestr", 1, 1, f_reltimestr},
|
||||
{"remove", 2, 3, f_remove},
|
||||
{"rename", 2, 2, f_rename},
|
||||
{"repeat", 2, 2, f_repeat},
|
||||
{"resolve", 1, 1, f_resolve},
|
||||
{"reverse", 1, 1, f_reverse},
|
||||
{"round", 1, 1, f_round},
|
||||
{"rpcnotify", 2, 64, f_rpcnotify},
|
||||
{"rpcrequest", 2, 64, f_rpcrequest},
|
||||
{"rpcstart", 1, 2, f_rpcstart},
|
||||
{"rpcstop", 1, 1, f_rpcstop},
|
||||
{"screenattr", 2, 2, f_screenattr},
|
||||
{"screenchar", 2, 2, f_screenchar},
|
||||
{"screencol", 0, 0, f_screencol},
|
||||
{"screenrow", 0, 0, f_screenrow},
|
||||
{"search", 1, 4, f_search},
|
||||
{"searchdecl", 1, 3, f_searchdecl},
|
||||
{"searchpair", 3, 7, f_searchpair},
|
||||
{"searchpairpos", 3, 7, f_searchpairpos},
|
||||
{"searchpos", 1, 4, f_searchpos},
|
||||
{"serverlist", 0, 0, f_serverlist},
|
||||
{"serverstart", 0, 1, f_serverstart},
|
||||
{"serverstop", 1, 1, f_serverstop},
|
||||
{"setbufvar", 3, 3, f_setbufvar},
|
||||
{"setcharsearch", 1, 1, f_setcharsearch},
|
||||
{"setcmdpos", 1, 1, f_setcmdpos},
|
||||
{"setline", 2, 2, f_setline},
|
||||
{"setloclist", 2, 3, f_setloclist},
|
||||
{"setmatches", 1, 1, f_setmatches},
|
||||
{"setpos", 2, 2, f_setpos},
|
||||
{"setqflist", 1, 2, f_setqflist},
|
||||
{"setreg", 2, 3, f_setreg},
|
||||
{"settabvar", 3, 3, f_settabvar},
|
||||
{"settabwinvar", 4, 4, f_settabwinvar},
|
||||
{"setwinvar", 3, 3, f_setwinvar},
|
||||
{"sha256", 1, 1, f_sha256},
|
||||
{"shellescape", 1, 2, f_shellescape},
|
||||
{"shiftwidth", 0, 0, f_shiftwidth},
|
||||
{"simplify", 1, 1, f_simplify},
|
||||
{"sin", 1, 1, f_sin},
|
||||
{"sinh", 1, 1, f_sinh},
|
||||
{"sort", 1, 3, f_sort},
|
||||
{"soundfold", 1, 1, f_soundfold},
|
||||
{"spellbadword", 0, 1, f_spellbadword},
|
||||
{"spellsuggest", 1, 3, f_spellsuggest},
|
||||
{"split", 1, 3, f_split},
|
||||
{"sqrt", 1, 1, f_sqrt},
|
||||
{"str2float", 1, 1, f_str2float},
|
||||
{"str2nr", 1, 2, f_str2nr},
|
||||
{"strchars", 1, 1, f_strchars},
|
||||
{"strdisplaywidth", 1, 2, f_strdisplaywidth},
|
||||
{"strftime", 1, 2, f_strftime},
|
||||
{"stridx", 2, 3, f_stridx},
|
||||
{"string", 1, 1, f_string},
|
||||
{"strlen", 1, 1, f_strlen},
|
||||
{"strpart", 2, 3, f_strpart},
|
||||
{"strridx", 2, 3, f_strridx},
|
||||
{"strtrans", 1, 1, f_strtrans},
|
||||
{"strwidth", 1, 1, f_strwidth},
|
||||
{"submatch", 1, 2, f_submatch},
|
||||
{"substitute", 4, 4, f_substitute},
|
||||
{"synID", 3, 3, f_synID},
|
||||
{"synIDattr", 2, 3, f_synIDattr},
|
||||
{"synIDtrans", 1, 1, f_synIDtrans},
|
||||
{"synconcealed", 2, 2, f_synconcealed},
|
||||
{"synstack", 2, 2, f_synstack},
|
||||
{"system", 1, 2, f_system},
|
||||
{"systemlist", 1, 3, f_systemlist},
|
||||
{"tabpagebuflist", 0, 1, f_tabpagebuflist},
|
||||
{"tabpagenr", 0, 1, f_tabpagenr},
|
||||
{"tabpagewinnr", 1, 2, f_tabpagewinnr},
|
||||
{"tagfiles", 0, 0, f_tagfiles},
|
||||
{"taglist", 1, 1, f_taglist},
|
||||
{"tan", 1, 1, f_tan},
|
||||
{"tanh", 1, 1, f_tanh},
|
||||
{"tempname", 0, 0, f_tempname},
|
||||
{"termopen", 1, 2, f_termopen},
|
||||
{"test", 1, 1, f_test},
|
||||
{"tolower", 1, 1, f_tolower},
|
||||
{"toupper", 1, 1, f_toupper},
|
||||
{"tr", 3, 3, f_tr},
|
||||
{"trunc", 1, 1, f_trunc},
|
||||
{"type", 1, 1, f_type},
|
||||
{"undofile", 1, 1, f_undofile},
|
||||
{"undotree", 0, 0, f_undotree},
|
||||
{"uniq", 1, 3, f_uniq},
|
||||
{"values", 1, 1, f_values},
|
||||
{"virtcol", 1, 1, f_virtcol},
|
||||
{"visualmode", 0, 1, f_visualmode},
|
||||
{"wildmenumode", 0, 0, f_wildmenumode},
|
||||
{"winbufnr", 1, 1, f_winbufnr},
|
||||
{"wincol", 0, 0, f_wincol},
|
||||
{"winheight", 1, 1, f_winheight},
|
||||
{"winline", 0, 0, f_winline},
|
||||
{"winnr", 0, 1, f_winnr},
|
||||
{"winrestcmd", 0, 0, f_winrestcmd},
|
||||
{"winrestview", 1, 1, f_winrestview},
|
||||
{"winsaveview", 0, 0, f_winsaveview},
|
||||
{"winwidth", 1, 1, f_winwidth},
|
||||
{"writefile", 2, 3, f_writefile},
|
||||
{"xor", 2, 2, f_xor},
|
||||
{ "abs", 1, 1, f_abs },
|
||||
{ "acos", 1, 1, f_acos }, // WJMc
|
||||
{ "add", 2, 2, f_add },
|
||||
{ "and", 2, 2, f_and },
|
||||
{ "append", 2, 2, f_append },
|
||||
{ "argc", 0, 0, f_argc },
|
||||
{ "argidx", 0, 0, f_argidx },
|
||||
{ "arglistid", 0, 2, f_arglistid },
|
||||
{ "argv", 0, 1, f_argv },
|
||||
{ "asin", 1, 1, f_asin }, // WJMc
|
||||
{ "assert_equal", 2, 3, f_assert_equal },
|
||||
{ "assert_false", 1, 2, f_assert_false },
|
||||
{ "assert_true", 1, 2, f_assert_true },
|
||||
{ "atan", 1, 1, f_atan },
|
||||
{ "atan2", 2, 2, f_atan2 },
|
||||
{ "browse", 4, 4, f_browse },
|
||||
{ "browsedir", 2, 2, f_browsedir },
|
||||
{ "bufexists", 1, 1, f_bufexists },
|
||||
{ "buffer_exists", 1, 1, f_bufexists }, // obsolete
|
||||
{ "buffer_name", 1, 1, f_bufname }, // obsolete
|
||||
{ "buffer_number", 1, 1, f_bufnr }, // obsolete
|
||||
{ "buflisted", 1, 1, f_buflisted },
|
||||
{ "bufloaded", 1, 1, f_bufloaded },
|
||||
{ "bufname", 1, 1, f_bufname },
|
||||
{ "bufnr", 1, 2, f_bufnr },
|
||||
{ "bufwinnr", 1, 1, f_bufwinnr },
|
||||
{ "byte2line", 1, 1, f_byte2line },
|
||||
{ "byteidx", 2, 2, f_byteidx },
|
||||
{ "byteidxcomp", 2, 2, f_byteidxcomp },
|
||||
{ "call", 2, 3, f_call },
|
||||
{ "ceil", 1, 1, f_ceil },
|
||||
{ "changenr", 0, 0, f_changenr },
|
||||
{ "char2nr", 1, 2, f_char2nr },
|
||||
{ "cindent", 1, 1, f_cindent },
|
||||
{ "clearmatches", 0, 0, f_clearmatches },
|
||||
{ "col", 1, 1, f_col },
|
||||
{ "complete", 2, 2, f_complete },
|
||||
{ "complete_add", 1, 1, f_complete_add },
|
||||
{ "complete_check", 0, 0, f_complete_check },
|
||||
{ "confirm", 1, 4, f_confirm },
|
||||
{ "copy", 1, 1, f_copy },
|
||||
{ "cos", 1, 1, f_cos },
|
||||
{ "cosh", 1, 1, f_cosh },
|
||||
{ "count", 2, 4, f_count },
|
||||
{ "cscope_connection", 0, 3, f_cscope_connection },
|
||||
{ "cursor", 1, 3, f_cursor },
|
||||
{ "deepcopy", 1, 2, f_deepcopy },
|
||||
{ "delete", 1, 1, f_delete },
|
||||
{ "dictwatcheradd", 3, 3, f_dictwatcheradd },
|
||||
{ "dictwatcherdel", 3, 3, f_dictwatcherdel },
|
||||
{ "did_filetype", 0, 0, f_did_filetype },
|
||||
{ "diff_filler", 1, 1, f_diff_filler },
|
||||
{ "diff_hlID", 2, 2, f_diff_hlID },
|
||||
{ "empty", 1, 1, f_empty },
|
||||
{ "escape", 2, 2, f_escape },
|
||||
{ "eval", 1, 1, f_eval },
|
||||
{ "eventhandler", 0, 0, f_eventhandler },
|
||||
{ "executable", 1, 1, f_executable },
|
||||
{ "exepath", 1, 1, f_exepath },
|
||||
{ "exists", 1, 1, f_exists },
|
||||
{ "exp", 1, 1, f_exp },
|
||||
{ "expand", 1, 3, f_expand },
|
||||
{ "extend", 2, 3, f_extend },
|
||||
{ "feedkeys", 1, 2, f_feedkeys },
|
||||
{ "file_readable", 1, 1, f_filereadable }, // obsolete
|
||||
{ "filereadable", 1, 1, f_filereadable },
|
||||
{ "filewritable", 1, 1, f_filewritable },
|
||||
{ "filter", 2, 2, f_filter },
|
||||
{ "finddir", 1, 3, f_finddir },
|
||||
{ "findfile", 1, 3, f_findfile },
|
||||
{ "float2nr", 1, 1, f_float2nr },
|
||||
{ "floor", 1, 1, f_floor },
|
||||
{ "fmod", 2, 2, f_fmod },
|
||||
{ "fnameescape", 1, 1, f_fnameescape },
|
||||
{ "fnamemodify", 2, 2, f_fnamemodify },
|
||||
{ "foldclosed", 1, 1, f_foldclosed },
|
||||
{ "foldclosedend", 1, 1, f_foldclosedend },
|
||||
{ "foldlevel", 1, 1, f_foldlevel },
|
||||
{ "foldtext", 0, 0, f_foldtext },
|
||||
{ "foldtextresult", 1, 1, f_foldtextresult },
|
||||
{ "foreground", 0, 0, f_foreground },
|
||||
{ "function", 1, 1, f_function },
|
||||
{ "garbagecollect", 0, 1, f_garbagecollect },
|
||||
{ "get", 2, 3, f_get },
|
||||
{ "getbufline", 2, 3, f_getbufline },
|
||||
{ "getbufvar", 2, 3, f_getbufvar },
|
||||
{ "getchar", 0, 1, f_getchar },
|
||||
{ "getcharmod", 0, 0, f_getcharmod },
|
||||
{ "getcharsearch", 0, 0, f_getcharsearch },
|
||||
{ "getcmdline", 0, 0, f_getcmdline },
|
||||
{ "getcmdpos", 0, 0, f_getcmdpos },
|
||||
{ "getcmdtype", 0, 0, f_getcmdtype },
|
||||
{ "getcmdwintype", 0, 0, f_getcmdwintype },
|
||||
{ "getcurpos", 0, 0, f_getcurpos },
|
||||
{ "getcwd", 0, 0, f_getcwd },
|
||||
{ "getfontname", 0, 1, f_getfontname },
|
||||
{ "getfperm", 1, 1, f_getfperm },
|
||||
{ "getfsize", 1, 1, f_getfsize },
|
||||
{ "getftime", 1, 1, f_getftime },
|
||||
{ "getftype", 1, 1, f_getftype },
|
||||
{ "getline", 1, 2, f_getline },
|
||||
{ "getloclist", 1, 1, f_getqflist },
|
||||
{ "getmatches", 0, 0, f_getmatches },
|
||||
{ "getpid", 0, 0, f_getpid },
|
||||
{ "getpos", 1, 1, f_getpos },
|
||||
{ "getqflist", 0, 0, f_getqflist },
|
||||
{ "getreg", 0, 3, f_getreg },
|
||||
{ "getregtype", 0, 1, f_getregtype },
|
||||
{ "gettabvar", 2, 3, f_gettabvar },
|
||||
{ "gettabwinvar", 3, 4, f_gettabwinvar },
|
||||
{ "getwinposx", 0, 0, f_getwinposx },
|
||||
{ "getwinposy", 0, 0, f_getwinposy },
|
||||
{ "getwinvar", 2, 3, f_getwinvar },
|
||||
{ "glob", 1, 3, f_glob },
|
||||
{ "glob2regpat", 1, 1, f_glob2regpat },
|
||||
{ "globpath", 2, 4, f_globpath },
|
||||
{ "has", 1, 1, f_has },
|
||||
{ "has_key", 2, 2, f_has_key },
|
||||
{ "haslocaldir", 0, 0, f_haslocaldir },
|
||||
{ "hasmapto", 1, 3, f_hasmapto },
|
||||
{ "highlightID", 1, 1, f_hlID }, // obsolete
|
||||
{ "highlight_exists", 1, 1, f_hlexists }, // obsolete
|
||||
{ "histadd", 2, 2, f_histadd },
|
||||
{ "histdel", 1, 2, f_histdel },
|
||||
{ "histget", 1, 2, f_histget },
|
||||
{ "histnr", 1, 1, f_histnr },
|
||||
{ "hlID", 1, 1, f_hlID },
|
||||
{ "hlexists", 1, 1, f_hlexists },
|
||||
{ "hostname", 0, 0, f_hostname },
|
||||
{ "iconv", 3, 3, f_iconv },
|
||||
{ "indent", 1, 1, f_indent },
|
||||
{ "index", 2, 4, f_index },
|
||||
{ "input", 1, 3, f_input },
|
||||
{ "inputdialog", 1, 3, f_inputdialog },
|
||||
{ "inputlist", 1, 1, f_inputlist },
|
||||
{ "inputrestore", 0, 0, f_inputrestore },
|
||||
{ "inputsave", 0, 0, f_inputsave },
|
||||
{ "inputsecret", 1, 2, f_inputsecret },
|
||||
{ "insert", 2, 3, f_insert },
|
||||
{ "invert", 1, 1, f_invert },
|
||||
{ "isdirectory", 1, 1, f_isdirectory },
|
||||
{ "islocked", 1, 1, f_islocked },
|
||||
{ "items", 1, 1, f_items },
|
||||
{ "jobclose", 1, 2, f_jobclose },
|
||||
{ "jobresize", 3, 3, f_jobresize },
|
||||
{ "jobsend", 2, 2, f_jobsend },
|
||||
{ "jobstart", 1, 2, f_jobstart },
|
||||
{ "jobstop", 1, 1, f_jobstop },
|
||||
{ "jobwait", 1, 2, f_jobwait },
|
||||
{ "join", 1, 2, f_join },
|
||||
{ "keys", 1, 1, f_keys },
|
||||
{ "last_buffer_nr", 0, 0, f_last_buffer_nr }, // obsolete
|
||||
{ "len", 1, 1, f_len },
|
||||
{ "libcall", 3, 3, f_libcall },
|
||||
{ "libcallnr", 3, 3, f_libcallnr },
|
||||
{ "line", 1, 1, f_line },
|
||||
{ "line2byte", 1, 1, f_line2byte },
|
||||
{ "lispindent", 1, 1, f_lispindent },
|
||||
{ "localtime", 0, 0, f_localtime },
|
||||
{ "log", 1, 1, f_log },
|
||||
{ "log10", 1, 1, f_log10 },
|
||||
{ "map", 2, 2, f_map },
|
||||
{ "maparg", 1, 4, f_maparg },
|
||||
{ "mapcheck", 1, 3, f_mapcheck },
|
||||
{ "match", 2, 4, f_match },
|
||||
{ "matchadd", 2, 4, f_matchadd },
|
||||
{ "matchaddpos", 2, 4, f_matchaddpos },
|
||||
{ "matcharg", 1, 1, f_matcharg },
|
||||
{ "matchdelete", 1, 1, f_matchdelete },
|
||||
{ "matchend", 2, 4, f_matchend },
|
||||
{ "matchlist", 2, 4, f_matchlist },
|
||||
{ "matchstr", 2, 4, f_matchstr },
|
||||
{ "max", 1, 1, f_max },
|
||||
{ "min", 1, 1, f_min },
|
||||
{ "mkdir", 1, 3, f_mkdir },
|
||||
{ "mode", 0, 1, f_mode },
|
||||
{ "msgpackdump", 1, 1, f_msgpackdump },
|
||||
{ "msgpackparse", 1, 1, f_msgpackparse },
|
||||
{ "nextnonblank", 1, 1, f_nextnonblank },
|
||||
{ "nr2char", 1, 2, f_nr2char },
|
||||
{ "or", 2, 2, f_or },
|
||||
{ "pathshorten", 1, 1, f_pathshorten },
|
||||
{ "pow", 2, 2, f_pow },
|
||||
{ "prevnonblank", 1, 1, f_prevnonblank },
|
||||
{ "printf", 2, 19, f_printf },
|
||||
{ "pumvisible", 0, 0, f_pumvisible },
|
||||
{ "py3eval", 1, 1, f_py3eval },
|
||||
{ "pyeval", 1, 1, f_pyeval },
|
||||
{ "range", 1, 3, f_range },
|
||||
{ "readfile", 1, 3, f_readfile },
|
||||
{ "reltime", 0, 2, f_reltime },
|
||||
{ "reltimestr", 1, 1, f_reltimestr },
|
||||
{ "remove", 2, 3, f_remove },
|
||||
{ "rename", 2, 2, f_rename },
|
||||
{ "repeat", 2, 2, f_repeat },
|
||||
{ "resolve", 1, 1, f_resolve },
|
||||
{ "reverse", 1, 1, f_reverse },
|
||||
{ "round", 1, 1, f_round },
|
||||
{ "rpcnotify", 2, 64, f_rpcnotify },
|
||||
{ "rpcrequest", 2, 64, f_rpcrequest },
|
||||
{ "rpcstart", 1, 2, f_rpcstart },
|
||||
{ "rpcstop", 1, 1, f_rpcstop },
|
||||
{ "screenattr", 2, 2, f_screenattr },
|
||||
{ "screenchar", 2, 2, f_screenchar },
|
||||
{ "screencol", 0, 0, f_screencol },
|
||||
{ "screenrow", 0, 0, f_screenrow },
|
||||
{ "search", 1, 4, f_search },
|
||||
{ "searchdecl", 1, 3, f_searchdecl },
|
||||
{ "searchpair", 3, 7, f_searchpair },
|
||||
{ "searchpairpos", 3, 7, f_searchpairpos },
|
||||
{ "searchpos", 1, 4, f_searchpos },
|
||||
{ "serverlist", 0, 0, f_serverlist },
|
||||
{ "serverstart", 0, 1, f_serverstart },
|
||||
{ "serverstop", 1, 1, f_serverstop },
|
||||
{ "setbufvar", 3, 3, f_setbufvar },
|
||||
{ "setcharsearch", 1, 1, f_setcharsearch },
|
||||
{ "setcmdpos", 1, 1, f_setcmdpos },
|
||||
{ "setline", 2, 2, f_setline },
|
||||
{ "setloclist", 2, 3, f_setloclist },
|
||||
{ "setmatches", 1, 1, f_setmatches },
|
||||
{ "setpos", 2, 2, f_setpos },
|
||||
{ "setqflist", 1, 2, f_setqflist },
|
||||
{ "setreg", 2, 3, f_setreg },
|
||||
{ "settabvar", 3, 3, f_settabvar },
|
||||
{ "settabwinvar", 4, 4, f_settabwinvar },
|
||||
{ "setwinvar", 3, 3, f_setwinvar },
|
||||
{ "sha256", 1, 1, f_sha256 },
|
||||
{ "shellescape", 1, 2, f_shellescape },
|
||||
{ "shiftwidth", 0, 0, f_shiftwidth },
|
||||
{ "simplify", 1, 1, f_simplify },
|
||||
{ "sin", 1, 1, f_sin },
|
||||
{ "sinh", 1, 1, f_sinh },
|
||||
{ "sort", 1, 3, f_sort },
|
||||
{ "soundfold", 1, 1, f_soundfold },
|
||||
{ "spellbadword", 0, 1, f_spellbadword },
|
||||
{ "spellsuggest", 1, 3, f_spellsuggest },
|
||||
{ "split", 1, 3, f_split },
|
||||
{ "sqrt", 1, 1, f_sqrt },
|
||||
{ "str2float", 1, 1, f_str2float },
|
||||
{ "str2nr", 1, 2, f_str2nr },
|
||||
{ "strchars", 1, 1, f_strchars },
|
||||
{ "strdisplaywidth", 1, 2, f_strdisplaywidth },
|
||||
{ "strftime", 1, 2, f_strftime },
|
||||
{ "stridx", 2, 3, f_stridx },
|
||||
{ "string", 1, 1, f_string },
|
||||
{ "strlen", 1, 1, f_strlen },
|
||||
{ "strpart", 2, 3, f_strpart },
|
||||
{ "strridx", 2, 3, f_strridx },
|
||||
{ "strtrans", 1, 1, f_strtrans },
|
||||
{ "strwidth", 1, 1, f_strwidth },
|
||||
{ "submatch", 1, 2, f_submatch },
|
||||
{ "substitute", 4, 4, f_substitute },
|
||||
{ "synID", 3, 3, f_synID },
|
||||
{ "synIDattr", 2, 3, f_synIDattr },
|
||||
{ "synIDtrans", 1, 1, f_synIDtrans },
|
||||
{ "synconcealed", 2, 2, f_synconcealed },
|
||||
{ "synstack", 2, 2, f_synstack },
|
||||
{ "system", 1, 2, f_system },
|
||||
{ "systemlist", 1, 3, f_systemlist },
|
||||
{ "tabpagebuflist", 0, 1, f_tabpagebuflist },
|
||||
{ "tabpagenr", 0, 1, f_tabpagenr },
|
||||
{ "tabpagewinnr", 1, 2, f_tabpagewinnr },
|
||||
{ "tagfiles", 0, 0, f_tagfiles },
|
||||
{ "taglist", 1, 1, f_taglist },
|
||||
{ "tan", 1, 1, f_tan },
|
||||
{ "tanh", 1, 1, f_tanh },
|
||||
{ "tempname", 0, 0, f_tempname },
|
||||
{ "termopen", 1, 2, f_termopen },
|
||||
{ "test", 1, 1, f_test },
|
||||
{ "tolower", 1, 1, f_tolower },
|
||||
{ "toupper", 1, 1, f_toupper },
|
||||
{ "tr", 3, 3, f_tr },
|
||||
{ "trunc", 1, 1, f_trunc },
|
||||
{ "type", 1, 1, f_type },
|
||||
{ "undofile", 1, 1, f_undofile },
|
||||
{ "undotree", 0, 0, f_undotree },
|
||||
{ "uniq", 1, 3, f_uniq },
|
||||
{ "values", 1, 1, f_values },
|
||||
{ "virtcol", 1, 1, f_virtcol },
|
||||
{ "visualmode", 0, 1, f_visualmode },
|
||||
{ "wildmenumode", 0, 0, f_wildmenumode },
|
||||
{ "winbufnr", 1, 1, f_winbufnr },
|
||||
{ "wincol", 0, 0, f_wincol },
|
||||
{ "winheight", 1, 1, f_winheight },
|
||||
{ "winline", 0, 0, f_winline },
|
||||
{ "winnr", 0, 1, f_winnr },
|
||||
{ "winrestcmd", 0, 0, f_winrestcmd },
|
||||
{ "winrestview", 1, 1, f_winrestview },
|
||||
{ "winsaveview", 0, 0, f_winsaveview },
|
||||
{ "winwidth", 1, 1, f_winwidth },
|
||||
{ "writefile", 2, 3, f_writefile },
|
||||
{ "xor", 2, 2, f_xor },
|
||||
};
|
||||
|
||||
|
||||
@@ -7981,6 +7986,110 @@ static void f_argv(typval_T *argvars, typval_T *rettv)
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare "gap" for an assert error and add the sourcing position.
|
||||
static void prepare_assert_error(garray_T *gap)
|
||||
{
|
||||
char buf[NUMBUFLEN];
|
||||
|
||||
ga_init(gap, 1, 100);
|
||||
if (sourcing_name != NULL) {
|
||||
ga_concat(gap, sourcing_name);
|
||||
if (sourcing_lnum > 0) {
|
||||
ga_concat(gap, (char_u *)" ");
|
||||
}
|
||||
}
|
||||
if (sourcing_lnum > 0) {
|
||||
vim_snprintf(buf, ARRAY_SIZE(buf), "line %ld", (long)sourcing_lnum);
|
||||
ga_concat(gap, (char_u *)buf);
|
||||
}
|
||||
if (sourcing_name != NULL || sourcing_lnum > 0) {
|
||||
ga_concat(gap, (char_u *)": ");
|
||||
}
|
||||
}
|
||||
|
||||
// Fill "gap" with information about an assert error.
|
||||
static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv,
|
||||
char_u *exp_str, typval_T *exp_tv,
|
||||
typval_T *got_tv)
|
||||
{
|
||||
char_u *tofree;
|
||||
|
||||
if (opt_msg_tv->v_type != VAR_UNKNOWN) {
|
||||
tofree = (char_u *) tv2string(opt_msg_tv, NULL);
|
||||
ga_concat(gap, tofree);
|
||||
xfree(tofree);
|
||||
} else {
|
||||
ga_concat(gap, (char_u *)"Expected ");
|
||||
if (exp_str == NULL) {
|
||||
tofree = (char_u *) tv2string(exp_tv, NULL);
|
||||
ga_concat(gap, tofree);
|
||||
xfree(tofree);
|
||||
} else {
|
||||
ga_concat(gap, exp_str);
|
||||
}
|
||||
tofree = (char_u *) tv2string(got_tv, NULL);
|
||||
ga_concat(gap, (char_u *)" but got ");
|
||||
ga_concat(gap, tofree);
|
||||
xfree(tofree);
|
||||
}
|
||||
}
|
||||
|
||||
// Add an assert error to v:errors.
|
||||
static void assert_error(garray_T *gap)
|
||||
{
|
||||
struct vimvar *vp = &vimvars[VV_ERRORS];
|
||||
|
||||
if (vp->vv_type != VAR_LIST || vimvars[VV_ERRORS].vv_list == NULL) {
|
||||
// Make sure v:errors is a list.
|
||||
set_vim_var_list(VV_ERRORS, list_alloc());
|
||||
}
|
||||
list_append_string(vimvars[VV_ERRORS].vv_list,
|
||||
gap->ga_data, gap->ga_len);
|
||||
}
|
||||
|
||||
// "assert_equal(expected, actual[, msg])" function
|
||||
static void f_assert_equal(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
garray_T ga;
|
||||
|
||||
if (!tv_equal(&argvars[0], &argvars[1], false, false)) {
|
||||
prepare_assert_error(&ga);
|
||||
fill_assert_error(&ga, &argvars[2], NULL,
|
||||
&argvars[0], &argvars[1]);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
}
|
||||
|
||||
// Common for assert_true() and assert_false().
|
||||
static void assert_bool(typval_T *argvars, bool isTrue)
|
||||
{
|
||||
int error = (int)false;
|
||||
garray_T ga;
|
||||
|
||||
if (argvars[0].v_type != VAR_NUMBER ||
|
||||
(get_tv_number_chk(&argvars[0], &error) == 0) == isTrue || error) {
|
||||
prepare_assert_error(&ga);
|
||||
fill_assert_error(&ga, &argvars[1],
|
||||
(char_u *)(isTrue ? "True" : "False"),
|
||||
NULL, &argvars[0]);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
}
|
||||
|
||||
// "assert_false(actual[, msg])" function
|
||||
static void f_assert_false(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
assert_bool(argvars, false);
|
||||
}
|
||||
|
||||
// "assert_true(actual[, msg])" function
|
||||
static void f_assert_true(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
assert_bool(argvars, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* "asin()" function
|
||||
*/
|
||||
|
||||
@@ -111,6 +111,7 @@ enum {
|
||||
VV_OPTION_NEW,
|
||||
VV_OPTION_OLD,
|
||||
VV_OPTION_TYPE,
|
||||
VV_ERRORS,
|
||||
VV_MSGPACK_TYPES,
|
||||
VV_LEN, /* number of v: vars */
|
||||
};
|
||||
|
||||
@@ -174,6 +174,7 @@ char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
|
||||
}
|
||||
|
||||
/// Concatenate a string to a growarray which contains characters.
|
||||
/// When "s" is NULL does not do anything.
|
||||
///
|
||||
/// WARNING:
|
||||
/// - Does NOT copy the NUL at the end!
|
||||
@@ -183,6 +184,10 @@ char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
|
||||
/// @param s
|
||||
void ga_concat(garray_T *gap, const char_u *restrict s)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
int len = (int)strlen((char *) s);
|
||||
if (len) {
|
||||
ga_grow(gap, len);
|
||||
|
||||
@@ -31,6 +31,8 @@ SCRIPTS := test_eval.out \
|
||||
test_command_count.out \
|
||||
test_cdo.out \
|
||||
|
||||
NEW_TESTS =
|
||||
|
||||
SCRIPTS_GUI := test16.out
|
||||
|
||||
|
||||
@@ -62,9 +64,9 @@ ifdef TESTNUM
|
||||
SCRIPTS := test$(TESTNUM).out
|
||||
endif
|
||||
|
||||
nongui: nolog $(SCRIPTS) report
|
||||
nongui: nolog $(SCRIPTS) newtests report
|
||||
|
||||
gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
|
||||
gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) newtests report
|
||||
|
||||
.gdbinit:
|
||||
echo 'set $$_exitcode = -1\nrun\nif $$_exitcode != -1\n quit\nend' > .gdbinit
|
||||
@@ -91,6 +93,7 @@ RUN_VIM := VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(TOOL) $(VIMPROG)
|
||||
clean:
|
||||
-rm -rf *.out \
|
||||
*.failed \
|
||||
*.res \
|
||||
*.rej \
|
||||
*.orig \
|
||||
test.log \
|
||||
@@ -147,3 +150,19 @@ test49.out: test49.vim
|
||||
|
||||
nolog:
|
||||
-rm -f test.log
|
||||
|
||||
|
||||
# New style of tests uses Vim script with assert calls. These are easier
|
||||
# to write and a lot easier to read and debug.
|
||||
# Limitation: Only works with the +eval feature.
|
||||
RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin
|
||||
|
||||
newtests: newtestssilent
|
||||
@/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then \
|
||||
cat messages && cat test.log; \
|
||||
fi" \
|
||||
|
||||
newtestssilent: $(NEW_TESTS)
|
||||
|
||||
%.res: %.vim .gdbinit
|
||||
$(RUN_VIMTEST) -u runtest.vim $*.vim
|
||||
|
||||
97
src/nvim/testdir/runtest.vim
Normal file
97
src/nvim/testdir/runtest.vim
Normal file
@@ -0,0 +1,97 @@
|
||||
" This script is sourced while editing the .vim file with the tests.
|
||||
" When the script is successful the .res file will be created.
|
||||
" Errors are appended to the test.log file.
|
||||
"
|
||||
" The test script may contain anything, only functions that start with
|
||||
" "Test_" are special. These will be invoked and should contain assert
|
||||
" functions. See test_assert.vim for an example.
|
||||
"
|
||||
" It is possible to source other files that contain "Test_" functions. This
|
||||
" can speed up testing, since Vim does not need to restart. But be careful
|
||||
" that the tests do not interfere with each other.
|
||||
"
|
||||
" If an error cannot be detected properly with an assert function add the
|
||||
" error to the v:errors list:
|
||||
" call add(v:errors, 'test foo failed: Cannot find xyz')
|
||||
"
|
||||
" If preparation for each Test_ function is needed, define a SetUp function.
|
||||
" It will be called before each Test_ function.
|
||||
"
|
||||
" If cleanup after each Test_ function is needed, define a TearDown function.
|
||||
" It will be called after each Test_ function.
|
||||
|
||||
" Without the +eval feature we can't run these tests, bail out.
|
||||
if 0
|
||||
quit!
|
||||
endif
|
||||
|
||||
" Check that the screen size is at least 24 x 80 characters.
|
||||
if &lines < 24 || &columns < 80
|
||||
let error = 'Screen size too small! Tests require at least 24 lines with 80 characters'
|
||||
echoerr error
|
||||
split test.log
|
||||
$put =error
|
||||
w
|
||||
cquit
|
||||
endif
|
||||
|
||||
" Source the test script. First grab the file name, in case the script
|
||||
" navigates away.
|
||||
let testname = expand('%')
|
||||
source %
|
||||
|
||||
" Locate Test_ functions and execute them.
|
||||
redir @q
|
||||
function /^Test_
|
||||
redir END
|
||||
let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
|
||||
|
||||
let done = 0
|
||||
let fail = 0
|
||||
let errors = []
|
||||
for test in tests
|
||||
if exists("*SetUp")
|
||||
call SetUp()
|
||||
endif
|
||||
|
||||
let done += 1
|
||||
try
|
||||
exe 'call ' . test
|
||||
catch
|
||||
let fail += 1
|
||||
call add(v:errors, 'Caught exception in ' . test . ': ' . v:exception . ' @ ' . v:throwpoint)
|
||||
endtry
|
||||
|
||||
if len(v:errors) > 0
|
||||
let fail += 1
|
||||
call add(errors, 'Found errors in ' . test . ':')
|
||||
call extend(errors, v:errors)
|
||||
let v:errors = []
|
||||
endif
|
||||
|
||||
if exists("*TearDown")
|
||||
call TearDown()
|
||||
endif
|
||||
endfor
|
||||
|
||||
if fail == 0
|
||||
" Success, create the .res file so that make knows it's done.
|
||||
exe 'split ' . fnamemodify(testname, ':r') . '.res'
|
||||
write
|
||||
endif
|
||||
|
||||
if len(errors) > 0
|
||||
" Append errors to test.log
|
||||
split test.log
|
||||
call append(line('$'), '')
|
||||
call append(line('$'), 'From ' . testname . ':')
|
||||
call append(line('$'), errors)
|
||||
write
|
||||
endif
|
||||
|
||||
echo 'Executed ' . done . (done > 1 ? ' tests': ' test')
|
||||
if fail > 0
|
||||
echo fail . ' FAILED'
|
||||
endif
|
||||
|
||||
qall!
|
||||
@@ -69,6 +69,61 @@ static char *features[] = {
|
||||
|
||||
// clang-format off
|
||||
static int included_patches[] = {
|
||||
1055,
|
||||
// 1054,
|
||||
// 1053,
|
||||
// 1052,
|
||||
// 1051,
|
||||
// 1050,
|
||||
// 1049,
|
||||
// 1048,
|
||||
// 1047,
|
||||
// 1046,
|
||||
// 1045,
|
||||
// 1044,
|
||||
// 1043,
|
||||
// 1042,
|
||||
// 1041,
|
||||
// 1040,
|
||||
// 1039,
|
||||
// 1038,
|
||||
// 1037,
|
||||
// 1036,
|
||||
// 1035,
|
||||
// 1034,
|
||||
// 1033,
|
||||
1032,
|
||||
// 1031,
|
||||
// 1030,
|
||||
// 1029,
|
||||
// 1028,
|
||||
// 1027,
|
||||
// 1026,
|
||||
// 1025,
|
||||
// 1024,
|
||||
// 1023,
|
||||
// 1022,
|
||||
// 1021,
|
||||
// 1020,
|
||||
// 1019,
|
||||
// 1018,
|
||||
// 1017,
|
||||
// 1016,
|
||||
// 1015,
|
||||
// 1014,
|
||||
// 1013,
|
||||
// 1012,
|
||||
// 1011,
|
||||
// 1010,
|
||||
// 1009,
|
||||
// 1008,
|
||||
// 1007,
|
||||
// 1006,
|
||||
// 1005,
|
||||
// 1004,
|
||||
// 1003,
|
||||
// 1002,
|
||||
// 1001,
|
||||
// 1000,
|
||||
// 999 NA
|
||||
// 998,
|
||||
@@ -116,16 +171,16 @@ static int included_patches[] = {
|
||||
// 956,
|
||||
// 955,
|
||||
// 954 NA
|
||||
// 953,
|
||||
953,
|
||||
// 952,
|
||||
// 951,
|
||||
// 950,
|
||||
950,
|
||||
// 949,
|
||||
// 948 NA
|
||||
// 947,
|
||||
// 946,
|
||||
// 945,
|
||||
// 944,
|
||||
946,
|
||||
945,
|
||||
944,
|
||||
// 943,
|
||||
// 942,
|
||||
// 941,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
require('coxpcall')
|
||||
local ffi = require('ffi')
|
||||
local lfs = require('lfs')
|
||||
local assert = require('luassert')
|
||||
local Loop = require('nvim.loop')
|
||||
@@ -246,9 +247,13 @@ end
|
||||
|
||||
local function source(code)
|
||||
local tmpname = os.tmpname()
|
||||
if ffi.os == 'OSX' and string.match(tmpname, '^/tmp') then
|
||||
tmpname = '/private'..tmpname
|
||||
end
|
||||
write_file(tmpname, code)
|
||||
nvim_command('source '..tmpname)
|
||||
os.remove(tmpname)
|
||||
return tmpname
|
||||
end
|
||||
|
||||
local function eq(expected, actual)
|
||||
|
||||
47
test/functional/legacy/100_lispwords_spec.lua
Normal file
47
test/functional/legacy/100_lispwords_spec.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
-- Tests for 'lispwords' setting being global-local
|
||||
|
||||
local helpers = require('test.functional.helpers')
|
||||
local source = helpers.source
|
||||
local clear, expect = helpers.clear, helpers.expect
|
||||
|
||||
describe('undolevel', function()
|
||||
setup(clear)
|
||||
|
||||
it('is working', function()
|
||||
source([[
|
||||
setglobal lispwords=foo,bar,baz
|
||||
setlocal lispwords-=foo
|
||||
setlocal lispwords+=quux
|
||||
redir @A
|
||||
echo "Testing 'lispwords' local value"
|
||||
setglobal lispwords?
|
||||
setlocal lispwords?
|
||||
echo &lispwords
|
||||
echo ''
|
||||
redir end
|
||||
setlocal lispwords<
|
||||
redir @A
|
||||
echo "Testing 'lispwords' value reset"
|
||||
setglobal lispwords?
|
||||
setlocal lispwords?
|
||||
echo &lispwords
|
||||
redir end
|
||||
|
||||
0put a
|
||||
$d
|
||||
]])
|
||||
|
||||
-- Assert buffer contents.
|
||||
expect([[
|
||||
|
||||
Testing 'lispwords' local value
|
||||
lispwords=foo,bar,baz
|
||||
lispwords=bar,baz,quux
|
||||
bar,baz,quux
|
||||
|
||||
Testing 'lispwords' value reset
|
||||
lispwords=foo,bar,baz
|
||||
lispwords=foo,bar,baz
|
||||
foo,bar,baz]])
|
||||
end)
|
||||
end)
|
||||
@@ -1,142 +0,0 @@
|
||||
-- Tests for 'undolevel' setting being global-local
|
||||
|
||||
local helpers = require('test.functional.helpers')
|
||||
local source = helpers.source
|
||||
local clear, expect = helpers.clear, helpers.expect
|
||||
|
||||
describe('undolevel', function()
|
||||
setup(clear)
|
||||
|
||||
it('is working', function()
|
||||
source([[
|
||||
set ul=5
|
||||
fu! FillBuffer()
|
||||
for i in range(1,13)
|
||||
put=i
|
||||
exe "setg ul=" . &g:ul
|
||||
endfor
|
||||
endfu
|
||||
fu! UndoLevel()
|
||||
redir @z
|
||||
setglobal undolevels?
|
||||
echon ' global'
|
||||
setlocal undolevels?
|
||||
echon ' local'
|
||||
redir end
|
||||
$put z
|
||||
endfu
|
||||
|
||||
0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'
|
||||
call FillBuffer()
|
||||
setlocal undolevels<
|
||||
earlier 10
|
||||
call UndoLevel()
|
||||
set ff=unix
|
||||
%yank A
|
||||
%delete
|
||||
|
||||
0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)'
|
||||
setlocal ul=2
|
||||
call FillBuffer()
|
||||
earlier 10
|
||||
call UndoLevel()
|
||||
setlocal ul=10
|
||||
call UndoLevel()
|
||||
set ff=unix
|
||||
%yank A
|
||||
%delete
|
||||
setlocal undolevels<
|
||||
redir @A
|
||||
echo "global value shouldn't be changed and still be 5!"
|
||||
echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'
|
||||
setglobal undolevels?
|
||||
echon ' global'
|
||||
setlocal undolevels?
|
||||
echon ' local'
|
||||
echo ""
|
||||
redir end
|
||||
|
||||
setglobal ul=50
|
||||
1put ='global value should be changed to 50'
|
||||
2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)'
|
||||
call UndoLevel()
|
||||
set ff=unix
|
||||
%yank A
|
||||
%delete
|
||||
setglobal lispwords=foo,bar,baz
|
||||
setlocal lispwords-=foo
|
||||
setlocal lispwords+=quux
|
||||
redir @A
|
||||
echo "Testing 'lispwords' local value"
|
||||
setglobal lispwords?
|
||||
setlocal lispwords?
|
||||
echo &lispwords
|
||||
echo ''
|
||||
redir end
|
||||
setlocal lispwords<
|
||||
redir @A
|
||||
echo "Testing 'lispwords' value reset"
|
||||
setglobal lispwords?
|
||||
setlocal lispwords?
|
||||
echo &lispwords
|
||||
redir end
|
||||
|
||||
0put a
|
||||
$d
|
||||
]])
|
||||
|
||||
-- Assert buffer contents.
|
||||
expect([[
|
||||
ONE: expecting global undolevels: 5, local undolevels: -123456 (default)
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
|
||||
|
||||
undolevels=5 global
|
||||
undolevels=-123456 local
|
||||
TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
|
||||
|
||||
undolevels=5 global
|
||||
undolevels=2 local
|
||||
|
||||
undolevels=5 global
|
||||
undolevels=10 local
|
||||
|
||||
global value shouldn't be changed and still be 5!
|
||||
ONE: expecting global undolevels: 5, local undolevels: -123456 (default)
|
||||
undolevels=5 global
|
||||
undolevels=-123456 local
|
||||
|
||||
global value should be changed to 50
|
||||
THREE: expecting global undolevels: 50, local undolevels: -123456 (default)
|
||||
|
||||
undolevels=50 global
|
||||
undolevels=-123456 local
|
||||
|
||||
Testing 'lispwords' local value
|
||||
lispwords=foo,bar,baz
|
||||
lispwords=bar,baz,quux
|
||||
bar,baz,quux
|
||||
|
||||
Testing 'lispwords' value reset
|
||||
lispwords=foo,bar,baz
|
||||
lispwords=foo,bar,baz
|
||||
foo,bar,baz]])
|
||||
end)
|
||||
end)
|
||||
145
test/functional/legacy/assert_spec.lua
Normal file
145
test/functional/legacy/assert_spec.lua
Normal file
@@ -0,0 +1,145 @@
|
||||
local helpers = require('test.functional.helpers')
|
||||
local nvim, call = helpers.meths, helpers.call
|
||||
local clear, eq = helpers.clear, helpers.eq
|
||||
local source, execute = helpers.source, helpers.execute
|
||||
|
||||
local function expected_errors(errors)
|
||||
eq(errors, nvim.get_vvar('errors'))
|
||||
end
|
||||
|
||||
local function expected_empty()
|
||||
eq({}, nvim.get_vvar('errors'))
|
||||
end
|
||||
|
||||
describe('assert function:', function()
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
end)
|
||||
|
||||
-- assert_equal({expected}, {actual}, [, {msg}])
|
||||
describe('assert_equal', function()
|
||||
it('should not change v:errors when expected is equal to actual', function()
|
||||
source([[
|
||||
let s = 'foo'
|
||||
call assert_equal('foo', s)
|
||||
let n = 4
|
||||
call assert_equal(4, n)
|
||||
let l = [1, 2, 3]
|
||||
call assert_equal([1, 2, 3], l)
|
||||
fu Func()
|
||||
endfu
|
||||
let F1 = function('Func')
|
||||
let F2 = function('Func')
|
||||
call assert_equal(F1, F2)
|
||||
]])
|
||||
expected_empty()
|
||||
end)
|
||||
|
||||
it('should not change v:errors when expected is equal to actual', function()
|
||||
call('assert_equal', '', '')
|
||||
call('assert_equal', 'string', 'string')
|
||||
expected_empty()
|
||||
end)
|
||||
|
||||
it('should change v:errors when expected is not equal to actual', function()
|
||||
call('assert_equal', 0, {0})
|
||||
expected_errors({'Expected 0 but got [0]'})
|
||||
end)
|
||||
|
||||
it('should change v:errors when expected is not equal to actual', function()
|
||||
call('assert_equal', 0, "0")
|
||||
expected_errors({"Expected 0 but got '0'"})
|
||||
end)
|
||||
|
||||
it('should change v:errors when expected is not equal to actual', function()
|
||||
-- Lua does not tell integer from float.
|
||||
execute('call assert_equal(1, 1.0)')
|
||||
expected_errors({'Expected 1 but got 1.0'})
|
||||
end)
|
||||
|
||||
it('should change v:errors when expected is not equal to actual', function()
|
||||
call('assert_equal', 'true', 'false')
|
||||
expected_errors({"Expected 'true' but got 'false'"})
|
||||
end)
|
||||
end)
|
||||
|
||||
-- assert_false({actual}, [, {msg}])
|
||||
describe('assert_false', function()
|
||||
it('should not change v:errors when actual is false', function()
|
||||
call('assert_false', 0)
|
||||
call('assert_false', false)
|
||||
expected_empty()
|
||||
end)
|
||||
|
||||
it('should change v:errors when actual is not false', function()
|
||||
call('assert_false', 1)
|
||||
expected_errors({'Expected False but got 1'})
|
||||
end)
|
||||
|
||||
it('should change v:errors when actual is not false', function()
|
||||
call('assert_false', {})
|
||||
expected_errors({'Expected False but got []'})
|
||||
end)
|
||||
end)
|
||||
|
||||
-- assert_true({actual}, [, {msg}])
|
||||
describe('assert_true', function()
|
||||
it('should not change v:errors when actual is true', function()
|
||||
call('assert_true', 1)
|
||||
call('assert_true', -1) -- In Vim script, non-zero Numbers are TRUE.
|
||||
call('assert_true', true)
|
||||
expected_empty()
|
||||
end)
|
||||
|
||||
it('should change v:errors when actual is not true', function()
|
||||
call('assert_true', 1.5)
|
||||
expected_errors({'Expected True but got 1.5'})
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('v:errors', function()
|
||||
it('should be initialized at startup', function()
|
||||
expected_empty()
|
||||
end)
|
||||
|
||||
it('should have function names and relative line numbers', function()
|
||||
source([[
|
||||
fu Func_one()
|
||||
call assert_equal([0], {'0' : 0})
|
||||
call assert_false('False')
|
||||
call assert_true("True")
|
||||
endfu
|
||||
fu Func_two()
|
||||
" for shifting a line number
|
||||
call assert_true('line two')
|
||||
endfu
|
||||
]])
|
||||
call('Func_one')
|
||||
call('Func_two')
|
||||
expected_errors({
|
||||
"function Func_one line 1: Expected [0] but got {'0': 0}",
|
||||
"function Func_one line 2: Expected False but got 'False'",
|
||||
"function Func_one line 3: Expected True but got 'True'",
|
||||
"function Func_two line 2: Expected True but got 'line two'",
|
||||
})
|
||||
end)
|
||||
|
||||
it('should have file names and passed messages', function()
|
||||
local tmpname_one = source([[
|
||||
call assert_equal(1, 100, 'equal assertion failed')
|
||||
call assert_false('true', 'true assertion failed')
|
||||
call assert_true('false', 'false assertion failed')
|
||||
]])
|
||||
local tmpname_two = source([[
|
||||
call assert_true('', 'file two')
|
||||
]])
|
||||
expected_errors({
|
||||
tmpname_one .. " line 1: 'equal assertion failed'",
|
||||
tmpname_one .. " line 2: 'true assertion failed'",
|
||||
tmpname_one .. " line 3: 'false assertion failed'",
|
||||
tmpname_two .. " line 1: 'file two'",
|
||||
})
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
58
test/functional/legacy/undolevels_spec.lua
Normal file
58
test/functional/legacy/undolevels_spec.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
local helpers = require('test.functional.helpers')
|
||||
local source, clear = helpers.source, helpers.clear
|
||||
local eq, nvim = helpers.eq, helpers.meths
|
||||
|
||||
describe('undolevel', function()
|
||||
setup(clear)
|
||||
|
||||
it('is working', function()
|
||||
source([[
|
||||
func FillBuffer()
|
||||
for i in range(1,13)
|
||||
put=i
|
||||
" Set 'undolevels' to split undo.
|
||||
exe "setg ul=" . &g:ul
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func Test_global_local_undolevels()
|
||||
new one
|
||||
set undolevels=5
|
||||
call FillBuffer()
|
||||
" will only undo the last 5 changes, end up with 13 - (5 + 1) = 7 lines
|
||||
earlier 10
|
||||
call assert_equal(5, &g:undolevels)
|
||||
call assert_equal(-123456, &l:undolevels)
|
||||
call assert_equal('7', getline('$'))
|
||||
|
||||
new two
|
||||
setlocal undolevels=2
|
||||
call FillBuffer()
|
||||
" will only undo the last 2 changes, end up with 13 - (2 + 1) = 10 lines
|
||||
earlier 10
|
||||
call assert_equal(5, &g:undolevels)
|
||||
call assert_equal(2, &l:undolevels)
|
||||
call assert_equal('10', getline('$'))
|
||||
|
||||
setlocal ul=10
|
||||
call assert_equal(5, &g:undolevels)
|
||||
call assert_equal(10, &l:undolevels)
|
||||
|
||||
" Setting local value in "two" must not change local value in "one"
|
||||
wincmd p
|
||||
call assert_equal(5, &g:undolevels)
|
||||
call assert_equal(-123456, &l:undolevels)
|
||||
|
||||
new three
|
||||
setglobal ul=50
|
||||
call assert_equal(50, &g:undolevels)
|
||||
call assert_equal(-123456, &l:undolevels)
|
||||
|
||||
endfunc
|
||||
|
||||
call Test_global_local_undolevels()
|
||||
]])
|
||||
|
||||
eq({}, nvim.get_vvar('errors'))
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user