aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-12-11 01:43:36 +0300
committerZyX <kp-pav@yandex.ru>2017-12-11 01:43:36 +0300
commitceb45a08858837319c8ea67b1aaeceaeb24c8510 (patch)
tree86ed476fe0ea106be41186ad1ed52bb97621fb18
parentfe55f37083b0bef07aa9ac78eb2727c244fdafd3 (diff)
downloadrneovim-ceb45a08858837319c8ea67b1aaeceaeb24c8510.tar.gz
rneovim-ceb45a08858837319c8ea67b1aaeceaeb24c8510.tar.bz2
rneovim-ceb45a08858837319c8ea67b1aaeceaeb24c8510.zip
*: Fix test failures
-rw-r--r--src/nvim/eval.c10
-rw-r--r--src/nvim/eval/encode.c4
-rw-r--r--src/nvim/ex_getln.c1
-rw-r--r--test/functional/eval/msgpack_functions_spec.lua2
-rw-r--r--test/functional/legacy/063_match_and_matchadd_spec.lua6
5 files changed, 15 insertions, 8 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 6271603a1d..b45cfcb427 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -14545,12 +14545,14 @@ static void f_setline(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// Default result is zero == OK.
for (;; ) {
+ if (argvars[1].v_type == VAR_LIST) {
// List argument, get next string.
- if (li == NULL) {
- break;
+ if (li == NULL) {
+ break;
+ }
+ line = tv_get_string_chk(TV_LIST_ITEM_TV(li));
+ li = TV_LIST_ITEM_NEXT(l, li);
}
- line = tv_get_string_chk(TV_LIST_ITEM_TV(li));
- li = TV_LIST_ITEM_NEXT(l, li);
rettv->vval.v_number = 1; // FAIL
if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1) {
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index 50ddb1f38c..85fd4d1578 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -140,7 +140,9 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack,
? tv_list_last(v.data.l.list)
: TV_LIST_ITEM_PREV(v.data.l.list,
v.data.l.li));
- int idx = (int)tv_list_idx_of_item(v.data.l.list, li);
+ int idx = (li == NULL
+ ? 0
+ : (int)tv_list_idx_of_item(v.data.l.list, li));
if (v.type == kMPConvList
|| li == NULL
|| (TV_LIST_ITEM_TV(li)->v_type != VAR_LIST
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index fcd230d535..a5a8804e1c 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2680,6 +2680,7 @@ static bool color_cmdline(CmdlineInfo *colored_ccline)
.end = end,
.attr = attr,
}));
+ i++;
});
if (prev_end < colored_ccline->cmdlen) {
kv_push(ccline_colors->colors, ((CmdlineColorChunk) {
diff --git a/test/functional/eval/msgpack_functions_spec.lua b/test/functional/eval/msgpack_functions_spec.lua
index b241635dfe..258d6ee059 100644
--- a/test/functional/eval/msgpack_functions_spec.lua
+++ b/test/functional/eval/msgpack_functions_spec.lua
@@ -628,7 +628,7 @@ describe('msgpackdump() function', function()
it('fails to dump a recursive (key) map in a special dict', function()
command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
command('call add(todump._VAL, [todump, 0])')
- eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 1',
+ eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0',
exc_exec('call msgpackdump([todump])'))
end)
diff --git a/test/functional/legacy/063_match_and_matchadd_spec.lua b/test/functional/legacy/063_match_and_matchadd_spec.lua
index a505a2db30..518d79861b 100644
--- a/test/functional/legacy/063_match_and_matchadd_spec.lua
+++ b/test/functional/legacy/063_match_and_matchadd_spec.lua
@@ -114,9 +114,11 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
command("call clearmatches()")
eq('\nE714: List required', redir_exec("let rf1 = setmatches(0)"))
eq(-1, eval('rf1'))
- eq('\nE474: Invalid argument', redir_exec("let rf2 = setmatches([0])"))
+ eq('\nE474: List item 0 is either not a dictionary or an empty one',
+ redir_exec("let rf2 = setmatches([0])"))
eq(-1, eval('rf2'))
- eq('\nE474: Invalid argument', redir_exec("let rf3 = setmatches([{'wrong key': 'wrong value'}])"))
+ eq('\nE474: List item 0 is missing one of the required keys',
+ redir_exec("let rf3 = setmatches([{'wrong key': 'wrong value'}])"))
eq(-1, eval('rf3'))
-- Check that "matchaddpos()" positions matches correctly