comparison src/testing.c @ 24307:55f458d35292 v8.2.2694

patch 8.2.2694: when 'matchpairs' is empty every character beeps Commit: https://github.com/vim/vim/commit/5b8cabfef7c3707f3e53e13844d90e5a217e1e84 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 2 18:55:57 2021 +0200 patch 8.2.2694: when 'matchpairs' is empty every character beeps Problem: When 'matchpairs' is empty every character beeps. (Marco Hinz) Solution: Bail out when no character in 'matchpairs' was found. (closes #8053) Add assert_nobeep().
author Bram Moolenaar <Bram@vim.org>
date Fri, 02 Apr 2021 19:00:06 +0200
parents cdeec1389c8c
children a4fda40e0bb9
comparison
equal deleted inserted replaced
24306:4a6be7bbbe68 24307:55f458d35292
336 else 336 else
337 ga_concat(gap, cmd); 337 ga_concat(gap, cmd);
338 } 338 }
339 339
340 static int 340 static int
341 assert_beeps(typval_T *argvars) 341 assert_beeps(typval_T *argvars, int no_beep)
342 { 342 {
343 char_u *cmd = tv_get_string_chk(&argvars[0]); 343 char_u *cmd = tv_get_string_chk(&argvars[0]);
344 garray_T ga; 344 garray_T ga;
345 int ret = 0; 345 int ret = 0;
346 346
347 called_vim_beep = FALSE; 347 called_vim_beep = FALSE;
348 suppress_errthrow = TRUE; 348 suppress_errthrow = TRUE;
349 emsg_silent = FALSE; 349 emsg_silent = FALSE;
350 do_cmdline_cmd(cmd); 350 do_cmdline_cmd(cmd);
351 if (!called_vim_beep) 351 if (no_beep ? called_vim_beep : !called_vim_beep)
352 { 352 {
353 prepare_assert_error(&ga); 353 prepare_assert_error(&ga);
354 ga_concat(&ga, (char_u *)"command did not beep: "); 354 if (no_beep)
355 ga_concat(&ga, (char_u *)"command did beep: ");
356 else
357 ga_concat(&ga, (char_u *)"command did not beep: ");
355 ga_concat(&ga, cmd); 358 ga_concat(&ga, cmd);
356 assert_error(&ga); 359 assert_error(&ga);
357 ga_clear(&ga); 360 ga_clear(&ga);
358 ret = 1; 361 ret = 1;
359 } 362 }
367 * "assert_beeps(cmd [, error])" function 370 * "assert_beeps(cmd [, error])" function
368 */ 371 */
369 void 372 void
370 f_assert_beeps(typval_T *argvars, typval_T *rettv) 373 f_assert_beeps(typval_T *argvars, typval_T *rettv)
371 { 374 {
372 rettv->vval.v_number = assert_beeps(argvars); 375 rettv->vval.v_number = assert_beeps(argvars, FALSE);
376 }
377
378 /*
379 * "assert_nobeep(cmd [, error])" function
380 */
381 void
382 f_assert_nobeep(typval_T *argvars, typval_T *rettv)
383 {
384 rettv->vval.v_number = assert_beeps(argvars, TRUE);
373 } 385 }
374 386
375 /* 387 /*
376 * "assert_equal(expected, actual[, msg])" function 388 * "assert_equal(expected, actual[, msg])" function
377 */ 389 */