annotate src/testdir/test_visual.vim @ 12644:1fad9675d8fd v8.0.1200

patch 8.0.1200: tests switch the bell off twice commit https://github.com/vim/vim/commit/67418d97b457d2e27fe342472d3c9fd342ffc47f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 15 22:07:39 2017 +0200 patch 8.0.1200: tests switch the bell off twice Problem: Tests switch the bell off twice. Solution: Don't set 'belloff' in individual tests. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Sun, 15 Oct 2017 22:15:04 +0200
parents 7d7835ab8b37
children aa658b33f25a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
1 " Tests for various Visual mode.
8401
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 if !has('visual')
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 finish
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 endif
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
11091
ae45d497868f patch 8.0.0433: beeps when running tests
Christian Brabandt <cb@256bit.org>
parents: 10900
diff changeset
6
8401
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_block_shift_multibyte()
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
8 " Uses double-wide character.
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
9 if !has('multi_byte')
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
10 return
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
11 endif
8401
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 split
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call setline(1, ['xヹxxx', 'ヹxxx'])
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 exe "normal 1G0l\<C-V>jl>"
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call assert_equal('x ヹxxx', getline(1))
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_equal(' ヹxxx', getline(2))
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 q!
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endfunc
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
19
11997
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
20 func Test_block_shift_overflow()
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
21 " This used to cause a multiplication overflow followed by a crash.
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
22 new
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
23 normal ii
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
24 exe "normal \<C-V>876543210>"
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
25 q!
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
26 endfunc
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
27
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
28 func Test_dotregister_paste()
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
29 new
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
30 exe "norm! ihello world\<esc>"
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
31 norm! 0ve".p
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
32 call assert_equal('hello world world', getline(1))
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
33 q!
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
34 endfunc
10803
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
35
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
36 func Test_Visual_ctrl_o()
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
37 new
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
38 call setline(1, ['one', 'two', 'three'])
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
39 call cursor(1,2)
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
40 set noshowmode
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
41 set tw=0
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
42 call feedkeys("\<c-v>jjlIa\<c-\>\<c-o>:set tw=88\<cr>\<esc>", 'tx')
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
43 call assert_equal(['oane', 'tawo', 'tahree'], getline(1, 3))
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
44 call assert_equal(88, &tw)
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
45 set tw&
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
46 bw!
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
47 endfu
10881
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
48
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
49 func Test_Visual_vapo()
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
50 new
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
51 normal oxx
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
52 normal vapo
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
53 bwipe!
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
54 endfunc
10900
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
55
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
56 func Test_Visual_inner_quote()
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
57 new
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
58 normal oxX
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
59 normal vki'
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
60 bwipe!
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
61 endfunc
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
62
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
63 " Test for Visual mode not being reset causing E315 error.
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
64 func TriggerTheProblem()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
65 " At this point there is no visual selection because :call reset it.
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
66 " Let's restore the selection:
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
67 normal gv
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
68 '<,'>del _
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
69 try
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
70 exe "normal \<Esc>"
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
71 catch /^Vim\%((\a\+)\)\=:E315/
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
72 echom 'Snap! E315 error!'
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
73 let g:msg='Snap! E315 error!'
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
74 endtry
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
75 endfunc
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
76
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
77 func Test_visual_mode_reset()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
78 enew
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
79 let g:msg="Everything's fine."
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
80 enew
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
81 setl buftype=nofile
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
82 call append(line('$'), 'Delete this line.')
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
83
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
84 " NOTE: this has to be done by a call to a function because executing :del
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
85 " the ex-way will require the colon operator which resets the visual mode
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
86 " thus preventing the problem:
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
87 exe "normal! GV:call TriggerTheProblem()\<CR>"
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
88 call assert_equal("Everything's fine.", g:msg)
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
89
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
90 endfunc
12644
1fad9675d8fd patch 8.0.1200: tests switch the bell off twice
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
91