summaryrefslogtreecommitdiff
path: root/src/autocmd.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-06-01 12:31:53 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-01 12:31:53 +0100
commit00e977cb83625f979d13639249a7788d5a1cb71e (patch)
tree06b436df6e4354a4300419f8460696f4bf8e506f /src/autocmd.c
parentb5912e0643dc21b1b88c517d3ac1282eba57293d (diff)
downloadvim-git-00e977cb83625f979d13639249a7788d5a1cb71e.tar.gz
patch 8.2.5049: insufficient tests for autocommandsv8.2.5049
Problem: Insufficient tests for autocommands. Solution: Add a few more tests. (Yegappan Lakshmanan, closes #10507)
Diffstat (limited to 'src/autocmd.c')
-rw-r--r--src/autocmd.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/src/autocmd.c b/src/autocmd.c
index 143891c9b..2050da664 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -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;
}
}