Mercurial > vim
annotate src/testdir/test_remote.vim @ 34620:abc7a647c83b v9.1.0199
patch 9.1.0199: Not enough tests for the slice() function
Commit: https://github.com/vim/vim/commit/ad38769030b5fa86aa0e8f1f0b4266690dfad4c9
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Mar 23 08:23:48 2024 +0100
patch 9.1.0199: Not enough tests for the slice() function
Problem: Not enough tests for the slice() function.
Solution: Test with multibyte chars, and in both Legacy and Vim9 script.
Update docs to be clearer about how it treats composing chars.
(zeertzjq)
closes: #14275
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 23 Mar 2024 08:30:06 +0100 |
parents | 6315b95cba59 |
children | e71b9c9debfe |
rev | line source |
---|---|
34188
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for the --remote functionality |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 source check.vim |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 CheckFeature clientserver |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 CheckFeature terminal |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 source shared.vim |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 source screendump.vim |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 source mouse.vim |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 source term_util.vim |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 let s:remote_works = 0 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 let s:skip = 'Skipped: --remote feature is not possible' |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 " nees to be run as first test to verify, that vim --servername works |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 func Verify_remote_feature_works() |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 CheckRunVimInTerminal |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 enew |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 let buf = RunVimInTerminal('--servername XVIMTEST', {'rows': 8}) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call TermWait(buf) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 let cmd = GetVimCommandCleanTerm() .. '--serverlist' |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call term_sendkeys(buf, ":r! " .. cmd .. "\<CR>") |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call TermWait(buf) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 call term_sendkeys(buf, ":w! XVimRemoteTest.txt\<CR>") |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call TermWait(buf) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call term_sendkeys(buf, ":q\<CR>") |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call StopVimInTerminal(buf) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 bw! |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 let result = readfile('XVimRemoteTest.txt') |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 call delete('XVimRemoteTest.txt') |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 if empty(result) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 throw s:skip |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 endif |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 let s:remote = 1 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 endfunc |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call Verify_remote_feature_works() |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 if !s:remote |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 finish |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 endif |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 func Test_remote_servername() |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 CheckRunVimInTerminal |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 " That is the file we want the server to open, |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 " despite the wildignore setting |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 call writefile(range(1, 20), 'XTEST.txt', 'D') |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 " just a dummy file, so that the ':wq' further down is successful |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call writefile(range(1, 20), 'Xdummy.log', 'D') |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 " Run Vim in a terminal and open a terminal window to run Vim in. |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 let lines =<< trim END |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 set wildignore=*.txt |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 END |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call writefile(lines, 'XRemoteEditing.vim', 'D') |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 let buf = RunVimInTerminal('--servername XVIMTEST -S XRemoteEditing.vim Xdummy.log', {'rows': 8}) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 call TermWait(buf) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 botright new |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 " wildignore setting should be ignored and the XVIMTEST server should now |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 " open XTEST.txt, if wildignore setting is not ignored, the server |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 " will continue with the Xdummy.log file |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 let buf2 = RunVimInTerminal('--servername XVIMTEST --remote-silent XTEST.txt', {'rows': 5, 'wait_for_ruler': 0}) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 " job should be no-longer running, so we can just close it |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 exe buf2 .. 'bw!' |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 call term_sendkeys(buf, ":sil :3,$d\<CR>") |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 call TermWait(buf) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call term_sendkeys(buf, ":wq!\<CR>") |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 call TermWait(buf) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 if term_getstatus(buf) == 'running' |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 call StopVimInTerminal(buf) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 endif |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 let buf_contents = readfile('XTEST.txt') |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 call assert_equal(2, len(buf_contents)) |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 bw! |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 close |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 endfunc |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 |
6315b95cba59
patch 9.1.0045: --remote-* does not ignore `wilidignore`
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 " vim: shiftwidth=2 sts=2 expandtab |