Mercurial > vim
comparison src/eval.c @ 13272:abaebba89fd4 v8.0.1510
patch 8.0.1510: cannot test if a command causes a beep
commit https://github.com/vim/vim/commit/b48e96f61c87a64e38e3ac50732c92a84a4833b8
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 13 12:26:14 2018 +0100
patch 8.0.1510: cannot test if a command causes a beep
Problem: Cannot test if a command causes a beep.
Solution: Add assert_beeps().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 13 Feb 2018 12:30:07 +0100 |
parents | 69278c25429d |
children | f4b4162264b1 |
comparison
equal
deleted
inserted
replaced
13271:c716b01fb96d | 13272:abaebba89fd4 |
---|---|
8940 ga_clear(&ga); | 8940 ga_clear(&ga); |
8941 } | 8941 } |
8942 } | 8942 } |
8943 | 8943 |
8944 void | 8944 void |
8945 assert_beeps(typval_T *argvars) | |
8946 { | |
8947 char_u *cmd = get_tv_string_chk(&argvars[0]); | |
8948 garray_T ga; | |
8949 | |
8950 called_vim_beep = FALSE; | |
8951 suppress_errthrow = TRUE; | |
8952 emsg_silent = FALSE; | |
8953 do_cmdline_cmd(cmd); | |
8954 if (!called_vim_beep) | |
8955 { | |
8956 prepare_assert_error(&ga); | |
8957 ga_concat(&ga, (char_u *)"command did not beep: "); | |
8958 ga_concat(&ga, cmd); | |
8959 assert_error(&ga); | |
8960 ga_clear(&ga); | |
8961 } | |
8962 | |
8963 suppress_errthrow = FALSE; | |
8964 emsg_on_display = FALSE; | |
8965 } | |
8966 | |
8967 void | |
8945 assert_fails(typval_T *argvars) | 8968 assert_fails(typval_T *argvars) |
8946 { | 8969 { |
8947 char_u *cmd = get_tv_string_chk(&argvars[0]); | 8970 char_u *cmd = get_tv_string_chk(&argvars[0]); |
8948 garray_T ga; | 8971 garray_T ga; |
8949 | 8972 |