Commit: patch 9.2.0974: tests: Test_clientserver_serverlist_list() is flaky

Christian Brabandt <[email protected]>
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
patch 9.2.0974: tests: Test_clientserver_serverlist_list() is flaky

Commit: https://github.com/vim/vim/commit/41ec8c6ed0a1837d2b56c704df122615b4b5a5bf
Author: Hirohito Higashi <[email protected]>
Date:   Tue Aug 18 20:44:05 2026 +0000

    patch 9.2.0974: tests: Test_clientserver_serverlist_list() is flaky
    
    Problem:  The test fails now and then, most often on MS-Windows. It uses the
              same server name as another test in the file, and Vim appends a
              number to the name when a server with that name is still running.
              The name is then checked with a match, which still succeeds, and
              with an exact comparison, which does not.
    Solution: Use a name of its own and check the list with a pattern, so that a
              number appended to the name does not matter.
    
    closes: #21083
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
    Signed-off-by: Hirohito Higashi <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/testdir/test_clientserver.vim b/src/testdir/test_clientserver.vim
index 8fa204ea5..5ed063e1f 100644
--- a/src/testdir/test_clientserver.vim
+++ b/src/testdir/test_clientserver.vim
@@ -671,14 +671,18 @@ func Test_clientserver_serverlist_list()
 
   " Don't use channel:2000, because previous tests use that and it may take a
   " while for the channel to fully close.
-  let actual = cmd .. ' --servername XVIMTEST'
+  " Use a name of its own: when a server of another test is still running Vim
+  " appends a number to the name.
+  let actual = cmd .. ' --servername XVIMSRVLIST'
 
   let job = job_start(actual, {'stoponexit': 'kill', 'out_io': 'null'})
 
-  call WaitForAssert({-> assert_match('XVIMTEST', serverlist())})
+  call WaitForAssert({-> assert_match('XVIMSRVLIST', serverlist())})
 
-  call assert_equal('list<string>', typename(serverlist(#{list: v:true})))
-  call assert_true(serverlist(#{list: v:true})->index('XVIMTEST') != -1)
+  " Use a pattern, the name may have a number appended to it.
+  let servers = serverlist(#{list: v:true})
+  call assert_equal('list<string>', typename(servers))
+  call assert_notequal(-1, match(servers, '^XVIMSRVLIST'))
 
   if has('win32')
     call job_stop(job, 'kill')
diff --git a/src/version.c b/src/version.c
index 76a606456..2341e6991 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    974,
 /**/
     973,
 /**/

-- 
-- 
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].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1wwQui-00AkBF-MI%40256bit.org.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.