2017-03-01 23:07 GMT+09:00 Bram Moolenaar <[email protected]>: > > Patch 8.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. > Files: src/message.c, src/proto/message.pro, src/evalfunc.c, > src/testdir/test_gui.vim, runtime/doc/eval.txt >
Bram,
Thank you for taking this into consideration. That will make much easier
writing tests for the Athena and Motif GUIs.
Trying the patch with XIM-enabled Athena and Motif builds, I found that
some additional modifications are suitable for making the tests better.
The attached patch is for that.
Also, in order not to stop the sequence of the tests (Even after including
my patch, we need to click the dialog button to resume the test
sequence), I think we need to suppress popping up a dialog warning the
error. I'll try to write a patch for that tomorrow if you don't have a
plan to do that.
Best regards,
Kazunobu Kuriyama
>
> *** ../vim-8.0.0391/src/message.c 2017-01-14 19:24:48.654828136 +0100
> --- src/message.c 2017-03-01 14:43:50.650575988 +0100
> ***************
> *** 539,544 ****
> --- 539,569 ----
> 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,582 ****
> --- 602,613 ----
> 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;
>
> /*
> *** ../vim-8.0.0391/src/proto/message.pro 2016-11-10
> 20:01:41.201582868 +0100
> --- src/proto/message.pro 2017-03-01 14:42:43.571011184 +0100
> ***************
> *** 8,13 ****
> --- 8,14 ----
> 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);
> *** ../vim-8.0.0391/src/evalfunc.c 2017-02-25 14:59:29.906090427
> +0100
> --- src/evalfunc.c 2017-03-01 14:17:03.577012930 +0100
> ***************
> *** 389,394 ****
> --- 389,395 ----
> 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,828 ****
> --- 824,830 ----
> {"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,12330 ****
> --- 12327,12341 ----
> 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)
> *** ../vim-8.0.0391/src/testdir/test_gui.vim 2017-02-26
> 15:08:17.578786550 +0100
> --- src/testdir/test_gui.vim 2017-03-01 14:59:40.224455941 +0100
> ***************
> *** 17,22 ****
> --- 17,25 ----
> " 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'))
> *** ../vim-8.0.0391/runtime/doc/eval.txt 2017-02-20
> 22:35:29.017423364 +0100
> --- runtime/doc/eval.txt 2017-03-01 14:41:34.051462246 +0100
> ***************
> *** 2357,2362 ****
> --- 2358,2364 ----
> test_autochdir() none enable 'autochdir' during startup
> test_disable_char_avail({expr}) none test without typeahead
> test_garbagecollect_now() none free memory right now for testing
> + test_ignore_error({expr}) none ignore a specific error
> test_null_channel() Channel null value for testing
> test_null_dict() Dict null value for testing
> test_null_job() Job null value for testing
> ***************
> *** 7773,7778 ****
> --- 7785,7799 ----
> internally, and |v:testing| must have been set before
> calling
> any function.
>
> + test_ignore_error({expr}) *test_ignore_error()*
> + Ignore any error containing {expr}. A normal message is
> given
> + instead.
> + This is only meant to be used in tests, where catching the
> + error with try/catch cannot be used (because it skips over
> + following code).
> + {expr} is used literally, not as a pattern.
> + There is currently no way to revert this.
> +
> test_null_channel()
> *test_null_channel()*
> Return a Channel that is null. Only useful for testing.
> {only available when compiled with the +channel feature}
> *** ../vim-8.0.0391/src/version.c 2017-03-01 14:02:25.554677542 +0100
> --- src/version.c 2017-03-01 14:36:48.457315658 +0100
> ***************
> *** 766,767 ****
> --- 766,769 ----
> { /* Add new patch number below this line */
> + /**/
> + 392,
> /**/
>
> --
> Q. What happens to programmers when they die?
> A: MS-Windows programmers are reinstalled. C++ programmers become
> undefined,
> anyone who refers to them will die as well. Java programmers reincarnate
> after being garbage collected, unless they are in permgen, in which case
> they become zombies. Zimbu programmers leave a stack trace that tells
> us
> exactly where they died and how they got there.
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net
> \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
> \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org
> ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org
> ///
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
input-context-error.patch
Description: Binary data
