diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | runtime/autoload/provider/node.vim | 3 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/rpc.lua | 17 | ||||
-rwxr-xr-x | scripts/vim-patch.sh | 124 | ||||
-rw-r--r-- | snap/snapcraft.yaml | 2 | ||||
-rw-r--r-- | src/nvim/api/vim.c | 2 | ||||
-rw-r--r-- | src/nvim/eval.c | 3 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 22 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 6 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 2 | ||||
-rw-r--r-- | src/nvim/hardcopy.c | 9 | ||||
-rw-r--r-- | src/nvim/lua/executor.c | 6 | ||||
-rw-r--r-- | src/nvim/misc1.c | 2 | ||||
-rw-r--r-- | src/nvim/mouse.c | 2 | ||||
-rw-r--r-- | src/nvim/ops.c | 11 | ||||
-rw-r--r-- | src/nvim/os/env.c | 4 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 14 | ||||
-rw-r--r-- | src/nvim/regexp.c | 1 | ||||
-rw-r--r-- | src/nvim/search.c | 9 | ||||
-rw-r--r-- | src/nvim/version.c | 2 | ||||
-rw-r--r-- | test/functional/core/job_spec.lua | 9 | ||||
-rw-r--r-- | test/functional/eval/system_spec.lua | 9 | ||||
-rw-r--r-- | test/functional/provider/nodejs_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/provider/python3_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/provider/python_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/provider/ruby_spec.lua | 5 |
26 files changed, 189 insertions, 91 deletions
@@ -15,6 +15,7 @@ [](https://repology.org/metapackage/neovim) [](https://buildd.debian.org/neovim) [](https://github.com/neovim/neovim/releases/) +[](https://snapcraft.io/nvim) Neovim is a project that seeks to aggressively refactor Vim in order to: diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim index b2a3b3ee08..c5d5e87729 100644 --- a/runtime/autoload/provider/node.vim +++ b/runtime/autoload/provider/node.vim @@ -51,6 +51,9 @@ function! provider#node#Detect() abort if exists('g:node_host_prog') return expand(g:node_host_prog) endif + if !executable('node') + return '' + endif if !s:is_minimum_version(v:null, 6, 0) return '' endif diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index a558f66a42..72a0bf8d6f 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -1,3 +1,4 @@ +local vim = vim local uv = vim.loop local log = require('vim.lsp.log') local protocol = require('vim.lsp.protocol') @@ -377,6 +378,22 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para decoded.error = convert_NIL(decoded.error) decoded.result = convert_NIL(decoded.result) + -- Do not surface RequestCancelled to users, it is RPC-internal. + if decoded.error + and decoded.error.code == protocol.ErrorCodes.RequestCancelled then + local _ = log.debug() and log.debug("Received cancellation ack", decoded) + local result_id = tonumber(decoded.id) + -- Clear any callback since this is cancelled now. + -- This is safe to do assuming that these conditions hold: + -- - The server will not send a result callback after this cancellation. + -- - If the server sent this cancellation ACK after sending the result, the user of this RPC + -- client will ignore the result themselves. + if result_id then + message_callbacks[result_id] = nil + end + return + end + -- We sent a number, so we expect a number. local result_id = tonumber(decoded.id) local callback = message_callbacks[result_id] diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index b6a0df4649..b5806311c9 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -395,13 +395,50 @@ list_vimpatch_numbers() { done } +declare -A tokens +declare -A vim_commit_tags + +_set_tokens_and_tags() { + set +u # Avoid "unbound variable" with bash < 4.4 below. + if [[ -n "${tokens[*]}" ]]; then + return + fi + set -u + + # Find all "vim-patch:xxx" tokens in the Nvim git log. + for token in $(list_vimpatch_tokens); do + tokens[$token]=1 + done + + # Create an associative array mapping Vim commits to tags. + eval "vim_commit_tags=( + $(git -C "${VIM_SOURCE_DIR}" for-each-ref refs/tags \ + --format '[%(objectname)]=%(refname:strip=2)' \ + --sort='-*authordate' \ + --shell) + )" + # Exit in case of errors from the above eval (empty vim_commit_tags). + if ! (( "${#vim_commit_tags[@]}" )); then + msg_err "Could not get Vim commits/tags." + exit 1 + fi +} + # Prints a newline-delimited list of Vim commits, for use by scripts. # "$1": use extended format? # "$@" is passed to list_vim_commits, as extra arguments to git-log. list_missing_vimpatches() { + local -a missing_vim_patches=() + _set_missing_vimpatches "$@" + for line in "${missing_vim_patches[@]}"; do + printf '%s\n' "$line" + done +} + +# Sets / appends to missing_vim_patches (useful to avoid a subshell when +# used multiple times to cache tokens/vim_commit_tags). +_set_missing_vimpatches() { local token vim_commit vim_tag patch_number - declare -A tokens - declare -A vim_commit_tags declare -a git_log_args local extended_format=$1; shift @@ -416,6 +453,7 @@ list_missing_vimpatches() { [^\(.*/\)?src/nvim/\(.*\)]="\${BASH_REMATCH[1]}src/\${BASH_REMATCH[2]}" [^\(.*/\)?\.vim-src/\(.*\)]="\${BASH_REMATCH[2]}" ) + local i j for i in "$@"; do for j in "${!git_log_replacements[@]}"; do if [[ "$i" =~ $j ]]; then @@ -426,23 +464,7 @@ list_missing_vimpatches() { git_log_args+=("$i") done - # Find all "vim-patch:xxx" tokens in the Nvim git log. - for token in $(list_vimpatch_tokens); do - tokens[$token]=1 - done - - # Create an associative array mapping Vim commits to tags. - eval "declare -A vim_commit_tags=( - $(git -C "${VIM_SOURCE_DIR}" for-each-ref refs/tags \ - --format '[%(objectname)]=%(refname:strip=2)' \ - --sort='-*authordate' \ - --shell) - )" - # Exit in case of errors from the above eval (empty vim_commit_tags). - if ! (( "${#vim_commit_tags[@]}" )); then - msg_err "Could not get Vim commits/tags." - exit 1 - fi + _set_tokens_and_tags # Get missing Vim commits set +u # Avoid "unbound variable" with bash < 4.4 below. @@ -474,9 +496,9 @@ list_missing_vimpatches() { if [[ "${tokens[$patch_number]-}" ]]; then continue fi - printf '%s%s\n' "$vim_tag" "$info" + missing_vim_patches+=("$vim_tag$info") else - printf '%s%s\n' "$vim_commit" "$info" + missing_vim_patches+=("$vim_commit$info") fi done < <(list_vim_commits "${git_log_args[@]}") set -u @@ -512,6 +534,59 @@ Instructions: EOF } +list_missing_previous_vimpatches_for_patch() { + local for_vim_patch="${1}" + local vim_commit vim_tag + assign_commit_details "${for_vim_patch}" + + local file + local -a missing_list + local -a fnames + while IFS= read -r line ; do + fnames+=("$line") + done < <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "${vim_commit}") + local i=0 + local n=${#fnames[@]} + printf '=== getting missing patches for %d files ===\n' "$n" + if [[ -z "${vim_tag}" ]]; then + printf 'NOTE: "%s" is not a Vim tag - listing all oldest missing patches\n' "${for_vim_patch}" >&2 + fi + for fname in "${fnames[@]}"; do + i=$(( i+1 )) + printf '[%.*d/%d] %s: ' "${#n}" "$i" "$n" "$fname" + + local -a missing_vim_patches=() + _set_missing_vimpatches 1 -- "${fname}" + + local missing_vim_commit_info="${missing_vim_patches[0]}" + if [[ -z "${missing_vim_commit_info}" ]]; then + printf -- "-\n" + else + local missing_vim_commit="${missing_vim_commit_info%%:*}" + if [[ -z "${vim_tag}" ]] || [[ "${missing_vim_commit}" < "${vim_tag}" ]]; then + printf -- "%s\n" "$missing_vim_commit_info" + missing_list+=("$missing_vim_commit_info") + else + printf -- "-\n" + fi + fi + done + + if [[ -z "${missing_list[*]}" ]]; then + msg_ok 'no missing previous Vim patches' + return 0 + fi + + local -a missing_unique + while IFS= read -r line; do + missing_unique+=("$line") + done < <(printf '%s\n' "${missing_list[@]}" | sort -u) + + msg_err "$(printf '%d missing previous Vim patches:' ${#missing_unique[@]})" + printf ' - %s\n' "${missing_unique[@]}" + return 1 +} + review_commit() { local nvim_commit_url="${1}" local nvim_patch_url="${nvim_commit_url}.patch" @@ -609,7 +684,7 @@ review_pr() { clean_files } -while getopts "hlLMVp:P:g:r:s" opt; do +while getopts "hlLmMVp:P:g:r:s" opt; do case ${opt} in h) usage @@ -629,6 +704,11 @@ while getopts "hlLMVp:P:g:r:s" opt; do list_vimpatch_numbers exit 0 ;; + m) + shift # remove opt + list_missing_previous_vimpatches_for_patch "$@" + exit 0 + ;; p) stage_patch "${OPTARG}" exit diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d0cbc27b3f..da3e74d3e7 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -12,7 +12,7 @@ description: | For lots more details, see the wiki! grade: stable # must be 'stable' to release into candidate/stable channels -confinement: strict +confinement: classic apps: nvim: diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 2f59edee33..661946e8d2 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -335,7 +335,7 @@ void nvim_input_mouse(String button, String action, String modifier, if (strequal(action.data, "down")) { code = KE_MOUSEUP; } else if (strequal(action.data, "up")) { - code = KE_MOUSEDOWN; + // code = KE_MOUSEDOWN } else if (strequal(action.data, "left")) { code = KE_MOUSERIGHT; } else if (strequal(action.data, "right")) { diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 8749c7d8f0..65f029649c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -12536,6 +12536,9 @@ static char **tv_to_argv(typval_T *cmd_tv, const char **cmd, bool *executable) char *exe_resolved = NULL; if (!arg0 || !os_can_exe(arg0, &exe_resolved, true)) { if (arg0 && executable) { + char buf[IOSIZE]; + snprintf(buf, sizeof(buf), "'%s' is not executable", arg0); + EMSG3(_(e_invargNval), "cmd", buf); *executable = false; } return NULL; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 0c3b467612..85048427b1 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -3249,7 +3249,6 @@ static void extmark_move_regmatch_single(lpos_T startpos, static void extmark_move_regmatch_multi(ExtmarkSubMulti s, long i) { colnr_T mincol; - linenr_T u_lnum; mincol = s.startpos.col + 1; linenr_T n_u_lnum = s.lnum + s.endpos.lnum - s.startpos.lnum; @@ -3266,7 +3265,7 @@ static void extmark_move_regmatch_multi(ExtmarkSubMulti s, long i) // -- Delete Pattern -- // 1. Move marks in the pattern mincol = s.startpos.col + 1; - u_lnum = n_u_lnum; + linenr_T u_lnum = n_u_lnum; assert(n_u_lnum == u_lnum); extmark_copy_and_place(curbuf, s.lnum, mincol, @@ -3311,7 +3310,6 @@ static void extmark_move_regmatch_multi(ExtmarkSubMulti s, long i) assert(s.startpos.lnum == 0); mincol = s.startpos.col + 1; - u_lnum = n_u_lnum; if (!s.newline_in_pat && s.newline_in_sub) { // -- Delete Pattern -- @@ -4947,17 +4945,21 @@ help_heuristic( * If the match is more than 2 chars from the start, multiply by 200 to * put it after matches at the start. */ - if (ASCII_ISALNUM(matched_string[offset]) && offset > 0 - && ASCII_ISALNUM(matched_string[offset - 1])) + if (offset > 0 + && ASCII_ISALNUM(matched_string[offset]) + && ASCII_ISALNUM(matched_string[offset - 1])) { offset += 10000; - else if (offset > 2) + } else if (offset > 2) { offset *= 200; - if (wrong_case) + } + if (wrong_case) { offset += 5000; - /* Features are less interesting than the subjects themselves, but "+" - * alone is not a feature. */ - if (matched_string[0] == '+' && matched_string[1] != NUL) + } + // Features are less interesting than the subjects themselves, but "+" + // alone is not a feature. + if (matched_string[0] == '+' && matched_string[1] != NUL) { offset += 100; + } return (int)(100 * num_letters + STRLEN(matched_string) + offset); } diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index d16ad9db2c..afe2660cdf 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -2807,9 +2807,11 @@ int modifier_len(char_u *cmd) for (j = 0; p[j] != NUL; ++j) if (p[j] != cmdmods[i].name[j]) break; - if (!ASCII_ISALPHA(p[j]) && j >= cmdmods[i].minlen - && (p == cmd || cmdmods[i].has_count)) + if (j >= cmdmods[i].minlen + && !ASCII_ISALPHA(p[j]) + && (p == cmd || cmdmods[i].has_count)) { return j + (int)(p - cmd); + } } return 0; } diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 35159060b8..e5f5e5ad87 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -3575,7 +3575,7 @@ static int ccheck_abbr(int c) // Do not consider '<,'> be part of the mapping, skip leading whitespace. // Actually accepts any mark. - while (ascii_iswhite(ccline.cmdbuff[spos]) && spos < ccline.cmdlen) { + while (spos < ccline.cmdlen && ascii_iswhite(ccline.cmdbuff[spos])) { spos++; } if (ccline.cmdlen - spos > 5 diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index 4b361d2d45..cb5c5338a1 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -2305,13 +2305,10 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) || TOLOWER_ASC(printer_opts[OPT_PRINT_COLLATE].string[0]) == 'y'); if (prt_collate) { - /* TODO: Get number of collated copies wanted. */ - psettings->n_collated_copies = 1; + // TODO(vim): Get number of collated copies wanted. } else { - /* TODO: Get number of uncollated copies wanted and update the cached - * count. - */ - prt_num_copies = 1; + // TODO(vim): Get number of uncollated copies wanted and update the cached + // count. } psettings->jobname = jobname; diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 1d3d9929d3..2cd6c0db66 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -770,8 +770,10 @@ static void typval_exec_lua(const char *lcmd, size_t lcmd_len, const char *name, typval_T *ret_tv) { if (check_restricted() || check_secure()) { - ret_tv->v_type = VAR_NUMBER; - ret_tv->vval.v_number = 0; + if (ret_tv) { + ret_tv->v_type = VAR_NUMBER; + ret_tv->vval.v_number = 0; + } return; } diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index a871d424c6..8c19a2de66 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -277,7 +277,7 @@ int get_last_leader_offset(char_u *line, char_u **flags) // whitespace. Otherwise we would think we are inside a // comment if the middle part appears somewhere in the middle // of the line. E.g. for C the "*" appears often. - for (j = 0; ascii_iswhite(line[j]) && j <= i; j++) { + for (j = 0; j <= i && ascii_iswhite(line[j]); j++) { } if (j < i) { continue; diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index d29db2cf92..dab2e44890 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -479,7 +479,7 @@ win_T *mouse_find_win(int *gridp, int *rowp, int *colp) static win_T *mouse_find_grid_win(int *gridp, int *rowp, int *colp) { if (*gridp == msg_grid.handle) { - rowp += msg_grid_pos; + // rowp += msg_grid_pos; // PVS: dead store #11612 *gridp = DEFAULT_GRID_HANDLE; } else if (*gridp > 1) { win_T *wp = get_win_by_grid_handle(*gridp); diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 0ca16e2c25..b597c5b214 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1672,17 +1672,6 @@ setmarks: extmark_col_adjust_delete(curbuf, lnum, mincol, endcol, kExtmarkUndo, 0); } - - // Delete characters within one line, - // The case with multiple lines is handled by do_join - } else if (oap->motion_type == kMTCharWise && oap->line_count == 1) { - // + 1 to change to buf mode, then plus 1 to fit function requirements - endcol = oap->end.col + 1 + 1; - - lnum = curwin->w_cursor.lnum; - if (oap->is_VIsual == false) { - endcol = MAX(endcol - 1, mincol); - } } return OK; } diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 360609c50d..ec266796a8 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -266,10 +266,8 @@ void os_copy_fullenv(char **env, size_t env_size) extern char **environ; # endif - size_t i = 0; - while (environ[i] != NULL && i < env_size) { + for (size_t i = 0; i < env_size && environ[i] != NULL; i++) { env[i] = xstrdup(environ[i]); - i++; } #endif } diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 5d30ca624f..71c6f06ac0 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -1341,9 +1341,10 @@ static int qf_parse_fmt_t(regmatch_T *rmp, int midx, qffields_T *fields) /// Parse the match for '%+' format pattern. The whole matching line is included /// in the error string. Return the matched line in "fields->errmsg". -static int qf_parse_fmt_plus(char_u *linebuf, - size_t linelen, - qffields_T *fields) +static void qf_parse_fmt_plus(const char_u *linebuf, + size_t linelen, + qffields_T *fields) + FUNC_ATTR_NONNULL_ALL { if (linelen >= fields->errmsglen) { // linelen + null terminator @@ -1351,7 +1352,6 @@ static int qf_parse_fmt_plus(char_u *linebuf, fields->errmsglen = linelen + 1; } STRLCPY(fields->errmsg, linebuf, linelen + 1); - return QF_OK; } /// Parse the match for error message ('%m') pattern in regmatch. @@ -1508,7 +1508,7 @@ static int qf_parse_match(char_u *linebuf, size_t linelen, efm_T *fmt_ptr, status = qf_parse_fmt_f(regmatch, midx, fields, idx); } else if (i == 5) { if (fmt_ptr->flags == '+' && !qf_multiscan) { // %+ - status = qf_parse_fmt_plus(linebuf, linelen, fields); + qf_parse_fmt_plus(linebuf, linelen, fields); } else if (midx > 0) { // %m status = qf_parse_fmt_m(regmatch, midx, fields); } @@ -4513,7 +4513,7 @@ static void qf_get_nth_below_entry(qfline_T *entry, linenr_T n) { while (n-- > 0 && !got_int) { - qfline_T *first_entry = entry; + // qfline_T *first_entry = entry; int first_errornr = *errornr; // Treat all the entries on the same line in this file as one @@ -4523,7 +4523,7 @@ static void qf_get_nth_below_entry(qfline_T *entry, || entry->qf_next->qf_fnum != entry->qf_fnum) { // If multiple entries are on the same line, then use the first // entry - entry = first_entry; + // entry = first_entry; *errornr = first_errornr; break; } diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 9bc7ef07eb..90dc8ab90f 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -3575,6 +3575,7 @@ theend: * Create a new extmatch and mark it as referenced once. */ static reg_extmatch_T *make_extmatch(void) + FUNC_ATTR_NONNULL_RET { reg_extmatch_T *em = xcalloc(1, sizeof(reg_extmatch_T)); em->refcnt = 1; diff --git a/src/nvim/search.c b/src/nvim/search.c index 5e32715e49..3ee9777805 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -2175,17 +2175,14 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel) * Return MAXCOL if not, otherwise return the column. * TODO: skip strings. */ -static int check_linecomment(char_u *line) +static int check_linecomment(const char_u *line) { - char_u *p; - - p = line; - /* skip Lispish one-line comments */ + const char_u *p = line; // scan from start + // skip Lispish one-line comments if (curbuf->b_p_lisp) { if (vim_strchr(p, ';') != NULL) { /* there may be comments */ int in_str = FALSE; /* inside of string */ - p = line; /* scan from start */ while ((p = vim_strpbrk(p, (char_u *)"\";")) != NULL) { if (*p == '"') { if (in_str) { diff --git a/src/nvim/version.c b/src/nvim/version.c index 4cadc9fd6c..4360b3776b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -151,7 +151,7 @@ static const int included_patches[] = { 1770, // 1769, 1768, - // 1767, + 1767, 1766, 1765, 1764, diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index e5d4444b92..b63b868127 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -185,11 +185,10 @@ describe('jobs', function() return eval([[jobstart('')]]) end local executable_jobid = new_job() - local nonexecutable_jobid = eval("jobstart(['"..(iswin() - and './test/functional/fixtures' - or './test/functional/fixtures/non_executable.txt').."'])") - eq(-1, nonexecutable_jobid) - -- Should _not_ throw an error. + + local exe = iswin() and './test/functional/fixtures' or './test/functional/fixtures/non_executable.txt' + eq("Vim:E475: Invalid value for argument cmd: '"..exe.."' is not executable", + pcall_err(eval, "jobstart(['"..exe.."'])")) eq("", eval("v:errmsg")) -- Non-executable job should not increment the job ids. #5465 eq(executable_jobid + 1, new_job()) diff --git a/test/functional/eval/system_spec.lua b/test/functional/eval/system_spec.lua index 1e4d760dbc..8b18eff451 100644 --- a/test/functional/eval/system_spec.lua +++ b/test/functional/eval/system_spec.lua @@ -8,6 +8,7 @@ local command = helpers.command local exc_exec = helpers.exc_exec local iswin = helpers.iswin local os_kill = helpers.os_kill +local pcall_err = helpers.pcall_err local Screen = require('test.functional.ui.screen') @@ -32,8 +33,9 @@ describe('system()', function() return nvim_dir..'/printargs-test' .. (iswin() and '.exe' or '') end - it('sets v:shell_error if cmd[0] is not executable', function() - call('system', { 'this-should-not-exist' }) + it('throws error if cmd[0] is not executable', function() + eq("Vim:E475: Invalid value for argument cmd: 'this-should-not-exist' is not executable", + pcall_err(call, 'system', { 'this-should-not-exist' })) eq(-1, eval('v:shell_error')) end) @@ -48,7 +50,8 @@ describe('system()', function() eq(0, eval('v:shell_error')) -- Provoke a non-zero v:shell_error. - call('system', { 'this-should-not-exist' }) + eq("Vim:E475: Invalid value for argument cmd: 'this-should-not-exist' is not executable", + pcall_err(call, 'system', { 'this-should-not-exist' })) local old_val = eval('v:shell_error') eq(-1, old_val) diff --git a/test/functional/provider/nodejs_spec.lua b/test/functional/provider/nodejs_spec.lua index 07a00f8a8c..661a6f4f94 100644 --- a/test/functional/provider/nodejs_spec.lua +++ b/test/functional/provider/nodejs_spec.lua @@ -8,8 +8,9 @@ local retry = helpers.retry do clear() - if missing_provider('node') then - pending("Missing nodejs host, or nodejs version is too old.", function()end) + local reason = missing_provider('node') + if reason then + pending(string.format("Missing nodejs host, or nodejs version is too old (%s)", reason), function() end) return end end diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua index b319d5e948..d254edc7d5 100644 --- a/test/functional/provider/python3_spec.lua +++ b/test/functional/provider/python3_spec.lua @@ -10,13 +10,14 @@ local pcall_err = helpers.pcall_err do clear() - if missing_provider('python3') then + local reason = missing_provider('python3') + if reason then it(':python3 reports E319 if provider is missing', function() local expected = [[Vim%(py3.*%):E319: No "python3" provider found.*]] matches(expected, pcall_err(command, 'py3 print("foo")')) matches(expected, pcall_err(command, 'py3file foo')) end) - pending('Python 3 (or the pynvim module) is broken/missing', function() end) + pending(string.format('Python 3 (or the pynvim module) is broken/missing (%s)', reason), function() end) return end end diff --git a/test/functional/provider/python_spec.lua b/test/functional/provider/python_spec.lua index 986f10b2e9..d60d8d1001 100644 --- a/test/functional/provider/python_spec.lua +++ b/test/functional/provider/python_spec.lua @@ -18,13 +18,14 @@ local pcall_err = helpers.pcall_err do clear() - if missing_provider('python') then + local reason = missing_provider('python') + if reason then it(':python reports E319 if provider is missing', function() local expected = [[Vim%(py.*%):E319: No "python" provider found.*]] matches(expected, pcall_err(command, 'py print("foo")')) matches(expected, pcall_err(command, 'pyfile foo')) end) - pending('Python 2 (or the pynvim module) is broken/missing', function() end) + pending(string.format('Python 2 (or the pynvim module) is broken/missing (%s)', reason), function() end) return end end diff --git a/test/functional/provider/ruby_spec.lua b/test/functional/provider/ruby_spec.lua index d20adde2ef..bb7d23ede6 100644 --- a/test/functional/provider/ruby_spec.lua +++ b/test/functional/provider/ruby_spec.lua @@ -18,13 +18,14 @@ local pcall_err = helpers.pcall_err do clear() - if missing_provider('ruby') then + local reason = missing_provider('ruby') + if reason then it(':ruby reports E319 if provider is missing', function() local expected = [[Vim%(ruby.*%):E319: No "ruby" provider found.*]] matches(expected, pcall_err(command, 'ruby puts "foo"')) matches(expected, pcall_err(command, 'rubyfile foo')) end) - pending("Missing neovim RubyGem.", function() end) + pending(string.format('Missing neovim RubyGem (%s)', reason), function() end) return end end |