0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.5049: insufficient tests for autocommands

Problem:    Insufficient tests for autocommands.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes #10507)
This commit is contained in:
Yegappan Lakshmanan
2022-06-01 12:31:53 +01:00
committed by Bram Moolenaar
parent b5912e0643
commit 00e977cb83
5 changed files with 37 additions and 26 deletions

View File

@@ -3161,33 +3161,23 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv)
for (ac = ap->cmds; ac != NULL; ac = ac->next)
{
event_dict = dict_alloc();
if (event_dict == NULL)
if (event_dict == NULL
|| list_append_dict(event_list, event_dict) == FAIL)
return;
if (list_append_dict(event_list, event_dict) == FAIL)
return;
if (dict_add_string(event_dict, "event", event_name) == FAIL)
return;
if (dict_add_string(event_dict, "group", group_name == NULL
? (char_u *)"" : group_name) == FAIL)
return;
if (ap->buflocal_nr != 0)
if (dict_add_number(event_dict, "bufnr", ap->buflocal_nr)
== FAIL)
return;
if (dict_add_string(event_dict, "pattern", ap->pat) == FAIL)
return;
if (dict_add_string(event_dict, "cmd", ac->cmd) == FAIL)
return;
if (dict_add_bool(event_dict, "once", ac->once) == FAIL)
return;
if (dict_add_bool(event_dict, "nested", ac->nested) == FAIL)
if (dict_add_string(event_dict, "event", event_name) == FAIL
|| dict_add_string(event_dict, "group",
group_name == NULL ? (char_u *)""
: group_name) == FAIL
|| (ap->buflocal_nr != 0
&& (dict_add_number(event_dict, "bufnr",
ap->buflocal_nr) == FAIL))
|| dict_add_string(event_dict, "pattern",
ap->pat) == FAIL
|| dict_add_string(event_dict, "cmd", ac->cmd) == FAIL
|| dict_add_bool(event_dict, "once", ac->once) == FAIL
|| dict_add_bool(event_dict, "nested",
ac->nested) == FAIL)
return;
}
}