summaryrefslogtreecommitdiff
path: root/src/message.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-01 15:07:05 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-01 15:07:05 +0100
commite0c31f6a304496b597a51ce98af419ec815bec74 (patch)
tree9e40b37c819bfc5a3c8f7fb41c25657a88b89ff2 /src/message.c
parent5f53dd3f747711be90879fa2f22a207970b86750 (diff)
downloadvim-git-e0c31f6a304496b597a51ce98af419ec815bec74.tar.gz
patch 8.0.0392: GUI test fails with Athena and Motifv8.0.0392
Problem: GUI test fails with Athena and Motif. Solution: Add test_ignore_error(). Use it to ignore the "failed to create input context" error.
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/message.c b/src/message.c
index 2982a4051..985e1ebbf 100644
--- 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;
/*