Problem: Error message with :unlet! and non-existing dictionary item
(Coacher)
Solution: Set GLV_QUIET when using unlet with bang attribute
fixes: #18516
closes: #18734
Signed-off-by: Christian Brabandt <cb@256bit.org>
void
ex_unlet(exarg_T *eap)
{
- ex_unletlock(eap, eap->arg, 0, 0, do_unlet_var, NULL);
+ ex_unletlock(eap, eap->arg, 0, eap->forceit ? GLV_QUIET : 0, do_unlet_var, NULL);
}
/*
call assert_true(!exists('$FOOBAR') || empty($FOOBAR))
endfunc
+func Test_unlet_nonexisting_key()
+ let g:base = {}
+ call assert_fails(':unlet g:base["foobar"]', 'E716:')
+
+ try
+ unlet! g:base["foobar"]
+ catch
+ call assert_report("error when unletting non-existing dict key")
+ endtry
+ unlet g:base
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1913,
/**/
1912,
/**/