Patch 8.2.3108

10 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 5, 2021, 8:10:35 AM7/5/21
to vim...@googlegroups.com

Patch 8.2.3108
Problem: Test for remote_foreground() fails. (Elimar Riesebieter)
Solution: Check that $DISPLAY is set. (Christian Brabandt)
Files: src/testdir/check.vim, src/testdir/test_clientserver.vim,
src/testdir/test_vim9_builtin.vim


*** ../vim-8.2.3107/src/testdir/check.vim 2021-07-03 21:37:56.330492487 +0200
--- src/testdir/check.vim 2021-07-05 14:06:24.212151205 +0200
***************
*** 136,141 ****
--- 136,149 ----
endif
endfunc

+ " Command to Check for an environment variable
+ command -nargs=1 CheckEnv call CheckEnv(<f-args>)
+ func CheckEnv(name)
+ if empty('$' .. a:name)
+ throw 'Skipped: Environment variable ' .. a:name .. ' is not set'
+ endif
+ endfunc
+
" Command to check that we are using the GUI
command CheckGui call CheckGui()
func CheckGui()
*** ../vim-8.2.3107/src/testdir/test_clientserver.vim 2021-03-20 22:16:52.961362692 +0100
--- src/testdir/test_clientserver.vim 2021-07-05 14:05:16.756284309 +0200
***************
*** 13,21 ****

func Check_X11_Connection()
if has('x11')
! if empty($DISPLAY)
! throw 'Skipped: $DISPLAY is not set'
! endif
try
call remote_send('xxx', '')
catch
--- 13,19 ----

func Check_X11_Connection()
if has('x11')
! CheckEnv DISPLAY
try
call remote_send('xxx', '')
catch
*** ../vim-8.2.3107/src/testdir/test_vim9_builtin.vim 2021-07-03 19:27:32.690065101 +0200
--- src/testdir/test_vim9_builtin.vim 2021-07-05 14:09:02.347842015 +0200
***************
*** 1415,1420 ****
--- 1415,1422 ----
CheckFeature clientserver
# remote_foreground() doesn't fail on MS-Windows
CheckNotMSWindows
+ CheckEnv DISPLAY
+
CheckDefFailure(['remote_foreground(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
assert_fails('remote_foreground("NonExistingServer")', 'E241:')
enddef
*** ../vim-8.2.3107/src/version.c 2021-07-04 23:29:26.821602887 +0200
--- src/version.c 2021-07-05 14:07:54.987973231 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3108,
/**/

--
From "know your smileys":
=):-) Uncle Sam

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Elimar Riesebieter

unread,
Jul 5, 2021, 10:12:43 AM7/5/21
to vim...@googlegroups.com
Hi Bram,

* Bram Moolenaar <Br...@moolenaar.net> [2021-07-05 14:10 +0200]:

>
> Patch 8.2.3108
> Problem: Test for remote_foreground() fails. (Elimar Riesebieter)
> Solution: Check that $DISPLAY is set. (Christian Brabandt)
> Files: src/testdir/check.vim, src/testdir/test_clientserver.vim,
> src/testdir/test_vim9_builtin.vim
>

your patch differs from Christian's version. Compiling 8.2.3108 gives
me:

Failures: From test_vim9_builtin.vim: Found errors in Test_remote_foreground():
command line..script /source/vim/vim-8.2.3108/src/vim-gtk3/testdir/runtest.vim[473]..function RunTheTest[44]..Test_remote_foreground line 7: Expected 'E241:' but got 'E240:No connection to the X server': remote_foreground("NonExistingServer")

Elimar
--
355/113: Not the famous irrational number pi,
but an incredible simulation!
-unknown

Christian Brabandt

unread,
Jul 5, 2021, 10:32:21 AM7/5/21
to vim...@googlegroups.com

On Mo, 05 Jul 2021, Elimar Riesebieter wrote:

