Merge pull request #20814 from zeertzjq/vim-8.2.0610

vim-patch:8.2.{0610,0619,1852}
This commit is contained in:
zeertzjq 2022-10-26 21:34:18 +08:00 committed by GitHub
commit c00e711d5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 216 additions and 29 deletions

View File

@ -1449,6 +1449,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
key[len] = prevval; key[len] = prevval;
} }
if (wrong) { if (wrong) {
tv_clear(&var1);
return NULL; return NULL;
} }
} }
@ -4785,20 +4786,20 @@ void filter_map(typval_T *argvars, typval_T *rettv, int map)
int save_did_emsg; int save_did_emsg;
int idx = 0; int idx = 0;
// Always return the first argument, also on failure.
tv_copy(&argvars[0], rettv);
if (argvars[0].v_type == VAR_BLOB) { if (argvars[0].v_type == VAR_BLOB) {
tv_copy(&argvars[0], rettv);
if ((b = argvars[0].vval.v_blob) == NULL) { if ((b = argvars[0].vval.v_blob) == NULL) {
return; return;
} }
} else if (argvars[0].v_type == VAR_LIST) { } else if (argvars[0].v_type == VAR_LIST) {
tv_copy(&argvars[0], rettv);
if ((l = argvars[0].vval.v_list) == NULL if ((l = argvars[0].vval.v_list) == NULL
|| (!map || (!map
&& var_check_lock(tv_list_locked(l), arg_errmsg, TV_TRANSLATE))) { && var_check_lock(tv_list_locked(l), arg_errmsg, TV_TRANSLATE))) {
return; return;
} }
} else if (argvars[0].v_type == VAR_DICT) { } else if (argvars[0].v_type == VAR_DICT) {
tv_copy(&argvars[0], rettv);
if ((d = argvars[0].vval.v_dict) == NULL if ((d = argvars[0].vval.v_dict) == NULL
|| (!map && var_check_lock(d->dv_lock, arg_errmsg, TV_TRANSLATE))) { || (!map && var_check_lock(d->dv_lock, arg_errmsg, TV_TRANSLATE))) {
return; return;

View File

@ -1094,7 +1094,9 @@ static int item_compare2(const void *s1, const void *s2, bool keep_zero)
tv_clear(&argv[1]); tv_clear(&argv[1]);
if (res == FAIL) { if (res == FAIL) {
// XXX: ITEM_COMPARE_FAIL is unused
res = ITEM_COMPARE_FAIL; res = ITEM_COMPARE_FAIL;
sortinfo->item_compare_func_err = true;
} else { } else {
res = (int)tv_get_number_chk(&rettv, &sortinfo->item_compare_func_err); res = (int)tv_get_number_chk(&rettv, &sortinfo->item_compare_func_err);
if (res > 0) { if (res > 0) {
@ -1257,7 +1259,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
} else { } else {
li = TV_LIST_ITEM_NEXT(l, li); li = TV_LIST_ITEM_NEXT(l, li);
} }
if (info.item_compare_func_err) { // -V547 if (info.item_compare_func_err) {
emsg(_("E882: Uniq compare function failed")); emsg(_("E882: Uniq compare function failed"));
break; break;
} }
@ -2488,10 +2490,14 @@ bool tv_dict_equal(dict_T *const d1, dict_T *const d2, const bool ic, const bool
if (d1 == d2) { if (d1 == d2) {
return true; return true;
} }
if (d1 == NULL || d2 == NULL) { if (tv_dict_len(d1) != tv_dict_len(d2)) {
return false; return false;
} }
if (tv_dict_len(d1) != tv_dict_len(d2)) { if (tv_dict_len(d1) == 0) {
// empty and NULL dicts are considered equal
return true;
}
if (d1 == NULL || d2 == NULL) {
return false; return false;
} }

View File

@ -1335,10 +1335,10 @@ void free_all_functions(void)
/// @param[in] len length of "name", or -1 for NUL terminated. /// @param[in] len length of "name", or -1 for NUL terminated.
/// ///
/// @return true if "name" looks like a builtin function name: starts with a /// @return true if "name" looks like a builtin function name: starts with a
/// lower case letter and doesn't contain AUTOLOAD_CHAR. /// lower case letter and doesn't contain AUTOLOAD_CHAR or ':'.
static bool builtin_function(const char *name, int len) static bool builtin_function(const char *name, int len)
{ {
if (!ASCII_ISLOWER(name[0])) { if (!ASCII_ISLOWER(name[0]) || name[1] == ':') {
return false; return false;
} }

View File

@ -209,6 +209,7 @@ func Test_blob_add()
call assert_equal(0z001122, b) call assert_equal(0z001122, b)
call add(b, '51') call add(b, '51')
call assert_equal(0z00112233, b) call assert_equal(0z00112233, b)
call assert_equal(1, add(v:_null_blob, 0x22))
call assert_fails('call add(b, [9])', 'E745:') call assert_fails('call add(b, [9])', 'E745:')
call assert_fails('call add("", 0x01)', 'E897:') call assert_fails('call add("", 0x01)', 'E897:')
@ -273,6 +274,7 @@ endfunc
" filter() item in blob " filter() item in blob
func Test_blob_filter() func Test_blob_filter()
call assert_equal(v:_null_blob, filter(v:_null_blob, '0'))
call assert_equal(0z, filter(0zDEADBEEF, '0')) call assert_equal(0z, filter(0zDEADBEEF, '0'))
call assert_equal(0zADBEEF, filter(0zDEADBEEF, 'v:val != 0xDE')) call assert_equal(0zADBEEF, filter(0zDEADBEEF, 'v:val != 0xDE'))
call assert_equal(0zDEADEF, filter(0zDEADBEEF, 'v:val != 0xBE')) call assert_equal(0zDEADEF, filter(0zDEADBEEF, 'v:val != 0xBE'))
@ -314,6 +316,9 @@ func Test_blob_insert()
call assert_fails('call insert(b, -1)', 'E475:') call assert_fails('call insert(b, -1)', 'E475:')
call assert_fails('call insert(b, 257)', 'E475:') call assert_fails('call insert(b, 257)', 'E475:')
call assert_fails('call insert(b, 0, [9])', 'E745:') call assert_fails('call insert(b, 0, [9])', 'E745:')
call assert_fails('call insert(b, 0, -20)', 'E475:')
call assert_fails('call insert(b, 0, 20)', 'E475:')
call assert_fails('call insert(b, [])', 'E745:')
call assert_equal(0, insert(v:_null_blob, 0x33)) call assert_equal(0, insert(v:_null_blob, 0x33))
" Translated from v8.2.3284 " Translated from v8.2.3284

View File

@ -46,6 +46,7 @@ func Test_dict()
call assert_equal('zero', d[0]) call assert_equal('zero', d[0])
call assert_true(has_key(d, '')) call assert_true(has_key(d, ''))
call assert_true(has_key(d, 'a')) call assert_true(has_key(d, 'a'))
call assert_fails("let i = has_key([], 'a')", 'E715:')
let d[''] = 'none' let d[''] = 'none'
let d['a'] = 'aaa' let d['a'] = 'aaa'
@ -98,13 +99,6 @@ func Test_loop_over_null_list()
endfor endfor
endfunc endfunc
func Test_compare_null_dict()
call assert_fails('let x = v:_null_dict[10]')
call assert_equal({}, {})
call assert_equal(v:_null_dict, v:_null_dict)
call assert_notequal({}, v:_null_dict)
endfunc
func Test_set_reg_null_list() func Test_set_reg_null_list()
call setreg('x', v:_null_list) call setreg('x', v:_null_list)
endfunc endfunc

View File

@ -86,6 +86,13 @@ func Test_map_filter_fails()
call assert_fails('call filter([1], "42 +")', 'E15:') call assert_fails('call filter([1], "42 +")', 'E15:')
call assert_fails("let l = map('abc', '\"> \" . v:val')", 'E896:') call assert_fails("let l = map('abc', '\"> \" . v:val')", 'E896:')
call assert_fails("let l = filter('abc', '\"> \" . v:val')", 'E896:') call assert_fails("let l = filter('abc', '\"> \" . v:val')", 'E896:')
call assert_fails("let l = filter([1, 2, 3], '{}')", 'E728:')
call assert_fails("let l = filter({'k' : 10}, '{}')", 'E728:')
call assert_fails("let l = filter([1, 2], {})", 'E731:')
call assert_equal(v:_null_list, filter(v:_null_list, 0))
call assert_equal(v:_null_dict, filter(v:_null_dict, 0))
call assert_equal(v:_null_list, map(v:_null_list, '"> " .. v:val'))
call assert_equal(v:_null_dict, map(v:_null_dict, '"> " .. v:val'))
endfunc endfunc
func Test_map_and_modify() func Test_map_and_modify()

View File

@ -67,9 +67,11 @@ func Test_len()
call assert_equal(2, len('ab')) call assert_equal(2, len('ab'))
call assert_equal(0, len([])) call assert_equal(0, len([]))
call assert_equal(0, len(v:_null_list))
call assert_equal(2, len([2, 1])) call assert_equal(2, len([2, 1]))
call assert_equal(0, len({})) call assert_equal(0, len({}))
call assert_equal(0, len(v:_null_dict))
call assert_equal(2, len({'a': 1, 'b': 2})) call assert_equal(2, len({'a': 1, 'b': 2}))
" call assert_fails('call len(v:none)', 'E701:') " call assert_fails('call len(v:none)', 'E701:')
@ -771,6 +773,9 @@ func Test_append()
split split
only only
undo undo
" Using $ instead of '$' must give an error
call assert_fails("call append($, 'foobar')", 'E116:')
endfunc endfunc
func Test_getbufvar() func Test_getbufvar()
@ -2066,6 +2071,7 @@ func Test_range()
" list2str() " list2str()
call assert_equal('ABC', list2str(range(65, 67))) call assert_equal('ABC', list2str(range(65, 67)))
call assert_fails('let s = list2str(5)', 'E474:')
" lock() " lock()
let thelist = range(5) let thelist = range(5)

View File

@ -275,6 +275,7 @@ func Test_let_errors()
call assert_fails('let &buftype[1] = "nofile"', 'E18:') call assert_fails('let &buftype[1] = "nofile"', 'E18:')
let s = "var" let s = "var"
let var = 1 let var = 1
call assert_fails('let var += [1,2]', 'E734:')
call assert_fails('let {s}.1 = 2', 'E18:') call assert_fails('let {s}.1 = 2', 'E18:')
call assert_fails('let a[1] = 5', 'E121:') call assert_fails('let a[1] = 5', 'E121:')
let l = [[1,2]] let l = [[1,2]]
@ -287,6 +288,8 @@ func Test_let_errors()
call assert_fails('let l[0:1] = [1, 2, 3]', 'E710:') call assert_fails('let l[0:1] = [1, 2, 3]', 'E710:')
call assert_fails('let l[-2:-3] = [3, 4]', 'E684:') call assert_fails('let l[-2:-3] = [3, 4]', 'E684:')
call assert_fails('let l[0:4] = [5, 6]', 'E711:') call assert_fails('let l[0:4] = [5, 6]', 'E711:')
call assert_fails('let g:["a;b"] = 10', 'E461:')
call assert_fails('let g:.min = function("max")', 'E704:')
" This test works only when the language is English " This test works only when the language is English
if v:lang == "C" || v:lang =~ '^[Ee]n' if v:lang == "C" || v:lang =~ '^[Ee]n'

View File

@ -32,6 +32,11 @@ func Test_list_slice()
call assert_equal([1, 'as''d', [1, 2, function('strlen')], {'a': 1}], l[0:8]) call assert_equal([1, 'as''d', [1, 2, function('strlen')], {'a': 1}], l[0:8])
call assert_equal([], l[8:-1]) call assert_equal([], l[8:-1])
call assert_equal([], l[0:-10]) call assert_equal([], l[0:-10])
" perform an operation on a list slice
let l = [1, 2, 3]
let l[:1] += [1, 2]
let l[2:] -= [1]
call assert_equal([2, 4, 2], l)
endfunc endfunc
" List identity " List identity
@ -146,6 +151,20 @@ func Test_list_func_remove()
call assert_fails("call remove(l, l)", 'E745:') call assert_fails("call remove(l, l)", 'E745:')
endfunc endfunc
" List add() function
func Test_list_add()
let l = []
call add(l, 1)
call add(l, [2, 3])
call add(l, [])
call add(l, v:_null_list)
call add(l, {'k' : 3})
call add(l, {})
call add(l, v:_null_dict)
call assert_equal([1, [2, 3], [], [], {'k' : 3}, {}, {}], l)
" call assert_equal(1, add(v:_null_list, 4))
endfunc
" Tests for Dictionary type " Tests for Dictionary type
func Test_dict() func Test_dict()
@ -169,6 +188,19 @@ func Test_dict()
call filter(d, 'v:key =~ ''[ac391]''') call filter(d, 'v:key =~ ''[ac391]''')
call assert_equal({'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}, d) call assert_equal({'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}, d)
" duplicate key
call assert_fails("let d = {'k' : 10, 'k' : 20}", 'E721:')
" missing comma
call assert_fails("let d = {'k' : 10 'k' : 20}", 'E722:')
" missing curly brace
call assert_fails("let d = {'k' : 10,", 'E723:')
" invalid key
call assert_fails('let d = #{++ : 10}', 'E15:')
" wrong type for key
call assert_fails('let d={[] : 10}', 'E730:')
" undefined variable as value
call assert_fails("let d={'k' : i}", 'E121:')
" allow key starting with number at the start, not a curly expression " allow key starting with number at the start, not a curly expression
call assert_equal({'1foo': 77}, #{1foo: 77}) call assert_equal({'1foo': 77}, #{1foo: 77})
@ -269,7 +301,7 @@ func Test_script_local_dict_func()
unlet g:dict unlet g:dict
endfunc endfunc
" Test removing items in la dictionary " Test removing items in a dictionary
func Test_dict_func_remove() func Test_dict_func_remove()
let d = {1:'a', 2:'b', 3:'c'} let d = {1:'a', 2:'b', 3:'c'}
call assert_equal('b', remove(d, 2)) call assert_equal('b', remove(d, 2))
@ -643,6 +675,9 @@ func Test_reverse_sort_uniq()
call assert_fails('call reverse("")', 'E899:') call assert_fails('call reverse("")', 'E899:')
call assert_fails('call uniq([1, 2], {x, y -> []})', 'E882:') call assert_fails('call uniq([1, 2], {x, y -> []})', 'E882:')
call assert_fails("call sort([1, 2], function('min'), 1)", "E715:")
call assert_fails("call sort([1, 2], function('invalid_func'))", "E700:")
call assert_fails("call sort([1, 2], function('min'))", "E702:")
endfunc endfunc
" reduce a list or a blob " reduce a list or a blob
@ -690,7 +725,7 @@ func Test_reduce()
call assert_equal(42, reduce(v:_null_blob, function('add'), 42)) call assert_equal(42, reduce(v:_null_blob, function('add'), 42))
endfunc endfunc
" splitting a string to a List " splitting a string to a List using split()
func Test_str_split() func Test_str_split()
call assert_equal(['aa', 'bb'], split(' aa bb ')) call assert_equal(['aa', 'bb'], split(' aa bb '))
call assert_equal(['aa', 'bb'], split(' aa bb ', '\W\+', 0)) call assert_equal(['aa', 'bb'], split(' aa bb ', '\W\+', 0))
@ -942,6 +977,14 @@ func Test_listdict_index()
call assert_fails("let v = range(5)[2:[]]", 'E730:') call assert_fails("let v = range(5)[2:[]]", 'E730:')
call assert_fails("let v = range(5)[2:{-> 2}(]", 'E116:') call assert_fails("let v = range(5)[2:{-> 2}(]", 'E116:')
call assert_fails("let v = range(5)[2:3", 'E111:') call assert_fails("let v = range(5)[2:3", 'E111:')
call assert_fails("let l = insert([1,2,3], 4, 10)", 'E684:')
call assert_fails("let l = insert([1,2,3], 4, -10)", 'E684:')
call assert_fails("let l = insert([1,2,3], 4, [])", 'E745:')
let l = [1, 2, 3]
call assert_fails("let l[i] = 3", 'E121:')
call assert_fails("let l[1.1] = 4", 'E806:')
call assert_fails("let l[:i] = [4, 5]", 'E121:')
call assert_fails("let l[:3.2] = [4, 5]", 'E806:')
endfunc endfunc
" Test for a null list " Test for a null list
@ -981,4 +1024,20 @@ func Test_null_list()
unlockvar l unlockvar l
endfunc endfunc
" Test for a null dict
func Test_null_dict()
call assert_equal(v:_null_dict, v:_null_dict)
let d = v:_null_dict
call assert_equal({}, d)
call assert_equal(0, len(d))
call assert_equal(1, empty(d))
call assert_equal(0, items(d))
call assert_equal(0, keys(d))
call assert_equal(0, values(d))
call assert_false(has_key(d, 'k'))
call assert_equal('{}', string(d))
call assert_fails('let x = v:_null_dict[10]')
call assert_equal({}, {})
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@ -80,7 +80,7 @@ func Test_sort_default()
call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], '')) call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], ''))
call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], 0)) call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], 0))
call assert_equal(['2', 'A', 'a', 'AA', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], 1)) call assert_equal(['2', 'A', 'a', 'AA', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], 1))
call assert_fails('call sort([3.3, 1, "2"], 3)', "E474") call assert_fails('call sort([3.3, 1, "2"], 3)', "E474:")
endfunc endfunc
" Tests for the ":sort" command. " Tests for the ":sort" command.

