diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-25 21:32:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-25 21:32:12 +0800 |
commit | 43c49746d9cf82dba0d56b07d39722f9ebeecf90 (patch) | |
tree | 3d7f3aeb8522e11b55fc5ac296c9c13d370933e1 | |
parent | 2e8410b7be9dce7e5fa12a442e19d548bfb260bc (diff) | |
download | rneovim-43c49746d9cf82dba0d56b07d39722f9ebeecf90.tar.gz rneovim-43c49746d9cf82dba0d56b07d39722f9ebeecf90.tar.bz2 rneovim-43c49746d9cf82dba0d56b07d39722f9ebeecf90.zip |
vim-patch:9.0.0335: checks for Dictionary argument often give a vague error (#23309)
Problem: Checks for Dictionary argument often give a vague error message.
Solution: Give a useful error message. (Yegappan Lakshmanan, closes vim/vim#11009)
https://github.com/vim/vim/commit/04c4c5746e15884768d2cb41370c3276a196cd4c
Cherry-pick removal of E922 from docs from patch 9.0.1403.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
-rw-r--r-- | runtime/doc/builtin.txt | 2 | ||||
-rw-r--r-- | src/nvim/eval.c | 5 | ||||
-rw-r--r-- | src/nvim/eval/funcs.c | 14 | ||||
-rw-r--r-- | src/nvim/eval/typval.c | 23 | ||||
-rw-r--r-- | src/nvim/eval/window.c | 84 | ||||
-rw-r--r-- | src/nvim/mapping.c | 3 | ||||
-rw-r--r-- | src/nvim/search.c | 6 | ||||
-rw-r--r-- | src/nvim/sign.c | 22 | ||||
-rw-r--r-- | test/old/testdir/test_charsearch.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_expr.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_functions.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_listdict.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_maparg.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_matchfuzzy.vim | 8 | ||||
-rw-r--r-- | test/old/testdir/test_partial.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_search_stat.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_signs.vim | 12 | ||||
-rw-r--r-- | test/old/testdir/test_tagjump.vim | 8 | ||||
-rw-r--r-- | test/old/testdir/test_timers.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_window_cmd.vim | 6 |
20 files changed, 104 insertions, 105 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 91531db656..bf8d64ec02 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2525,7 +2525,7 @@ funcref({name} [, {arglist}] [, {dict}]) Can also be used as a |method|: > GetFuncname()->funcref([arg]) < - *function()* *partial* *E700* *E922* *E923* + *function()* *partial* *E700* *E923* function({name} [, {arglist}] [, {dict}]) Return a |Funcref| variable that refers to function {name}. {name} can be the name of a user defined function or an diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 35738cdfa9..bc33697c62 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5357,8 +5357,7 @@ void common_function(typval_T *argvars, typval_T *rettv, bool is_funcref) arg_idx = 1; } if (dict_idx > 0) { - if (argvars[dict_idx].v_type != VAR_DICT) { - emsg(_("E922: expected a dict")); + if (tv_check_for_dict_arg(argvars, dict_idx) == FAIL) { xfree(name); goto theend; } @@ -8726,7 +8725,7 @@ int typval_compare(typval_T *typ1, typval_T *typ2, exprtype_T type, bool ic) const bool type_is = type == EXPR_IS || type == EXPR_ISNOT; if (type_is && typ1->v_type != typ2->v_type) { - // For "is" a different type always means false, for "notis" + // For "is" a different type always means false, for "isnot" // it means true. n1 = type == EXPR_ISNOT; } else if (typ1->v_type == VAR_BLOB || typ2->v_type == VAR_BLOB) { diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index d903d498e7..2a5f1cb720 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -597,8 +597,7 @@ static void f_call(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) dict_T *selfdict = NULL; if (argvars[2].v_type != VAR_UNKNOWN) { - if (argvars[2].v_type != VAR_DICT) { - emsg(_(e_dictreq)); + if (tv_check_for_dict_arg(argvars, 2) == FAIL) { if (owned) { func_unref(func); } @@ -7359,8 +7358,7 @@ static void f_setcharpos(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) static void f_setcharsearch(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) { - if (argvars[0].v_type != VAR_DICT) { - emsg(_(e_dictreq)); + if (tv_check_for_dict_arg(argvars, 0) == FAIL) { return; } @@ -7631,8 +7629,7 @@ static void f_settagstack(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } // second argument: dict with items to set in the tag stack - if (argvars[1].v_type != VAR_DICT) { - emsg(_(e_dictreq)); + if (tv_check_for_dict_arg(argvars, 1) == FAIL) { return; } dict_T *d = argvars[1].vval.v_dict; @@ -8987,11 +8984,10 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } if (argvars[2].v_type != VAR_UNKNOWN) { - dict_T *dict = argvars[2].vval.v_dict; - if (argvars[2].v_type != VAR_DICT || dict == NULL) { - semsg(_(e_invarg2), tv_get_string(&argvars[2])); + if (tv_check_for_nonnull_dict_arg(argvars, 2) == FAIL) { return; } + dict_T *dict = argvars[2].vval.v_dict; dictitem_T *const di = tv_dict_find(dict, S_LEN("repeat")); if (di != NULL) { repeat = (int)tv_get_number(&di->di_tv); diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 357ef6414d..e4b809d98d 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -60,6 +60,8 @@ static const char e_invalid_value_for_blob_nr[] = N_("E1239: Invalid value for blob: %d"); static const char e_string_or_function_required_for_argument_nr[] = N_("E1256: String or function required for argument %d"); +static const char e_non_null_dict_required_for_argument_nr[] + = N_("E1297: Non-NULL Dictionary required for argument %d"); bool tv_in_free_unref_items = false; @@ -1232,8 +1234,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort) if (argvars[2].v_type != VAR_UNKNOWN) { // optional third argument: {dict} - if (argvars[2].v_type != VAR_DICT) { - emsg(_(e_dictreq)); + if (tv_check_for_dict_arg(argvars, 2) == FAIL) { goto theend; } info.item_compare_selfdict = argvars[2].vval.v_dict; @@ -2993,10 +2994,10 @@ void f_values(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) /// "has_key()" function void f_has_key(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) { - if (argvars[0].v_type != VAR_DICT) { - emsg(_(e_dictreq)); + if (tv_check_for_dict_arg(argvars, 0) == FAIL) { return; } + if (argvars[0].vval.v_dict == NULL) { return; } @@ -4051,6 +4052,20 @@ int tv_check_for_dict_arg(const typval_T *const args, const int idx) return OK; } +/// Give an error and return FAIL unless "args[idx]" is a non-NULL dict. +int tv_check_for_nonnull_dict_arg(const typval_T *const args, const int idx) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE +{ + if (tv_check_for_dict_arg(args, idx) == FAIL) { + return FAIL; + } + if (args[idx].vval.v_dict == NULL) { + semsg(_(e_non_null_dict_required_for_argument_nr), idx + 1); + return FAIL; + } + return OK; +} + /// Check for an optional dict argument at "idx" int tv_check_for_opt_dict_arg(const typval_T *const args, const int idx) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE diff --git a/src/nvim/eval/window.c b/src/nvim/eval/window.c index 25de236d90..9976c56879 100644 --- a/src/nvim/eval/window.c +++ b/src/nvim/eval/window.c @@ -651,8 +651,7 @@ void f_win_splitmove(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) dict_T *d; dictitem_T *di; - if (argvars[2].v_type != VAR_DICT || argvars[2].vval.v_dict == NULL) { - emsg(_(e_invarg)); + if (tv_check_for_nonnull_dict_arg(argvars, 2) == FAIL) { return; } @@ -796,51 +795,50 @@ void f_winrestcmd(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) /// "winrestview()" function void f_winrestview(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) { - dict_T *dict = argvars[0].vval.v_dict; + if (tv_check_for_nonnull_dict_arg(argvars, 0) == FAIL) { + return; + } - if (argvars[0].v_type != VAR_DICT || dict == NULL) { - emsg(_(e_invarg)); - } else { - dictitem_T *di; - if ((di = tv_dict_find(dict, S_LEN("lnum"))) != NULL) { - curwin->w_cursor.lnum = (linenr_T)tv_get_number(&di->di_tv); - } - if ((di = tv_dict_find(dict, S_LEN("col"))) != NULL) { - curwin->w_cursor.col = (colnr_T)tv_get_number(&di->di_tv); - } - if ((di = tv_dict_find(dict, S_LEN("coladd"))) != NULL) { - curwin->w_cursor.coladd = (colnr_T)tv_get_number(&di->di_tv); - } - if ((di = tv_dict_find(dict, S_LEN("curswant"))) != NULL) { - curwin->w_curswant = (colnr_T)tv_get_number(&di->di_tv); - curwin->w_set_curswant = false; - } - if ((di = tv_dict_find(dict, S_LEN("topline"))) != NULL) { - set_topline(curwin, (linenr_T)tv_get_number(&di->di_tv)); - } - if ((di = tv_dict_find(dict, S_LEN("topfill"))) != NULL) { - curwin->w_topfill = (int)tv_get_number(&di->di_tv); - } - if ((di = tv_dict_find(dict, S_LEN("leftcol"))) != NULL) { - curwin->w_leftcol = (colnr_T)tv_get_number(&di->di_tv); - } - if ((di = tv_dict_find(dict, S_LEN("skipcol"))) != NULL) { - curwin->w_skipcol = (colnr_T)tv_get_number(&di->di_tv); - } + dict_T *dict = argvars[0].vval.v_dict; + dictitem_T *di; + if ((di = tv_dict_find(dict, S_LEN("lnum"))) != NULL) { + curwin->w_cursor.lnum = (linenr_T)tv_get_number(&di->di_tv); + } + if ((di = tv_dict_find(dict, S_LEN("col"))) != NULL) { + curwin->w_cursor.col = (colnr_T)tv_get_number(&di->di_tv); + } + if ((di = tv_dict_find(dict, S_LEN("coladd"))) != NULL) { + curwin->w_cursor.coladd = (colnr_T)tv_get_number(&di->di_tv); + } + if ((di = tv_dict_find(dict, S_LEN("curswant"))) != NULL) { + curwin->w_curswant = (colnr_T)tv_get_number(&di->di_tv); + curwin->w_set_curswant = false; + } + if ((di = tv_dict_find(dict, S_LEN("topline"))) != NULL) { + set_topline(curwin, (linenr_T)tv_get_number(&di->di_tv)); + } + if ((di = tv_dict_find(dict, S_LEN("topfill"))) != NULL) { + curwin->w_topfill = (int)tv_get_number(&di->di_tv); + } + if ((di = tv_dict_find(dict, S_LEN("leftcol"))) != NULL) { + curwin->w_leftcol = (colnr_T)tv_get_number(&di->di_tv); + } + if ((di = tv_dict_find(dict, S_LEN("skipcol"))) != NULL) { + curwin->w_skipcol = (colnr_T)tv_get_number(&di->di_tv); + } - check_cursor(); - win_new_height(curwin, curwin->w_height); - win_new_width(curwin, curwin->w_width); - changed_window_setting(); + check_cursor(); + win_new_height(curwin, curwin->w_height); + win_new_width(curwin, curwin->w_width); + changed_window_setting(); - if (curwin->w_topline <= 0) { - curwin->w_topline = 1; - } - if (curwin->w_topline > curbuf->b_ml.ml_line_count) { - curwin->w_topline = curbuf->b_ml.ml_line_count; - } - check_topfill(curwin, true); + if (curwin->w_topline <= 0) { + curwin->w_topline = 1; + } + if (curwin->w_topline > curbuf->b_ml.ml_line_count) { + curwin->w_topline = curbuf->b_ml.ml_line_count; } + check_topfill(curwin, true); } /// "winsaveview()" function diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index c1565a84f5..f88c0deb87 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -2204,8 +2204,7 @@ void f_mapset(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) const int mode = get_map_mode((char **)&which, 0); const bool is_abbr = tv_get_number(&argvars[1]) != 0; - if (argvars[2].v_type != VAR_DICT) { - emsg(_(e_dictreq)); + if (tv_check_for_dict_arg(argvars, 2) == FAIL) { return; } dict_T *d = argvars[2].vval.v_dict; diff --git a/src/nvim/search.c b/src/nvim/search.c index 694c4cad52..50e72eee86 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -2772,8 +2772,7 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) dictitem_T *di; bool error = false; - if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL) { - emsg(_(e_dictreq)); + if (tv_check_for_nonnull_dict_arg(argvars, 0) == FAIL) { return; } dict = argvars[0].vval.v_dict; @@ -3348,8 +3347,7 @@ static void do_fuzzymatch(const typval_T *const argvars, typval_T *const rettv, bool matchseq = false; long max_matches = 0; if (argvars[2].v_type != VAR_UNKNOWN) { - if (argvars[2].v_type != VAR_DICT || argvars[2].vval.v_dict == NULL) { - emsg(_(e_dictreq)); + if (tv_check_for_nonnull_dict_arg(argvars, 2) == FAIL) { return; } diff --git a/src/nvim/sign.c b/src/nvim/sign.c index 50a55ddd5c..0e49a1e441 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -2017,8 +2017,7 @@ void f_sign_define(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) return; } - if (argvars[1].v_type != VAR_UNKNOWN && argvars[1].v_type != VAR_DICT) { - emsg(_(e_dictreq)); + if (tv_check_for_opt_dict_arg(argvars, 1) == FAIL) { return; } @@ -2061,12 +2060,10 @@ void f_sign_getplaced(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } if (argvars[1].v_type != VAR_UNKNOWN) { - dict_T *dict; - if (argvars[1].v_type != VAR_DICT - || ((dict = argvars[1].vval.v_dict) == NULL)) { - emsg(_(e_dictreq)); + if (tv_check_for_nonnull_dict_arg(argvars, 1) == FAIL) { return; } + dict_T *dict = argvars[1].vval.v_dict; if ((di = tv_dict_find(dict, "lnum", -1)) != NULL) { // get signs placed at this line lnum = (linenr_T)tv_get_number_chk(&di->di_tv, ¬anum); @@ -2263,11 +2260,11 @@ void f_sign_place(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) rettv->vval.v_number = -1; - if (argvars[4].v_type != VAR_UNKNOWN - && (argvars[4].v_type != VAR_DICT - || ((dict = argvars[4].vval.v_dict) == NULL))) { - emsg(_(e_dictreq)); - return; + if (argvars[4].v_type != VAR_UNKNOWN) { + if (tv_check_for_nonnull_dict_arg(argvars, 4) == FAIL) { + return; + } + dict = argvars[4].vval.v_dict; } rettv->vval.v_number = sign_place_from_dict(&argvars[0], &argvars[1], &argvars[2], &argvars[3], @@ -2415,8 +2412,7 @@ void f_sign_unplace(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } if (argvars[1].v_type != VAR_UNKNOWN) { - if (argvars[1].v_type != VAR_DICT) { - emsg(_(e_dictreq)); + if (tv_check_for_dict_arg(argvars, 1) == FAIL) { return; } dict = argvars[1].vval.v_dict; diff --git a/test/old/testdir/test_charsearch.vim b/test/old/testdir/test_charsearch.vim index f8f3e958ca..8d6b405743 100644 --- a/test/old/testdir/test_charsearch.vim +++ b/test/old/testdir/test_charsearch.vim @@ -39,7 +39,7 @@ func Test_charsearch() call setcharsearch({'char' : ''}) call assert_equal('', getcharsearch().char) - call assert_fails("call setcharsearch([])", 'E715:') + call assert_fails("call setcharsearch([])", 'E1206:') enew! endfunc diff --git a/test/old/testdir/test_expr.vim b/test/old/testdir/test_expr.vim index dee7266bb5..ff3dfb83cb 100644 --- a/test/old/testdir/test_expr.vim +++ b/test/old/testdir/test_expr.vim @@ -105,7 +105,7 @@ func Test_dict() END call CheckLegacyAndVim9Success(lines) - call CheckLegacyAndVim9Failure(["VAR i = has_key([], 'a')"], ['E715:', 'E1013:', 'E1206:']) + call CheckLegacyAndVim9Failure(["VAR i = has_key([], 'a')"], ['E1206:', 'E1013:', 'E1206:']) endfunc func Test_strgetchar() diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 7d3d74caad..78eab3aaa5 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2007,7 +2007,7 @@ func Test_call() endfunction let mydict = {'data': [0, 1, 2, 3], 'len': function("Mylen")} eval mydict.len->call([], mydict)->assert_equal(4) - call assert_fails("call call('Mylen', [], 0)", 'E715:') + call assert_fails("call call('Mylen', [], 0)", 'E1206:') call assert_fails('call foo', 'E107:') " These once caused a crash. diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index cbed71bb0a..0ff3582da9 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -699,7 +699,7 @@ func Test_reverse_sort_uniq() call assert_fails('call reverse("")', 'E899:') call assert_fails('call uniq([1, 2], {x, y -> []})', 'E745:') - call assert_fails("call sort([1, 2], function('min'), 1)", "E715:") + call assert_fails("call sort([1, 2], function('min'), 1)", "E1206:") call assert_fails("call sort([1, 2], function('invalid_func'))", "E700:") call assert_fails("call sort([1, 2], function('min'))", "E118:") endfunc diff --git a/test/old/testdir/test_maparg.vim b/test/old/testdir/test_maparg.vim index 19130c1569..12670671dd 100644 --- a/test/old/testdir/test_maparg.vim +++ b/test/old/testdir/test_maparg.vim @@ -270,7 +270,7 @@ func Test_mapset() bwipe! call assert_fails('call mapset([], v:false, {})', 'E730:') - call assert_fails('call mapset("i", 0, "")', 'E715:') + call assert_fails('call mapset("i", 0, "")', 'E1206:') call assert_fails('call mapset("i", 0, {})', 'E460:') endfunc diff --git a/test/old/testdir/test_matchfuzzy.vim b/test/old/testdir/test_matchfuzzy.vim index b46550fbc3..be5c629cf5 100644 --- a/test/old/testdir/test_matchfuzzy.vim +++ b/test/old/testdir/test_matchfuzzy.vim @@ -67,7 +67,7 @@ func Test_matchfuzzy() call assert_equal([{'id' : 6, 'val' : 'camera'}], matchfuzzy(l, 'cam', {'key' : 'val'})) call assert_equal([], matchfuzzy(l, 'day', {'text_cb' : {v -> v.val}})) call assert_equal([], matchfuzzy(l, 'day', {'key' : 'val'})) - call assert_fails("let x = matchfuzzy(l, 'cam', 'random')", 'E715:') + call assert_fails("let x = matchfuzzy(l, 'cam', 'random')", 'E1206:') call assert_equal([], matchfuzzy(l, 'day', {'text_cb' : {v -> []}})) call assert_equal([], matchfuzzy(l, 'day', {'text_cb' : {v -> 1}})) call assert_fails("let x = matchfuzzy(l, 'day', {'text_cb' : {a, b -> 1}})", 'E119:') @@ -76,7 +76,7 @@ func Test_matchfuzzy() " call assert_fails("let x = matchfuzzy(l, 'cam', {'text_cb' : []})", 'E921:') call assert_fails("let x = matchfuzzy(l, 'cam', {'text_cb' : []})", 'E6000:') call assert_fails("let x = matchfuzzy(l, 'foo', {'key' : []})", 'E730:') - call assert_fails("let x = matchfuzzy(l, 'cam', v:_null_dict)", 'E715:') + call assert_fails("let x = matchfuzzy(l, 'cam', v:_null_dict)", 'E1297:') call assert_fails("let x = matchfuzzy(l, 'foo', {'key' : v:_null_string})", 'E475:') " Nvim doesn't have null functions " call assert_fails("let x = matchfuzzy(l, 'foo', {'text_cb' : test_null_function()})", 'E475:') @@ -144,7 +144,7 @@ func Test_matchfuzzypos() \ matchfuzzypos(l, 'cam', {'key' : 'val'})) call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'text_cb' : {v -> v.val}})) call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'key' : 'val'})) - call assert_fails("let x = matchfuzzypos(l, 'cam', 'random')", 'E715:') + call assert_fails("let x = matchfuzzypos(l, 'cam', 'random')", 'E1206:') call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'text_cb' : {v -> []}})) call assert_equal([[], [], []], matchfuzzypos(l, 'day', {'text_cb' : {v -> 1}})) call assert_fails("let x = matchfuzzypos(l, 'day', {'text_cb' : {a, b -> 1}})", 'E119:') @@ -153,7 +153,7 @@ func Test_matchfuzzypos() " call assert_fails("let x = matchfuzzypos(l, 'cam', {'text_cb' : []})", 'E921:') call assert_fails("let x = matchfuzzypos(l, 'cam', {'text_cb' : []})", 'E6000:') call assert_fails("let x = matchfuzzypos(l, 'foo', {'key' : []})", 'E730:') - call assert_fails("let x = matchfuzzypos(l, 'cam', v:_null_dict)", 'E715:') + call assert_fails("let x = matchfuzzypos(l, 'cam', v:_null_dict)", 'E1297:') call assert_fails("let x = matchfuzzypos(l, 'foo', {'key' : v:_null_string})", 'E475:') " Nvim doesn't have null functions " call assert_fails("let x = matchfuzzypos(l, 'foo', {'text_cb' : test_null_function()})", 'E475:') diff --git a/test/old/testdir/test_partial.vim b/test/old/testdir/test_partial.vim index 302bc22d93..8b62e4a0e5 100644 --- a/test/old/testdir/test_partial.vim +++ b/test/old/testdir/test_partial.vim @@ -86,7 +86,7 @@ func Test_partial_dict() call assert_equal("Hello", dict.tr()) call assert_fails("let F=function('setloclist', 10)", "E923:") - call assert_fails("let F=function('setloclist', [], [])", "E922:") + call assert_fails("let F=function('setloclist', [], [])", "E1206:") endfunc func Test_partial_implicit() diff --git a/test/old/testdir/test_search_stat.vim b/test/old/testdir/test_search_stat.vim index 1b2d854829..8dfc850956 100644 --- a/test/old/testdir/test_search_stat.vim +++ b/test/old/testdir/test_search_stat.vim @@ -259,7 +259,7 @@ func Test_search_stat() endfunc func Test_searchcount_fails() - call assert_fails('echo searchcount("boo!")', 'E715:') + call assert_fails('echo searchcount("boo!")', 'E1206:') call assert_fails('echo searchcount({"timeout" : []})', 'E745:') call assert_fails('echo searchcount({"maxcount" : []})', 'E745:') call assert_fails('echo searchcount({"pattern" : []})', 'E730:') diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index 129f1c1a0c..9ecbde0f30 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -463,7 +463,7 @@ func Test_sign_funcs() call assert_fails('call sign_define("sign4", {"text" : "===>"})', 'E239:') " call assert_fails('call sign_define("sign5", {"text" : ""})', 'E239:') call assert_fails('call sign_define({})', 'E731:') - call assert_fails('call sign_define("sign6", [])', 'E715:') + call assert_fails('call sign_define("sign6", [])', 'E1206:') " Tests for sign_getdefined() call assert_equal([], sign_getdefined("none")) @@ -490,8 +490,7 @@ func Test_sign_funcs() " Tests for invalid arguments to sign_place() call assert_fails('call sign_place([], "", "mySign", 1)', 'E745:') call assert_fails('call sign_place(5, "", "mySign", -1)', 'E158:') - call assert_fails('call sign_place(-1, "", "sign1", "Xsign", [])', - \ 'E715:') + call assert_fails('call sign_place(-1, "", "sign1", "Xsign", [])', 'E1206:') call assert_fails('call sign_place(-1, "", "sign1", "Xsign", \ {"lnum" : 30})', 'E474:') call assert_fails('call sign_place(10, "", "xsign1x", "Xsign", @@ -526,7 +525,7 @@ func Test_sign_funcs() call assert_fails("call sign_getplaced('dummy.sign')", 'E158:') call assert_fails('call sign_getplaced("&")', 'E158:') call assert_fails('call sign_getplaced(-1)', 'E158:') - call assert_fails('call sign_getplaced("Xsign", [])', 'E715:') + call assert_fails('call sign_getplaced("Xsign", [])', 'E1206:') call assert_equal([{'bufnr' : bufnr(''), 'signs' : []}], \ sign_getplaced('Xsign', {'lnum' : 1000000})) call assert_fails("call sign_getplaced('Xsign', {'lnum' : []})", @@ -549,7 +548,7 @@ func Test_sign_funcs() \ {'id' : 20, 'buffer' : '&'})", 'E158:') call assert_fails("call sign_unplace('g1', \ {'id' : 20, 'buffer' : 200})", 'E158:') - call assert_fails("call sign_unplace('g1', 'mySign')", 'E715:') + call assert_fails("call sign_unplace('g1', 'mySign')", 'E1206:') call sign_unplace('*') @@ -1568,8 +1567,7 @@ func Test_sign_priority() \ s[0].signs) " Error case - call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign', - \ [])", 'E715:') + call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign', [])", 'E1206:') call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign', \ {'priority' : []})", 'E745:') call sign_unplace('*') diff --git a/test/old/testdir/test_tagjump.vim b/test/old/testdir/test_tagjump.vim index be60a3535c..3c646048f5 100644 --- a/test/old/testdir/test_tagjump.vim +++ b/test/old/testdir/test_tagjump.vim @@ -405,10 +405,10 @@ func Test_getsettagstack() " Error cases call assert_equal({}, gettagstack(100)) call assert_equal(-1, settagstack(100, {'items' : []})) - call assert_fails('call settagstack(1, [1, 10])', 'E715') - call assert_fails("call settagstack(1, {'items' : 10})", 'E714') - call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928') - call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962') + call assert_fails('call settagstack(1, [1, 10])', 'E1206:') + call assert_fails("call settagstack(1, {'items' : 10})", 'E714:') + call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928:') + call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962:') call assert_equal(-1, settagstack(0, v:_null_dict)) set tags=Xtags diff --git a/test/old/testdir/test_timers.vim b/test/old/testdir/test_timers.vim index f94ee6c9f3..aa766fff40 100644 --- a/test/old/testdir/test_timers.vim +++ b/test/old/testdir/test_timers.vim @@ -228,7 +228,7 @@ func Test_timer_errors() sleep 50m call assert_equal(3, g:call_count) - call assert_fails('call timer_start(100, "MyHandler", "abc")', 'E475:') + call assert_fails('call timer_start(100, "MyHandler", "abc")', 'E1206:') call assert_fails('call timer_start(100, [])', 'E921:') call assert_fails('call timer_stop("abc")', 'E39:') endfunc diff --git a/test/old/testdir/test_window_cmd.vim b/test/old/testdir/test_window_cmd.vim index 88135199fe..9320d67498 100644 --- a/test/old/testdir/test_window_cmd.vim +++ b/test/old/testdir/test_window_cmd.vim @@ -735,7 +735,7 @@ func Test_relative_cursor_position_in_one_line_window() only! bwipe! - call assert_fails('call winrestview(v:_null_dict)', 'E474:') + call assert_fails('call winrestview(v:_null_dict)', 'E1297:') endfunc func Test_relative_cursor_position_after_move_and_resize() @@ -936,7 +936,7 @@ func Test_winrestview() call assert_equal(view, winsaveview()) bwipe! - call assert_fails('call winrestview(v:_null_dict)', 'E474:') + call assert_fails('call winrestview(v:_null_dict)', 'E1297:') endfunc func Test_win_splitmove() @@ -967,7 +967,7 @@ func Test_win_splitmove() call assert_equal(bufname(winbufnr(2)), 'b') call assert_equal(bufname(winbufnr(3)), 'a') call assert_equal(bufname(winbufnr(4)), 'd') - call assert_fails('call win_splitmove(winnr(), winnr("k"), v:_null_dict)', 'E474:') + call assert_fails('call win_splitmove(winnr(), winnr("k"), v:_null_dict)', 'E1297:') only | bd call assert_fails('call win_splitmove(winnr(), 123)', 'E957:') |