diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-03-01 15:07:05 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-03-01 15:07:05 +0100 |
commit | e0c31f6a304496b597a51ce98af419ec815bec74 (patch) | |
tree | 9e40b37c819bfc5a3c8f7fb41c25657a88b89ff2 /src | |
parent | 5f53dd3f747711be90879fa2f22a207970b86750 (diff) |
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')
-rw-r--r-- | src/evalfunc.c | 11 | ||||
-rw-r--r-- | src/message.c | 31 | ||||
-rw-r--r-- | src/proto/message.pro | 1 | ||||
-rw-r--r-- | src/testdir/test_gui.vim | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 48 insertions, 0 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 52527bc897..a470ff996f 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -389,6 +389,7 @@ static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv); static void f_test_autochdir(typval_T *argvars, typval_T *rettv); static void f_test_disable_char_avail(typval_T *argvars, typval_T *rettv); static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv); +static void f_test_ignore_error(typval_T *argvars, typval_T *rettv); #ifdef FEAT_JOB_CHANNEL static void f_test_null_channel(typval_T *argvars, typval_T *rettv); #endif @@ -823,6 +824,7 @@ static struct fst {"test_autochdir", 0, 0, f_test_autochdir}, {"test_disable_char_avail", 1, 1, f_test_disable_char_avail}, {"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now}, + {"test_ignore_error", 1, 1, f_test_ignore_error}, #ifdef FEAT_JOB_CHANNEL {"test_null_channel", 0, 0, f_test_null_channel}, #endif @@ -12325,6 +12327,15 @@ f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED) garbage_collect(TRUE); } +/* + * "test_ignore_error()" function + */ + static void +f_test_ignore_error(typval_T *argvars, typval_T *rettv UNUSED) +{ + ignore_error_for_testing(get_tv_string(&argvars[0])); +} + #ifdef FEAT_JOB_CHANNEL static void f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv) diff --git a/src/message.c b/src/message.c index 2982a4051e..985e1ebbf2 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; /* diff --git a/src/proto/message.pro b/src/proto/message.pro index c9d62c66e0..9a79f14a60 100644 --- a/src/proto/message.pro +++ b/src/proto/message.pro @@ -8,6 +8,7 @@ void trunc_string(char_u *s, char_u *buf, int room_in, int buflen); void reset_last_sourcing(void); void msg_source(int attr); int emsg_not_now(void); +void ignore_error_for_testing(char_u *error); void do_perror(char *msg); int emsg(char_u *s); int emsg2(char_u *s, char_u *a1); diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim index 77e4f2e9a6..6c9722dacf 100644 --- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -17,6 +17,9 @@ endfunc " Test for resetting "secure" flag after GUI has started. " Must be run first. func Test_1_set_secure() + " Ignore the "failed to create input context" error. + call test_ignore_error('E285') + set exrc secure gui -f call assert_equal(1, has('gui_running')) diff --git a/src/version.c b/src/version.c index d4d27ecfc5..e0ec0cec68 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 392, +/**/ 391, /**/ 390, |