Mercurial > vim
diff src/autocmd.c @ 29054:e7bd4c788053 v8.2.5049
patch 8.2.5049: insufficient tests for autocommands
Commit: https://github.com/vim/vim/commit/00e977cb83625f979d13639249a7788d5a1cb71e
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Wed Jun 1 12:31:53 2022 +0100
patch 8.2.5049: insufficient tests for autocommands
Problem: Insufficient tests for autocommands.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/10507)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 01 Jun 2022 13:45:04 +0200 |
parents | e79bfdc53aee |
children | eee580a4c402 |
line wrap: on
line diff
--- a/src/autocmd.c +++ b/src/autocmd.c @@ -3161,33 +3161,23 @@ f_autocmd_get(typval_T *argvars, typval_ for (ac = ap->cmds; ac != NULL; ac = ac->next) { event_dict = dict_alloc(); - if (event_dict == NULL) - 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) + if (event_dict == NULL + || list_append_dict(event_list, event_dict) == 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; } }