]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0361: tests: no tests for ch_listen() with IPs v9.2.0361
authorZdenek Dohnal <zdohnal@redhat.com>
Fri, 17 Apr 2026 15:55:53 +0000 (15:55 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 17 Apr 2026 15:55:53 +0000 (15:55 +0000)
Problem:  tests: no tests for ch_listen() with IPs
Solution: Add tests that this is disallowed
          (Zdenek Dohnal)

The functionality was removed, so the test is to make sure it fails
as expected.

closes: #19997

Signed-off-by: Zdenek Dohnal <zdohnal@redhat.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/testdir/test_channel.vim
src/version.c

index 9110a141c7c0381532a1028a10fc330af1b1066b..23f8a0fc3e3eff243f654288a69aca4d9ca47c62 100644 (file)
@@ -2799,8 +2799,8 @@ func Test_listen()
     call assert_match('127.0.0.1:', g:server_received_addr)
 endfunc
 
-func Test_listen_invalid_port()
-    call ch_log('Test_listen_invalid_port()')
+func Test_listen_invalid_argument()
+    call ch_log('Test_listen_invalid_argument()')
 
     " missing port
     call assert_fails("call ch_listen('')", 'E475:')
@@ -2816,6 +2816,13 @@ func Test_listen_invalid_port()
 
     " port number negative
     call assert_fails("call ch_listen('-1')", 'E475:')
+
+    " make sure we don't accept hostname/IP address
+    call assert_fails("call ch_listen('127.0.0.1:4500')", 'E475:')
+    call assert_fails("call ch_listen('127.0.0.1')", 'E475:')
+    call assert_fails("call ch_listen('localhost:4500')", 'E475:')
+    call assert_fails("call ch_listen('localhost')", 'E475:')
+    call assert_fails("call ch_listen('[::1]')", 'E475:')
 endfunc
 
 func Test_listen_info_no_hostname()
index 2361deb7de0caa30feeb104cda93f2ab5d69ce78..4a4b69288b35f8c0076349583d2359255097b62a 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    361,
 /**/
     360,
 /**/