> Hi Bram,
>
> * Bram Moolenaar <Br...@moolenaar.net> [2021-07-05 14:10 +0200]:
>
> >
> > Patch 8.2.3108
> > Problem: Test for remote_foreground() fails. (Elimar Riesebieter)
> > Solution: Check that $DISPLAY is set. (Christian Brabandt)
> > Files: src/testdir/check.vim, src/testdir/test_clientserver.vim,
> > src/testdir/test_vim9_builtin.vim
> >
>
> your patch differs from Christian's version. Compiling 8.2.3108 gives
> me:

Yes, I also wondered about some of the changes. The problem is, when
using empty and quoting the argument, the result cannot be true anymore

So I think it needs this change:

diff --git a/src/testdir/check.vim b/src/testdir/check.vim
index 504a1928e..b2f457074 100644
--- a/src/testdir/check.vim
+++ b/src/testdir/check.vim
@@ -139,7 +139,7 @@ endfunc
" Command to Check for an environment variable
command -nargs=1 CheckEnv call CheckEnv(<f-args>)
func CheckEnv(name)
- if empty('$' .. a:name)
+ if empty($ .. a:name)
throw 'Skipped: Environment variable ' .. a:name .. ' is not set'
endif
endfunc

or change the test to use exists()

Best,
Christian
--
Kunst ist kein Abbild der realen Welt.
Eine ist, bei Gott, mehr als genug.
-- Virginia Woolf

Elimar Riesebieter

unread,
Jul 5, 2021, 11:28:48 AM7/5/21
to vim...@googlegroups.com
* Christian Brabandt <cbl...@256bit.org> [2021-07-05 16:32 +0200]:
This Patch fails with:

Failures:
From test_clientserver.vim:
Found errors in Test_client_server():
Run 1:
Caught exception in Test_client_server(): Vim(if):E116: Invalid arguments for function empty($ .. a:name) @ command line..script /source/vim/vim-8.2.3108/src/vim-gtk3/testdir/runtest.vim[473]..function RunTheTest[44]..Test_client_server[5]..Check_X11_Connection[2]..CheckEnv, line 1
Run 2:
Caught exception in Test_client_server(): Vim(if):E116: Invalid arguments for function empty($ .. a:name) @ command line..script /source/vim/vim-8.2.3108/src/vim-gtk3/testdir/runtest.vim[507]..function RunTheTest[44]..Test_client_server[5]..Check_X11_Connection[2]..CheckEnv, line 1
Run 3:
Caught exception in Test_client_server(): Vim(if):E116: Invalid arguments for function empty($ .. a:name) @ command line..script /source/vim/vim-8.2.3108/src/vim-gtk3/testdir/runtest.vim[507]..function RunTheTest[44]..Test_client_server[5]..Check_X11_Connection[2]..CheckEnv, line 1
Flaky test failed too often, giving up
From test_vim9_builtin.vim:
Found errors in Test_remote_foreground():
Caught exception in Test_remote_foreground(): Vim(if):E116: Invalid arguments for function empty($ .. a:name) @ command line..script /source/vim/vim-8.2.3108/src/vim-gtk3/testdir/runtest.vim[473]..function RunTheTest[44]..Test_remote_foreground[4]..CheckEnv, line 1


Elimar
--
>what IMHO then?
IMHO - Inhalation of a Multi-leafed Herbal Opiate ;)
--posting from alex in debian-user--

Christian Brabandt

unread,
Jul 5, 2021, 11:37:48 AM7/5/21
to vim...@googlegroups.com
Hm, can you test and change this:

,----
| if empty('$' .. a:name)
`----

to that:

,----
| if !exists('$' .. a:name)
`----

Best,
Christian
--
Gott will, daß der Mensch seinen Spaß hat.
-- Theresia von Avila

Bram Moolenaar

unread,
Jul 5, 2021, 11:50:47 AM7/5/21
to vim...@googlegroups.com, Christian Brabandt
Sorry, I tried to combine it with an existing test for $DISPLAY.
That one used empty(), because it's possible that the environment
variable exists but is empty.
However, the way I wrote it, it checks if the string '$DISPLAY' is empty.
It needs using eval().

--
From "know your smileys":
(X0||) Double hamburger with lettuce and tomato
Reply all
Reply to author
Forward
0 new messages