annotate src/testdir/test_global.vim @ 35122:739aaccbca74 default tip

runtime(sh,zsh): clear $MANPAGER in ftplugin before shelling out Commit: https://github.com/vim/vim/commit/8d8cb45756cb7e6fda17013b8347be3a11b29610 Author: D. Ben Knoble <ben.knoble+github@gmail.com> Date: Mon May 6 19:52:53 2024 +0200 runtime(sh,zsh): clear $MANPAGER in ftplugin before shelling out Say you use Vim and set MANPAGER='vim -M +MANPAGER --not-a-term -'; then :{Zs,S}hKeywordPrg (or K) will crap out and spew terminal garbage into less when bash's "help" fails. This was introduced by 2f25e40b1 (runtime: configure keywordpg for some file types (#5566), 2023-08-23) and may be present in other files touched by that commit. Make the "man" invocation sensible by unsetting MANPAGER in the environment. Note that changing MANPAGER for `:terminal` is not needed; Vim within Vim is perfectly fine. closes: #14679 Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 06 May 2024 20:00:09 +0200
parents 0e92ffdd9ea7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1 " Test for :global and :vglobal
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
2
20707
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
3 source check.vim
29481
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
4 source term_util.vim
11273
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 func Test_yank_put_clipboard()
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 new
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call setline(1, ['a', 'b', 'c'])
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 set clipboard=unnamed
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 g/^/normal yyp
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal(['a', 'a', 'b', 'b', 'c', 'c'], getline(1, 6))
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
12 set clipboard=unnamed,unnamedplus
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
13 call setline(1, ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
14 g/^/normal yyp
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
15 call assert_equal(['a', 'a', 'b', 'b', 'c', 'c'], getline(1, 6))
11273
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 set clipboard&
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 bwipe!
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endfunc
11494
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
19
20707
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
20 func Test_global_set_clipboard()
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
21 CheckFeature clipboard_working
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
22 new
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
23 set clipboard=unnamedplus
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
24 let @+='clipboard' | g/^/set cb= | let @" = 'unnamed' | put
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
25 call assert_equal(['','unnamed'], getline(1, '$'))
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
26 set clipboard&
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
27 bwipe!
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
28 endfunc
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
29
11494
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
30 func Test_nested_global()
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
31 new
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
32 call setline(1, ['nothing', 'found', 'found bad', 'bad'])
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
33 call assert_fails('g/found/3v/bad/s/^/++/', 'E147:')
11494
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
34 g/found/v/bad/s/^/++/
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
35 call assert_equal(['nothing', '++found', 'found bad', 'bad'], getline(1, 4))
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
36 bwipe!
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
37 endfunc
19231
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
38
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
39 func Test_global_error()
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
40 call assert_fails('g\\a', 'E10:')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
41 call assert_fails('g', 'E148:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20707
diff changeset
42 call assert_fails('g/\(/y', 'E54:')
19231
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
43 endfunc
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
44
19277
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
45 " Test for printing lines using :g with different search patterns
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
46 func Test_global_print()
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
47 new
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
48 call setline(1, ['foo', 'bar', 'foo', 'foo'])
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
49 let @/ = 'foo'
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
50 let t = execute("g/")->trim()->split("\n")
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
51 call assert_equal(['foo', 'foo', 'foo'], t)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
52
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
53 " Test for Vi compatible patterns
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
54 let @/ = 'bar'
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
55 let t = execute('g\/')->trim()->split("\n")
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
56 call assert_equal(['bar'], t)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
57
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
58 normal gg
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
59 s/foo/foo/
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
60 let t = execute('g\&')->trim()->split("\n")
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
61 call assert_equal(['foo', 'foo', 'foo'], t)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
62
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
63 let @/ = 'bar'
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
64 let t = execute('g?')->trim()->split("\n")
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
65 call assert_equal(['bar'], t)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
66
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
67 " Test for the 'Pattern found in every line' message
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
68 let v:statusmsg = ''
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
69 v/foo\|bar/p
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
70 call assert_notequal('', v:statusmsg)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
71
27962
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
72 " In Vim9 script this is an error
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
73 let caught = 'no'
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
74 try
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
75 vim9cmd v/foo\|bar/p
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
76 catch /E538/
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
77 let caught = 'yes'
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
78 call assert_match('E538: Pattern found in every line: foo\|bar', v:exception)
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
79 endtry
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
80 call assert_equal('yes', caught)
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
81
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
82 " In Vim9 script not matching is an error
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
83 let caught = 'no'
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
84 try
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
85 vim9cmd g/foobarnotfound/p
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
86 catch /E486/
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
87 let caught = 'yes'
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
88 call assert_match('E486: Pattern not found: foobarnotfound', v:exception)
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
89 endtry
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
90 call assert_equal('yes', caught)
0fa3be75ddc7 patch 8.2.4506: "pattern not found" for :global is not an error message
Bram Moolenaar <Bram@vim.org>
parents: 24992
diff changeset
91
19277
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
92 close!
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
93 endfunc
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
94
31519
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
95 func Test_global_empty_pattern()
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
96 " populate history
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
97 silent g/hello/
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
98
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
99 redir @a
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
100 g//
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
101 redir END
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
102
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
103 call assert_match('Pattern not found: hello', @a)
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
104 " ^~~~~ this was previously empty
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
105 endfunc
0e92ffdd9ea7 patch 9.0.1092: search error message doesn't show used pattern
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
106
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
107 " Test for global command with newline character
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
108 func Test_global_newline()
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
109 new
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
110 call setline(1, ['foo'])
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
111 exe "g/foo/s/f/h/\<NL>s/o$/w/"
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
112 call assert_equal('how', getline(1))
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
113 call setline(1, ["foo\<NL>bar"])
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
114 exe "g/foo/s/foo\\\<NL>bar/xyz/"
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
115 call assert_equal('xyz', getline(1))
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
116 close!
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
117 endfunc
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
118
24992
026718ffbfa8 patch 8.2.3033: no error when using alpha delimiter with :global
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
119 func Test_wrong_delimiter()
026718ffbfa8 patch 8.2.3033: no error when using alpha delimiter with :global
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
120 call assert_fails('g x^bxd', 'E146:')
026718ffbfa8 patch 8.2.3033: no error when using alpha delimiter with :global
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
121 endfunc
026718ffbfa8 patch 8.2.3033: no error when using alpha delimiter with :global
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
122
29481
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
123 " Test for interrupting :global using Ctrl-C
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
124 func Test_interrupt_global()
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
125 CheckRunVimInTerminal
30550
2c169fec56f2 patch 9.0.0610: global interrupt test fails when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29481
diff changeset
126
29481
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
127 let lines =<< trim END
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
128 cnoremap ; <Cmd>sleep 10<CR>
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
129 call setline(1, repeat(['foo'], 5))
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
130 END
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30550
diff changeset
131 call writefile(lines, 'Xtest_interrupt_global', 'D')
29481
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
132 let buf = RunVimInTerminal('-S Xtest_interrupt_global', {'rows': 6})
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
133
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
134 call term_sendkeys(buf, ":g/foo/norm :\<C-V>;\<CR>")
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
135 " Wait for :sleep to start
30550
2c169fec56f2 patch 9.0.0610: global interrupt test fails when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29481
diff changeset
136 call TermWait(buf, 100)
29481
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
137 call term_sendkeys(buf, "\<C-C>")
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
138 call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 6))}, 1000)
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
139
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
140 " Also test in Ex mode
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
141 call term_sendkeys(buf, "gQg/foo/norm :\<C-V>;\<CR>")
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
142 " Wait for :sleep to start
30550
2c169fec56f2 patch 9.0.0610: global interrupt test fails when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29481
diff changeset
143 call TermWait(buf, 100)
29481
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
144 call term_sendkeys(buf, "\<C-C>")
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
145 call WaitForAssert({-> assert_match('Interrupted', term_getline(buf, 5))}, 1000)
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
146
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
147 call StopVimInTerminal(buf)
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
148 endfunc
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 27962
diff changeset
149
19231
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
150 " vim: shiftwidth=2 sts=2 expandtab