annotate src/testdir/test_put.vim @ 19651:283c8bc6a8e2 v8.2.0382

patch 8.2.0382: some tests fail when run under valgrind Commit: https://github.com/vim/vim/commit/353c351bd22e4dac4c3ae9cd7731032348f248c4 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 15 14:19:26 2020 +0100 patch 8.2.0382: some tests fail when run under valgrind Problem: Some tests fail when run under valgrind. Solution: Increase timeouts.
author Bram Moolenaar <Bram@vim.org>
date Sun, 15 Mar 2020 14:30:05 +0100
parents f70a3c1000bb
children 808edde1e97d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
1 " Tests for put commands, e.g. ":put", "p", "gp", "P", "gP", etc.
10664
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_put_block()
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 new
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 call feedkeys("i\<C-V>u2500\<CR>x\<ESC>", 'x')
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call feedkeys("\<C-V>y", 'x')
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 call feedkeys("gg0p", 'x')
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_equal("\u2500x", getline(1))
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 bwipe!
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endfunc
10670
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
11
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
12 func Test_put_char_block()
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
13 new
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
14 call setline(1, ['Line 1', 'Line 2'])
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
15 f Xfile_put
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
16 " visually select both lines and put the cursor at the top of the visual
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
17 " selection and then put the buffer name over it
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
18 exe "norm! G0\<c-v>ke\"%p"
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
19 call assert_equal(['Xfile_put 1', 'Xfile_put 2'], getline(1,2))
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
20 bw!
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
21 endfunc
10688
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
22
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
23 func Test_put_char_block2()
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
24 new
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 16742
diff changeset
25 let a = [ 'a'->getreg(), 'a'->getregtype() ]
10688
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
26 call setreg('a', ' one ', 'v')
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
27 call setline(1, ['Line 1', '', 'Line 3', ''])
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
28 " visually select the first 3 lines and put register a over it
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
29 exe "norm! ggl\<c-v>2j2l\"ap"
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
30 call assert_equal(['L one 1', '', 'L one 3', ''], getline(1,4))
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
31 " clean up
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
32 bw!
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
33 call setreg('a', a[0], a[1])
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
34 endfunc
11597
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
35
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
36 func Test_put_lines()
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
37 new
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
38 let a = [ getreg('a'), getregtype('a') ]
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
39 call setline(1, ['Line 1', 'Line2', 'Line 3', ''])
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
40 exe 'norm! gg"add"AddG""p'
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
41 call assert_equal(['Line 3', '', 'Line 1', 'Line2'], getline(1,'$'))
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
42 " clean up
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
43 bw!
18000
7a19c8d6bb9e patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
44 eval a[0]->setreg('a', a[1])
11597
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
45 endfunc
14009
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
46
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
47 func Test_put_expr()
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
48 new
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
49 call setline(1, repeat(['A'], 6))
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
50 exec "1norm! \"=line('.')\<cr>p"
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
51 norm! j0.
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
52 norm! j0.
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
53 exec "4norm! \"=\<cr>P"
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
54 norm! j0.
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
55 norm! j0.
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
56 call assert_equal(['A1','A2','A3','4A','5A','6A'], getline(1,'$'))
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
57 bw!
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
58 endfunc
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
59
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
60 func Test_put_fails_when_nomodifiable()
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
61 new
14204
1b9f3932a130 patch 8.1.0119: failing test goes unnoticed because messages is not written
Christian Brabandt <cb@256bit.org>
parents: 14202
diff changeset
62 setlocal nomodifiable
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
63
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
64 normal! yy
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
65 call assert_fails(':put', 'E21')
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
66 call assert_fails(':put!', 'E21')
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
67 call assert_fails(':normal! p', 'E21')
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
68 call assert_fails(':normal! gp', 'E21')
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
69 call assert_fails(':normal! P', 'E21')
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
70 call assert_fails(':normal! gP', 'E21')
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
71
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
72 if has('mouse')
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
73 set mouse=n
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
74 call assert_fails('execute "normal! \<MiddleMouse>"', 'E21')
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
75 set mouse&
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
76 endif
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
77
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
78 bwipeout!
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
79 endfunc
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
80
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
81 " A bug was discovered where the Normal mode put commands (e.g., "p") would
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
82 " output duplicate error messages when invoked in a non-modifiable buffer.
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
83 func Test_put_p_errmsg_nodup()
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
84 new
14204
1b9f3932a130 patch 8.1.0119: failing test goes unnoticed because messages is not written
Christian Brabandt <cb@256bit.org>
parents: 14202
diff changeset
85 setlocal nomodifiable
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
86
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
87 normal! yy
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
88
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
89 func Capture_p_error()
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
90 redir => s:p_err
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
91 normal! p
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
92 redir END
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
93 endfunc
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
94
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
95 silent! call Capture_p_error()
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
96
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
97 " Error message output within a function should be three lines (the function
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
98 " name, the line number, and the error message).
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
99 call assert_equal(3, count(s:p_err, "\n"))
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
100
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
101 delfunction Capture_p_error
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
102 bwipeout!
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
103 endfunc
16742
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
104
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
105 func Test_put_p_indent_visual()
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
106 new
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
107 call setline(1, ['select this text', 'select that text'])
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
108 " yank "that" from the second line
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
109 normal 2Gwvey
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
110 " select "this" in the first line and put
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
111 normal k0wve[p
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
112 call assert_equal('select that text', getline(1))
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
113 call assert_equal('select that text', getline(2))
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
114 bwipe!
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
115 endfunc
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
116
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
117 " Test for deleting all the contents of a buffer with a put
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
118 func Test_put_visual_delete_all_lines()
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
119 new
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
120 call setline(1, ['one', 'two', 'three'])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
121 let @r = ''
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
122 normal! VG"rgp
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
123 call assert_equal(1, line('$'))
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
124 close!
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
125 endfunc
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
126
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
127 " vim: shiftwidth=2 sts=2 expandtab