Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/message.c +++ b/src/message.c @@ -539,6 +539,31 @@ emsg_not_now(void) return FALSE; } +#ifdef FEAT_EVAL +static garray_T ignore_error_list = GA_EMPTY; + + void +ignore_error_for_testing(char_u *error) +{ + if (ignore_error_list.ga_itemsize == 0) + ga_init2(&ignore_error_list, sizeof(char_u *), 1); + + ga_add_string(&ignore_error_list, error); +} + + static int +ignore_error(char_u *msg) +{ + int i; + + for (i = 0; i < ignore_error_list.ga_len; ++i) + if (strstr((char *)msg, + (char *)((char_u **)(ignore_error_list.ga_data))[i]) != NULL) + return TRUE; + return FALSE; +} +#endif + #if !defined(HAVE_STRERROR) || defined(PROTO) /* * Replacement for perror() that behaves more or less like emsg() was called. @@ -577,6 +602,12 @@ emsg(char_u *s) if (emsg_not_now()) return TRUE; +#ifdef FEAT_EVAL + /* When testing some errors are turned into a normal message. */ + if (ignore_error(s)) + return msg(s); +#endif + called_emsg = TRUE; /*