comparison src/message.c @ 11006:b3601a8eb679 v8.0.0392

patch 8.0.0392: GUI test fails with Athena and Motif commit https://github.com/vim/vim/commit/e0c31f6a304496b597a51ce98af419ec815bec74 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 1 15:07:05 2017 +0100 patch 8.0.0392: GUI test fails with Athena and Motif Problem: GUI test fails with Athena and Motif. Solution: Add test_ignore_error(). Use it to ignore the "failed to create input context" error.
author Christian Brabandt <cb@256bit.org>
date Wed, 01 Mar 2017 15:15:05 +0100
parents b0c9c1a05054
children ae2de10e8398
comparison
equal deleted inserted replaced
11005:5bc16b2b8c46 11006:b3601a8eb679
537 ) 537 )
538 return TRUE; 538 return TRUE;
539 return FALSE; 539 return FALSE;
540 } 540 }
541 541
542 #ifdef FEAT_EVAL
543 static garray_T ignore_error_list = GA_EMPTY;
544
545 void
546 ignore_error_for_testing(char_u *error)
547 {
548 if (ignore_error_list.ga_itemsize == 0)
549 ga_init2(&ignore_error_list, sizeof(char_u *), 1);
550
551 ga_add_string(&ignore_error_list, error);
552 }
553
554 static int
555 ignore_error(char_u *msg)
556 {
557 int i;
558
559 for (i = 0; i < ignore_error_list.ga_len; ++i)
560 if (strstr((char *)msg,
561 (char *)((char_u **)(ignore_error_list.ga_data))[i]) != NULL)
562 return TRUE;
563 return FALSE;
564 }
565 #endif
566
542 #if !defined(HAVE_STRERROR) || defined(PROTO) 567 #if !defined(HAVE_STRERROR) || defined(PROTO)
543 /* 568 /*
544 * Replacement for perror() that behaves more or less like emsg() was called. 569 * Replacement for perror() that behaves more or less like emsg() was called.
545 * v:errmsg will be set and called_emsg will be set. 570 * v:errmsg will be set and called_emsg will be set.
546 */ 571 */
574 #endif 599 #endif
575 600
576 /* Skip this if not giving error messages at the moment. */ 601 /* Skip this if not giving error messages at the moment. */
577 if (emsg_not_now()) 602 if (emsg_not_now())
578 return TRUE; 603 return TRUE;
604
605 #ifdef FEAT_EVAL
606 /* When testing some errors are turned into a normal message. */
607 if (ignore_error(s))
608 return msg(s);
609 #endif
579 610
580 called_emsg = TRUE; 611 called_emsg = TRUE;
581 612
582 /* 613 /*
583 * If "emsg_severe" is TRUE: When an error exception is to be thrown, 614 * If "emsg_severe" is TRUE: When an error exception is to be thrown,