View File

@ -171,6 +171,10 @@ func Test_syntax_list()
let a = execute('syntax list') let a = execute('syntax list')
call assert_equal("\nNo Syntax items defined for this buffer", a) call assert_equal("\nNo Syntax items defined for this buffer", a)
syntax keyword Type int containedin=g1 skipwhite skipempty skipnl nextgroup=Abc
let exp = "Type xxx containedin=g1 nextgroup=Abc skipnl skipwhite skipempty int"
call assert_equal(exp, split(execute("syntax list"), "\n")[1])
bd bd
endfunc endfunc

View File

@ -27,6 +27,7 @@ func Test_unlet_fails()
call assert_fails("unlet l['k'", 'E111:') call assert_fails("unlet l['k'", 'E111:')
let d = {'k' : 1} let d = {'k' : 1}
call assert_fails("unlet d.k2", 'E716:') call assert_fails("unlet d.k2", 'E716:')
call assert_fails("unlet {a};", 'E488:')
endfunc endfunc
func Test_unlet_env() func Test_unlet_env()

View File

@ -623,17 +623,17 @@ func Test_usercmd_custom()
return "a\nb\n" return "a\nb\n"
endfunc endfunc
command -nargs=* -complete=customlist,T1 TCmd1 command -nargs=* -complete=customlist,T1 TCmd1
call feedkeys(":T1 \<C-A>\<C-B>\"\<CR>", 'xt') call feedkeys(":TCmd1 \<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal('"T1 ', @:) call assert_equal('"TCmd1 ', @:)
delcommand TCmd1 delcommand TCmd1
delfunc T1 delfunc T1
func T2(a, c, p) func T2(a, c, p)
return ['a', 'b', 'c'] return {}
endfunc endfunc
command -nargs=* -complete=customlist,T2 TCmd2 command -nargs=* -complete=customlist,T2 TCmd2
call feedkeys(":T2 \<C-A>\<C-B>\"\<CR>", 'xt') call feedkeys(":TCmd2 \<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal('"T2 ', @:) call assert_equal('"TCmd2 ', @:)
delcommand TCmd2 delcommand TCmd2
delfunc T2 delfunc T2
endfunc endfunc

View File

@ -131,9 +131,13 @@ func Test_list2str_str2list_latin1()
let save_encoding = &encoding let save_encoding = &encoding
" set encoding=latin1 " set encoding=latin1
let lres = str2list(s, 1) let lres = str2list(s, 1)
let sres = list2str(l, 1) let sres = list2str(l, 1)
call assert_equal([65, 66, 67], str2list("ABC"))
" Try converting a list to a string in latin-1 encoding
call assert_equal([1, 2, 3], str2list(list2str([1, 2, 3])))
let &encoding = save_encoding let &encoding = save_encoding
call assert_equal(l, lres) call assert_equal(l, lres)

View File

@ -1658,6 +1658,20 @@ func Test_compound_assignment_operators()
call assert_fails('let x .= "f"', 'E734') call assert_fails('let x .= "f"', 'E734')
let x = !3.14 let x = !3.14
call assert_equal(0.0, x) call assert_equal(0.0, x)
" integer and float operations
let x = 1
let x *= 2.1
call assert_equal(2.1, x)
let x = 1
let x /= 0.25
call assert_equal(4.0, x)
let x = 1
call assert_fails('let x %= 0.25', 'E734:')
let x = 1
call assert_fails('let x .= 0.25', 'E734:')
let x = 1.0
call assert_fails('let x += [1.1]', 'E734:')
endif endif
" Test for environment variable " Test for environment variable
@ -1839,6 +1853,9 @@ func Test_missing_end()
" Missing 'in' in a :for statement " Missing 'in' in a :for statement
call assert_fails('for i range(1) | endfor', 'E690:') call assert_fails('for i range(1) | endfor', 'E690:')
" Incorrect number of variables in for
call assert_fails('for [i,] in range(3) | endfor', 'E475:')
endfunc endfunc
" Test for deep nesting of if/for/while/try statements {{{1 " Test for deep nesting of if/for/while/try statements {{{1
@ -1958,6 +1975,86 @@ func Test_float_conversion_errors()
endif endif
endfunc endfunc
func Test_invalid_function_names()
" function name not starting with capital
let caught_e128 = 0
try
func! g:test()
echo "test"
endfunc
catch /E128:/
let caught_e128 = 1
endtry
call assert_equal(1, caught_e128)
" function name includes a colon
let caught_e884 = 0
try
func! b:test()
echo "test"
endfunc
catch /E884:/
let caught_e884 = 1
endtry
call assert_equal(1, caught_e884)
" function name folowed by #
let caught_e128 = 0
try
func! test2() "#
echo "test2"
endfunc
catch /E128:/
let caught_e128 = 1
endtry
call assert_equal(1, caught_e128)
" function name starting with/without "g:", buffer-local funcref.
function! g:Foo(n)
return 'called Foo(' . a:n . ')'
endfunction
let b:my_func = function('Foo')
call assert_equal('called Foo(1)', b:my_func(1))
call assert_equal('called Foo(2)', g:Foo(2))
call assert_equal('called Foo(3)', Foo(3))
delfunc g:Foo
" script-local function used in Funcref must exist.
let lines =<< trim END
func s:Testje()
return "foo"
endfunc
let Bar = function('s:Testje')
call assert_equal(0, exists('s:Testje'))
call assert_equal(1, exists('*s:Testje'))
call assert_equal(1, exists('Bar'))
call assert_equal(1, exists('*Bar'))
END
call writefile(lines, 'Xscript')
source Xscript
call delete('Xscript')
endfunc
" substring and variable name
func Test_substring_var()
let str = 'abcdef'
let n = 3
call assert_equal('def', str[n:])
call assert_equal('abcd', str[:n])
call assert_equal('d', str[n:n])
unlet n
let nn = 3
call assert_equal('def', str[nn:])
call assert_equal('abcd', str[:nn])
call assert_equal('d', str[nn:nn])
unlet nn
let b:nn = 4
call assert_equal('ef', str[b:nn:])
call assert_equal('abcde', str[:b:nn])
call assert_equal('e', str[b:nn:b:nn])
unlet b:nn
endfunc
func Test_for_over_string() func Test_for_over_string()
let res = '' let res = ''
for c in 'aéc̀d' for c in 'aéc̀d'

View File

@ -639,7 +639,7 @@ describe('eval', function()
end) end)
it('function name includes a colon', function() it('function name includes a colon', function()
eq('Vim(function):E128: Function name must start with a capital or "s:": b:test()\\nendfunction', eq('Vim(function):E884: Function name cannot contain a colon: b:test()\\nendfunction',
exc_exec(dedent([[ exc_exec(dedent([[
function! b:test() function! b:test()
endfunction]]))) endfunction]])))

View File

@ -2253,8 +2253,8 @@ describe('typval.c', function()
local d1 = dict() local d1 = dict()
alloc_log:check({a.dict(d1)}) alloc_log:check({a.dict(d1)})
eq(1, d1.dv_refcount) eq(1, d1.dv_refcount)
eq(false, tv_dict_equal(nil, d1)) eq(true, tv_dict_equal(nil, d1))
eq(false, tv_dict_equal(d1, nil)) eq(true, tv_dict_equal(d1, nil))
eq(true, tv_dict_equal(d1, d1)) eq(true, tv_dict_equal(d1, d1))
eq(1, d1.dv_refcount) eq(1, d1.dv_refcount)
alloc_log:check({}) alloc_log:check({})
@ -2721,8 +2721,8 @@ describe('typval.c', function()
local d1 = lua2typvalt({}) local d1 = lua2typvalt({})
alloc_log:check({a.dict(d1.vval.v_dict)}) alloc_log:check({a.dict(d1.vval.v_dict)})
eq(1, d1.vval.v_dict.dv_refcount) eq(1, d1.vval.v_dict.dv_refcount)
eq(false, tv_equal(nd, d1)) eq(true, tv_equal(nd, d1))
eq(false, tv_equal(d1, nd)) eq(true, tv_equal(d1, nd))
eq(true, tv_equal(d1, d1)) eq(true, tv_equal(d1, d1))
eq(1, d1.vval.v_dict.dv_refcount) eq(1, d1.vval.v_dict.dv_refcount)
alloc_log:check({}) alloc_log:check({})