mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 23:48:32 +00:00
vim-patch:8.1.0793: incorrect error messages for functions that take a Blob
Problem: Incorrect error messages for functions that now take a Blob
argument.
Solution: Adjust the error messages. (Dominique Pelle, closes vim/vim#3846)
0d17f0d1c0
This commit is contained in:
@@ -96,6 +96,7 @@ PRAGMA_DIAG_POP
|
||||
|
||||
|
||||
static char *e_listarg = N_("E686: Argument of %s must be a List");
|
||||
static char *e_listblobarg = N_("E898: Argument of %s must be a List or Blob");
|
||||
static char *e_invalwindow = N_("E957: Invalid window number");
|
||||
|
||||
/// Dummy va_list for passing to vim_snprintf
|
||||
@@ -334,7 +335,7 @@ static void f_add(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
EMSG(_(e_listreq));
|
||||
EMSG(_(e_listblobreq));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2884,7 +2885,7 @@ static void f_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
EMSG2(_(e_listdictarg), "get()");
|
||||
EMSG2(_(e_listdictblobarg), "get()");
|
||||
}
|
||||
|
||||
if (tv == NULL) {
|
||||
@@ -4853,7 +4854,7 @@ static void f_index(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
return;
|
||||
} else if (argvars[0].v_type != VAR_LIST) {
|
||||
EMSG(_(e_listreq));
|
||||
EMSG(_(e_listblobreq));
|
||||
return;
|
||||
}
|
||||
list_T *const l = argvars[0].vval.v_list;
|
||||
@@ -5013,7 +5014,7 @@ static void f_insert(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
|
||||
tv_copy(&argvars[0], rettv);
|
||||
} else if (argvars[0].v_type != VAR_LIST) {
|
||||
EMSG2(_(e_listarg), "insert()");
|
||||
EMSG2(_(e_listblobarg), "insert()");
|
||||
} else if (!var_check_lock(tv_list_locked((l = argvars[0].vval.v_list)),
|
||||
N_("insert() argument"), TV_TRANSLATE)) {
|
||||
long before = 0;
|
||||
@@ -7349,7 +7350,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
}
|
||||
} else if (argvars[0].v_type != VAR_LIST) {
|
||||
EMSG2(_(e_listdictarg), "remove()");
|
||||
EMSG2(_(e_listdictblobarg), "remove()");
|
||||
} else if (!var_check_lock(tv_list_locked((l = argvars[0].vval.v_list)),
|
||||
arg_errmsg, TV_TRANSLATE)) {
|
||||
bool error = false;
|
||||
@@ -7634,7 +7635,7 @@ static void f_reverse(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
tv_blob_set_ret(rettv, b);
|
||||
} else if (argvars[0].v_type != VAR_LIST) {
|
||||
EMSG2(_(e_listarg), "reverse()");
|
||||
EMSG2(_(e_listblobarg), "reverse()");
|
||||
} else {
|
||||
list_T *const l = argvars[0].vval.v_list;
|
||||
if (!var_check_lock(tv_list_locked(l), N_("reverse() argument"),
|
||||
|
@@ -946,8 +946,11 @@ EXTERN char_u e_toomanyarg[] INIT(= N_(
|
||||
EXTERN char_u e_dictkey[] INIT(= N_(
|
||||
"E716: Key not present in Dictionary: \"%s\""));
|
||||
EXTERN char_u e_listreq[] INIT(= N_("E714: List required"));
|
||||
EXTERN char_u e_listblobreq[] INIT(= N_("E897: List or Blob required"));
|
||||
EXTERN char_u e_listdictarg[] INIT(= N_(
|
||||
"E712: Argument of %s must be a List or Dictionary"));
|
||||
EXTERN char_u e_listdictblobarg[] INIT(= N_(
|
||||
"E896: Argument of %s must be a List, Dictionary or Blob"));
|
||||
EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
|
||||
EXTERN char_u e_sandbox[] INIT(= N_("E48: Not allowed in sandbox"));
|
||||
EXTERN char_u e_secure[] INIT(= N_("E523: Not allowed here"));
|
||||
|
@@ -32,6 +32,7 @@ func Test_blob_create()
|
||||
call assert_fails('let b = 0z1.1')
|
||||
call assert_fails('let b = 0z.')
|
||||
call assert_fails('let b = 0z001122.')
|
||||
call assert_fails('call get("", 1)', 'E896:')
|
||||
endfunc
|
||||
|
||||
" assignment to a blob
|
||||
@@ -182,6 +183,7 @@ func Test_blob_add()
|
||||
call assert_equal(0z00112233, b)
|
||||
|
||||
call assert_fails('call add(b, [9])', 'E745:')
|
||||
call assert_fails('call add("", 0x01)', 'E897:')
|
||||
endfunc
|
||||
|
||||
func Test_blob_empty()
|
||||
@@ -219,7 +221,7 @@ func Test_blob_func_remove()
|
||||
call assert_fails("call remove(b, 5)", 'E979:')
|
||||
call assert_fails("call remove(b, 1, 5)", 'E979:')
|
||||
call assert_fails("call remove(b, 3, 2)", 'E979:')
|
||||
call assert_fails("call remove(1, 0)", 'E712:')
|
||||
call assert_fails("call remove(1, 0)", 'E896:')
|
||||
call assert_fails("call remove(b, b)", 'E974:')
|
||||
endfunc
|
||||
|
||||
@@ -255,7 +257,7 @@ func Test_blob_index()
|
||||
call assert_equal(2, index(0z11111111, 0x11, -2))
|
||||
call assert_equal(3, index(0z11110111, 0x11, -2))
|
||||
|
||||
call assert_fails('call index("asdf", 0)', 'E714:')
|
||||
call assert_fails('call index("asdf", 0)', 'E897:')
|
||||
endfunc
|
||||
|
||||
func Test_blob_insert()
|
||||
|
@@ -139,7 +139,7 @@ func Test_list_func_remove()
|
||||
call assert_fails("call remove(l, 5)", 'E684:')
|
||||
call assert_fails("call remove(l, 1, 5)", 'E684:')
|
||||
call assert_fails("call remove(l, 3, 2)", 'E16:')
|
||||
call assert_fails("call remove(1, 0)", 'E712:')
|
||||
call assert_fails("call remove(1, 0)", 'E896:')
|
||||
call assert_fails("call remove(l, l)", 'E745:')
|
||||
endfunc
|
||||
|
||||
@@ -616,6 +616,8 @@ func Test_reverse_sort_uniq()
|
||||
call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 1))
|
||||
call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i'))
|
||||
call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l)))
|
||||
|
||||
call assert_fails('call reverse("")', 'E898:')
|
||||
endfunc
|
||||
|
||||
" splitting a string to a List
|
||||
|
Reference in New Issue
Block a user