annotate src/testdir/test_global.vim @ 19783:546bdeef35f1 v8.2.0448

patch 8.2.0448: various functions not properly tested Commit: https://github.com/vim/vim/commit/0e05de46226eb4e5ea580beefa71831f92d613d3 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 25 22:23:46 2020 +0100 patch 8.2.0448: various functions not properly tested Problem: Various functions not properly tested. Solution: Add more tests, especially for failures. (Yegappan Lakshmanan, closes #5843)
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Mar 2020 22:30:04 +0100
parents 0208534b8a84
children ec89debe5037
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11273
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 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
3 new
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 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
5 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
6 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
7 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
8 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
9 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
10 g/^/normal yyp
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
11 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
12 set clipboard&
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 bwipe!
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 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
15
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
16 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
17 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
18 call setline(1, ['nothing', 'found', 'found bad', 'bad'])
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 call assert_fails('g/found/3v/bad/s/^/++/', 'E147')
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
20 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
21 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
22 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
23 endfunc
19231
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
24
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
25 func Test_global_error()
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
26 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
27 call assert_fails('g', 'E148:')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
28 call assert_fails('g/\(/y', 'E476:')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
29 endfunc
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
30
19277
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
31 " 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
32 func Test_global_print()
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
33 new
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
34 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
35 let @/ = 'foo'
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
36 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
37 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
38
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
39 " 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
40 let @/ = 'bar'
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
41 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
42 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
43
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
44 normal gg
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
45 s/foo/foo/
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
46 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
47 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
48
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
49 let @/ = 'bar'
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(['bar'], 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 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
54 let v:statusmsg = ''
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
55 v/foo\|bar/p
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
56 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
57
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
58 close!
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
59 endfunc
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
60
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
61 " 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
62 func Test_global_newline()
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
63 new
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
64 call setline(1, ['foo'])
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
65 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
66 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
67 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
68 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
69 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
70 close!
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
71 endfunc
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
72
19231
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
73 " vim: shiftwidth=2 sts=2 expandtab