diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-01-10 01:33:05 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-01-10 01:33:05 -0500 |
commit | 9bf694ff0bd6a4251758524f762847208618c8f3 (patch) | |
tree | 3e97b13c44361ef74f02fa18ffe8c9fea2f9a690 /src | |
parent | 50db0312f941ba489466d7d6b21088f1870429ee (diff) | |
parent | f350655ddd3846f7c1e12a21fcb30d49f90fa6b6 (diff) | |
download | rneovim-9bf694ff0bd6a4251758524f762847208618c8f3.tar.gz rneovim-9bf694ff0bd6a4251758524f762847208618c8f3.tar.bz2 rneovim-9bf694ff0bd6a4251758524f762847208618c8f3.zip |
Merge #3857 'Vim 7.4.{944,945,946,950,953,1032,1055}'.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 815 | ||||
-rw-r--r-- | src/nvim/eval.h | 1 | ||||
-rw-r--r-- | src/nvim/garray.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 23 | ||||
-rw-r--r-- | src/nvim/testdir/runtest.vim | 97 | ||||
-rw-r--r-- | src/nvim/version.c | 65 |
6 files changed, 646 insertions, 360 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 57d7002739..76708e21ad 100644 --- a/src/nvim/eval.c +++ b/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 */ diff --git a/src/nvim/eval.h b/src/nvim/eval.h index ea8b5bc253..79a1341d98 100644 --- a/src/nvim/eval.h +++ b/src/nvim/eval.h @@ -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 */ }; diff --git a/src/nvim/garray.c b/src/nvim/garray.c index 75c3fb9a73..e6cbd9332b 100644 --- a/src/nvim/garray.c +++ b/src/nvim/garray.c @@ -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); diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 1a414a8847..b4292dbd4b 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -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 diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim new file mode 100644 index 0000000000..0dc142eb97 --- /dev/null +++ b/src/nvim/testdir/runtest.vim @@ -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! diff --git a/src/nvim/version.c b/src/nvim/version.c index 6919efe871..d0a2771a19 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -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, |