comparison src/testdir/test_edit.vim @ 15406:63b02fcf1361 v8.1.0711

patch 8.1.0711: test files still use function! commit https://github.com/vim/vim/commit/1e1153600c0377472d62cc553173fe555ddcf5a7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 9 23:01:02 2019 +0100 patch 8.1.0711: test files still use function! Problem: Test files still use function!. Solution: Remove the exclamation mark. Fix overwriting a function.
author Bram Moolenaar <Bram@vim.org>
date Wed, 09 Jan 2019 23:15:05 +0100
parents 4ebda55537a5
children 2dcaa860e3fc
comparison
equal deleted inserted replaced
15405:3a8785d45112 15406:63b02fcf1361
7 " Needed for testing basic rightleft: Test_edit_rightleft 7 " Needed for testing basic rightleft: Test_edit_rightleft
8 source view_util.vim 8 source view_util.vim
9 9
10 " Needs to come first until the bug in getchar() is 10 " Needs to come first until the bug in getchar() is
11 " fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ 11 " fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ
12 func! Test_edit_00b() 12 func Test_edit_00b()
13 new 13 new
14 call setline(1, ['abc ']) 14 call setline(1, ['abc '])
15 inoreabbr <buffer> h here some more 15 inoreabbr <buffer> h here some more
16 call cursor(1, 4) 16 call cursor(1, 4)
17 " <c-l> expands the abbreviation and ends insertmode 17 " <c-l> expands the abbreviation and ends insertmode
19 call assert_equal(['abc here some more '], getline(1,'$')) 19 call assert_equal(['abc here some more '], getline(1,'$'))
20 iunabbr <buffer> h 20 iunabbr <buffer> h
21 bw! 21 bw!
22 endfunc 22 endfunc
23 23
24 func! Test_edit_01() 24 func Test_edit_01()
25 " set for Travis CI? 25 " set for Travis CI?
26 " set nocp noesckeys 26 " set nocp noesckeys
27 new 27 new
28 " 1) empty buffer 28 " 1) empty buffer
29 call assert_equal([''], getline(1,'$')) 29 call assert_equal([''], getline(1,'$'))
59 call assert_equal(["abc def", "ghi jkl"], getline(1, 2)) 59 call assert_equal(["abc def", "ghi jkl"], getline(1, 2))
60 let &bs=_bs 60 let &bs=_bs
61 bw! 61 bw!
62 endfunc 62 endfunc
63 63
64 func! Test_edit_02() 64 func Test_edit_02()
65 " Change cursor position in InsertCharPre command 65 " Change cursor position in InsertCharPre command
66 new 66 new
67 call setline(1, 'abc') 67 call setline(1, 'abc')
68 call cursor(1, 1) 68 call cursor(1, 1)
69 fu! DoIt(...) 69 fu! DoIt(...)
99 au! InsertEnter 99 au! InsertEnter
100 delfu DoIt 100 delfu DoIt
101 bw! 101 bw!
102 endfunc 102 endfunc
103 103
104 func! Test_edit_03() 104 func Test_edit_03()
105 " Change cursor after <c-o> command to end of line 105 " Change cursor after <c-o> command to end of line
106 new 106 new
107 call setline(1, 'abc') 107 call setline(1, 'abc')
108 call cursor(1, 1) 108 call cursor(1, 1)
109 call feedkeys("i\<c-o>$y\<esc>", 'tnix') 109 call feedkeys("i\<c-o>$y\<esc>", 'tnix')
118 call feedkeys("Ad\<c-o>:s/$/efg/\<cr>hij", 'tnix') 118 call feedkeys("Ad\<c-o>:s/$/efg/\<cr>hij", 'tnix')
119 call assert_equal(['hijabcdefg'], getline(1, '$')) 119 call assert_equal(['hijabcdefg'], getline(1, '$'))
120 bw! 120 bw!
121 endfunc 121 endfunc
122 122
123 func! Test_edit_04() 123 func Test_edit_04()
124 " test for :stopinsert 124 " test for :stopinsert
125 new 125 new
126 call setline(1, 'abc') 126 call setline(1, 'abc')
127 call cursor(1, 1) 127 call cursor(1, 1)
128 call feedkeys("i\<c-o>:stopinsert\<cr>$", 'tnix') 128 call feedkeys("i\<c-o>:stopinsert\<cr>$", 'tnix')
130 call assert_equal(['abcX'], getline(1, '$')) 130 call assert_equal(['abcX'], getline(1, '$'))
131 %d 131 %d
132 bw! 132 bw!
133 endfunc 133 endfunc
134 134
135 func! Test_edit_05() 135 func Test_edit_05()
136 " test for folds being opened 136 " test for folds being opened
137 new 137 new
138 call setline(1, ['abcX', 'abcX', 'zzzZ']) 138 call setline(1, ['abcX', 'abcX', 'zzzZ'])
139 call cursor(1, 1) 139 call cursor(1, 1)
140 set foldmethod=manual foldopen+=insert 140 set foldmethod=manual foldopen+=insert
152 call assert_equal(['abcXy', 'abcX', 'zzzZ'], getline(1, '$')) 152 call assert_equal(['abcXy', 'abcX', 'zzzZ'], getline(1, '$'))
153 %d 153 %d
154 bw! 154 bw!
155 endfunc 155 endfunc
156 156
157 func! Test_edit_06() 157 func Test_edit_06()
158 " Test in diff mode 158 " Test in diff mode
159 if !has("diff") || !executable("diff") 159 if !has("diff") || !executable("diff")
160 return 160 return
161 endif 161 endif
162 new 162 new
174 call assert_equal(['abc', 'zzz', 'xxx', 'yyy'], getline(1,'$')) 174 call assert_equal(['abc', 'zzz', 'xxx', 'yyy'], getline(1,'$'))
175 bw! 175 bw!
176 bw! 176 bw!
177 endfunc 177 endfunc
178 178
179 func! Test_edit_07() 179 func Test_edit_07()
180 " 1) Test with completion <c-l> when popupmenu is visible 180 " 1) Test with completion <c-l> when popupmenu is visible
181 new 181 new
182 call setline(1, 'J') 182 call setline(1, 'J')
183 183
184 func! ListMonths() 184 func! ListMonths()
211 delfu DoIt 211 delfu DoIt
212 iunmap <buffer> <f5> 212 iunmap <buffer> <f5>
213 bw! 213 bw!
214 endfunc 214 endfunc
215 215
216 func! Test_edit_08() 216 func Test_edit_08()
217 " reset insertmode from i_ctrl-r_= 217 " reset insertmode from i_ctrl-r_=
218 let g:bufnr = bufnr('%') 218 let g:bufnr = bufnr('%')
219 new 219 new
220 call setline(1, ['abc']) 220 call setline(1, ['abc'])
221 call cursor(1, 4) 221 call cursor(1, 4)
225 call assert_false(0, '&im') 225 call assert_false(0, '&im')
226 bw! 226 bw!
227 unlet g:bufnr 227 unlet g:bufnr
228 endfunc 228 endfunc
229 229
230 func! Test_edit_09() 230 func Test_edit_09()
231 " test i_CTRL-\ combinations 231 " test i_CTRL-\ combinations
232 new 232 new
233 call setline(1, ['abc', 'def', 'ghi']) 233 call setline(1, ['abc', 'def', 'ghi'])
234 call cursor(1, 1) 234 call cursor(1, 1)
235 " 1) CTRL-\ CTLR-N 235 " 1) CTRL-\ CTLR-N
255 call feedkeys("A\<c-\>a", 'txin') 255 call feedkeys("A\<c-\>a", 'txin')
256 call assert_equal(["ABC\<c-\>a", 'ZZZ', 'def', 'ghi'], getline(1, '$')) 256 call assert_equal(["ABC\<c-\>a", 'ZZZ', 'def', 'ghi'], getline(1, '$'))
257 bw! 257 bw!
258 endfunc 258 endfunc
259 259
260 func! Test_edit_10() 260 func Test_edit_10()
261 " Test for starting selectmode 261 " Test for starting selectmode
262 new 262 new
263 set selectmode=key keymodel=startsel 263 set selectmode=key keymodel=startsel
264 call setline(1, ['abc', 'def', 'ghi']) 264 call setline(1, ['abc', 'def', 'ghi'])
265 call cursor(1, 4) 265 call cursor(1, 4)
267 call assert_equal(['startdef', 'ghi'], getline(1, '$')) 267 call assert_equal(['startdef', 'ghi'], getline(1, '$'))
268 set selectmode= keymodel= 268 set selectmode= keymodel=
269 bw! 269 bw!
270 endfunc 270 endfunc
271 271
272 func! Test_edit_11() 272 func Test_edit_11()
273 " Test that indenting kicks in 273 " Test that indenting kicks in
274 new 274 new
275 set cindent 275 set cindent
276 call setline(1, ['{', '', '']) 276 call setline(1, ['{', '', ''])
277 call cursor(2, 1) 277 call cursor(2, 1)
311 set nocindent indentexpr= 311 set nocindent indentexpr=
312 delfu Do_Indent 312 delfu Do_Indent
313 bw! 313 bw!
314 endfunc 314 endfunc
315 315
316 func! Test_edit_11_indentexpr() 316 func Test_edit_11_indentexpr()
317 " Test that indenting kicks in 317 " Test that indenting kicks in
318 new 318 new
319 " Use indentexpr instead of cindenting 319 " Use indentexpr instead of cindenting
320 func! Do_Indent() 320 func! Do_Indent()
321 let pline=prevnonblank(v:lnum) 321 let pline=prevnonblank(v:lnum)
338 set nocindent indentexpr= 338 set nocindent indentexpr=
339 delfu Do_Indent 339 delfu Do_Indent
340 bw! 340 bw!
341 endfunc 341 endfunc
342 342
343 func! Test_edit_12() 343 func Test_edit_12()
344 " Test changing indent in replace mode 344 " Test changing indent in replace mode
345 new 345 new
346 call setline(1, ["\tabc", "\tdef"]) 346 call setline(1, ["\tabc", "\tdef"])
347 call cursor(2, 4) 347 call cursor(2, 4)
348 call feedkeys("R^\<c-d>", 'tnix') 348 call feedkeys("R^\<c-d>", 'tnix')
390 call assert_equal(["\t/*", " *", " */"], getline(1, '$')) 390 call assert_equal(["\t/*", " *", " */"], getline(1, '$'))
391 set formatoptions& 391 set formatoptions&
392 bw! 392 bw!
393 endfunc 393 endfunc
394 394
395 func! Test_edit_13() 395 func Test_edit_13()
396 " Test smartindenting 396 " Test smartindenting
397 if exists("+smartindent") 397 if exists("+smartindent")
398 new 398 new
399 set smartindent autoindent 399 set smartindent autoindent
400 call setline(1, ["\tabc"]) 400 call setline(1, ["\tabc"])
403 set smartindent& autoindent& 403 set smartindent& autoindent&
404 bw! 404 bw!
405 endif 405 endif
406 endfunc 406 endfunc
407 407
408 func! Test_edit_CR() 408 func Test_edit_CR()
409 " Test for <CR> in insert mode 409 " Test for <CR> in insert mode
410 " basically only in quickfix mode ist tested, the rest 410 " basically only in quickfix mode ist tested, the rest
411 " has been taken care of by other tests 411 " has been taken care of by other tests
412 if !has("quickfix") 412 if !has("quickfix")
413 return 413 return
436 bw! 436 bw!
437 lclose 437 lclose
438 call delete('Xqflist.txt') 438 call delete('Xqflist.txt')
439 endfunc 439 endfunc
440 440
441 func! Test_edit_CTRL_() 441 func Test_edit_CTRL_()
442 " disabled for Windows builds, why? 442 " disabled for Windows builds, why?
443 if !has("multi_byte") || !has("rightleft") || has("win32") 443 if !has("multi_byte") || !has("rightleft") || has("win32")
444 return 444 return
445 endif 445 endif
446 let _encoding=&encoding 446 let _encoding=&encoding
467 let &encoding=_encoding 467 let &encoding=_encoding
468 bw! 468 bw!
469 endfunc 469 endfunc
470 470
471 " needs to come first, to have the @. register empty 471 " needs to come first, to have the @. register empty
472 func! Test_edit_00a_CTRL_A() 472 func Test_edit_00a_CTRL_A()
473 " Test pressing CTRL-A 473 " Test pressing CTRL-A
474 new 474 new
475 call setline(1, repeat([''], 5)) 475 call setline(1, repeat([''], 5))
476 call cursor(1, 1) 476 call cursor(1, 1)
477 try 477 try
487 call feedkeys("A\<NUL>and more\<esc>", 'tnix') 487 call feedkeys("A\<NUL>and more\<esc>", 'tnix')
488 call assert_equal(['foobar ', 'foobar more', 'foobar morend more', '', ''], getline(1, '$')) 488 call assert_equal(['foobar ', 'foobar more', 'foobar morend more', '', ''], getline(1, '$'))
489 bw! 489 bw!
490 endfunc 490 endfunc
491 491
492 func! Test_edit_CTRL_EY() 492 func Test_edit_CTRL_EY()
493 " Ctrl-E/ Ctrl-Y in insert mode completion to scroll 493 " Ctrl-E/ Ctrl-Y in insert mode completion to scroll
494 10new 494 10new
495 call setline(1, range(1, 100)) 495 call setline(1, range(1, 100))
496 call cursor(30, 1) 496 call cursor(30, 1)
497 norm! z. 497 norm! z.
503 call assert_equal(21, winsaveview()['topline']) 503 call assert_equal(21, winsaveview()['topline'])
504 call assert_equal([0, 30, 2, 0], getpos('.')) 504 call assert_equal([0, 30, 2, 0], getpos('.'))
505 bw! 505 bw!
506 endfunc 506 endfunc
507 507
508 func! Test_edit_CTRL_G() 508 func Test_edit_CTRL_G()
509 new 509 new
510 call setline(1, ['foobar', 'foobar', 'foobar']) 510 call setline(1, ['foobar', 'foobar', 'foobar'])
511 call cursor(2, 4) 511 call cursor(2, 4)
512 call feedkeys("ioooooooo\<c-g>k\<c-r>.\<esc>", 'tnix') 512 call feedkeys("ioooooooo\<c-g>k\<c-r>.\<esc>", 'tnix')
513 call assert_equal(['foooooooooobar', 'foooooooooobar', 'foobar'], getline(1, '$')) 513 call assert_equal(['foooooooooobar', 'foooooooooobar', 'foobar'], getline(1, '$'))
521 call feedkeys("i\<c-g>j\<esc>", 'tnix') 521 call feedkeys("i\<c-g>j\<esc>", 'tnix')
522 call assert_equal([0, 3, 6, 0], getpos('.')) 522 call assert_equal([0, 3, 6, 0], getpos('.'))
523 bw! 523 bw!
524 endfunc 524 endfunc
525 525
526 func! Test_edit_CTRL_I() 526 func Test_edit_CTRL_I()
527 " Tab in completion mode 527 " Tab in completion mode
528 let path=expand("%:p:h") 528 let path=expand("%:p:h")
529 new 529 new
530 call setline(1, [path. "/", '']) 530 call setline(1, [path. "/", ''])
531 call feedkeys("Arunt\<c-x>\<c-f>\<tab>\<cr>\<esc>", 'tnix') 531 call feedkeys("Arunt\<c-x>\<c-f>\<tab>\<cr>\<esc>", 'tnix')
545 call assert_equal([include, '', ''], getline(1, '$')) 545 call assert_equal([include, '', ''], getline(1, '$'))
546 call delete("Xinclude.txt") 546 call delete("Xinclude.txt")
547 bw! 547 bw!
548 endfunc 548 endfunc
549 549
550 func! Test_edit_CTRL_K() 550 func Test_edit_CTRL_K()
551 " Test pressing CTRL-K (basically only dictionary completion and digraphs 551 " Test pressing CTRL-K (basically only dictionary completion and digraphs
552 " the rest is already covered 552 " the rest is already covered
553 call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt') 553 call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt')
554 set dictionary=Xdictionary.txt 554 set dictionary=Xdictionary.txt
555 new 555 new
618 set noshowcmd 618 set noshowcmd
619 endif 619 endif
620 bw! 620 bw!
621 endfunc 621 endfunc
622 622
623 func! Test_edit_CTRL_L() 623 func Test_edit_CTRL_L()
624 " Test Ctrl-X Ctrl-L (line completion) 624 " Test Ctrl-X Ctrl-L (line completion)
625 new 625 new
626 set complete=. 626 set complete=.
627 call setline(1, ['one', 'two', 'three', '', '', '', '']) 627 call setline(1, ['one', 'two', 'three', '', '', '', ''])
628 call cursor(4, 1) 628 call cursor(4, 1)
674 unlet! g:change 674 unlet! g:change
675 endif 675 endif
676 bw! 676 bw!
677 endfunc 677 endfunc
678 678
679 func! Test_edit_CTRL_N() 679 func Test_edit_CTRL_N()
680 " Check keyword completion 680 " Check keyword completion
681 new 681 new
682 set complete=. 682 set complete=.
683 call setline(1, ['INFER', 'loWER', '', '', ]) 683 call setline(1, ['INFER', 'loWER', '', '', ])
684 call cursor(3, 1) 684 call cursor(3, 1)
695 695
696 set noignorecase noinfercase complete& 696 set noignorecase noinfercase complete&
697 bw! 697 bw!
698 endfunc 698 endfunc
699 699
700 func! Test_edit_CTRL_O() 700 func Test_edit_CTRL_O()
701 " Check for CTRL-O in insert mode 701 " Check for CTRL-O in insert mode
702 new 702 new
703 inoreabbr <buffer> h here some more 703 inoreabbr <buffer> h here some more
704 call setline(1, ['abc', 'def']) 704 call setline(1, ['abc', 'def'])
705 call cursor(1, 1) 705 call cursor(1, 1)
720 set ve= 720 set ve=
721 unlet! g:a 721 unlet! g:a
722 bw! 722 bw!
723 endfunc 723 endfunc
724 724
725 func! Test_edit_CTRL_R() 725 func Test_edit_CTRL_R()
726 " Insert Register 726 " Insert Register
727 new 727 new
728 call test_override("ALL", 1) 728 call test_override("ALL", 1)
729 set showcmd 729 set showcmd
730 call feedkeys("AFOOBAR eins zwei\<esc>", 'tnix') 730 call feedkeys("AFOOBAR eins zwei\<esc>", 'tnix')
735 call test_override("ALL", 0) 735 call test_override("ALL", 0)
736 set noshowcmd 736 set noshowcmd
737 bw! 737 bw!
738 endfunc 738 endfunc
739 739
740 func! Test_edit_CTRL_S() 740 func Test_edit_CTRL_S()
741 " Test pressing CTRL-S (basically only spellfile completion) 741 " Test pressing CTRL-S (basically only spellfile completion)
742 " the rest is already covered 742 " the rest is already covered
743 new 743 new
744 if !has("spell") 744 if !has("spell")
745 call setline(1, 'vim') 745 call setline(1, 'vim')
779 call assert_equal(['', ''], getline(1, '$')) 779 call assert_equal(['', ''], getline(1, '$'))
780 setl nospell 780 setl nospell
781 bw! 781 bw!
782 endfunc 782 endfunc
783 783
784 func! Test_edit_CTRL_T() 784 func Test_edit_CTRL_T()
785 " Check for CTRL-T and CTRL-X CTRL-T in insert mode 785 " Check for CTRL-T and CTRL-X CTRL-T in insert mode
786 " 1) increase indent 786 " 1) increase indent
787 new 787 new
788 call setline(1, "abc") 788 call setline(1, "abc")
789 call cursor(1, 1) 789 call cursor(1, 1)
856 call assert_equal(['mad'], getline(1, '$')) 856 call assert_equal(['mad'], getline(1, '$'))
857 call delete('Xthesaurus') 857 call delete('Xthesaurus')
858 bw! 858 bw!
859 endfunc 859 endfunc
860 860
861 func! Test_edit_CTRL_U() 861 func Test_edit_CTRL_U()
862 " Test 'completefunc' 862 " Test 'completefunc'
863 new 863 new
864 " -1, -2 and -3 are special return values 864 " -1, -2 and -3 are special return values
865 let g:special=0 865 let g:special=0
866 fun! CompleteMonths(findstart, base) 866 fun! CompleteMonths(findstart, base)
915 endtry 915 endtry
916 set completefunc= 916 set completefunc=
917 bw! 917 bw!
918 endfunc 918 endfunc
919 919
920 func! Test_edit_CTRL_Z() 920 func Test_edit_CTRL_Z()
921 " Ctrl-Z when insertmode is not set inserts it literally 921 " Ctrl-Z when insertmode is not set inserts it literally
922 new 922 new
923 call setline(1, 'abc') 923 call setline(1, 'abc')
924 call feedkeys("A\<c-z>\<esc>", 'tnix') 924 call feedkeys("A\<c-z>\<esc>", 'tnix')
925 call assert_equal(["abc\<c-z>"], getline(1,'$')) 925 call assert_equal(["abc\<c-z>"], getline(1,'$'))
926 bw! 926 bw!
927 " TODO: How to Test Ctrl-Z in insert mode, e.g. suspend? 927 " TODO: How to Test Ctrl-Z in insert mode, e.g. suspend?
928 endfunc 928 endfunc
929 929
930 func! Test_edit_DROP() 930 func Test_edit_DROP()
931 if !has("dnd") 931 if !has("dnd")
932 return 932 return
933 endif 933 endif
934 new 934 new
935 call setline(1, ['abc def ghi']) 935 call setline(1, ['abc def ghi'])
941 call assert_true(1, 'error caught') 941 call assert_true(1, 'error caught')
942 endtry 942 endtry
943 bw! 943 bw!
944 endfunc 944 endfunc
945 945
946 func! Test_edit_CTRL_V() 946 func Test_edit_CTRL_V()
947 if has("ebcdic") 947 if has("ebcdic")
948 return 948 return
949 endif 949 endif
950 new 950 new
951 call setline(1, ['abc']) 951 call setline(1, ['abc'])
969 call test_override('ALL', 0) 969 call test_override('ALL', 0)
970 set noshowmode showcmd 970 set noshowmode showcmd
971 bw! 971 bw!
972 endfunc 972 endfunc
973 973
974 func! Test_edit_F1() 974 func Test_edit_F1()
975 " Pressing <f1> 975 " Pressing <f1>
976 new 976 new
977 call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix') 977 call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix')
978 set noinsertmode 978 set noinsertmode
979 call assert_equal('help', &buftype) 979 call assert_equal('help', &buftype)
980 bw 980 bw
981 bw 981 bw
982 endfunc 982 endfunc
983 983
984 func! Test_edit_F21() 984 func Test_edit_F21()
985 " Pressing <f21> 985 " Pressing <f21>
986 " sends a netbeans command 986 " sends a netbeans command
987 if has("netbeans_intg") 987 if has("netbeans_intg")
988 new 988 new
989 " I have no idea what this is supposed to do :) 989 " I have no idea what this is supposed to do :)
990 call feedkeys("A\<F21>\<F1>\<esc>", 'tnix') 990 call feedkeys("A\<F21>\<F1>\<esc>", 'tnix')
991 bw 991 bw
992 endif 992 endif
993 endfunc 993 endfunc
994 994
995 func! Test_edit_HOME_END() 995 func Test_edit_HOME_END()
996 " Test Home/End Keys 996 " Test Home/End Keys
997 new 997 new
998 set foldopen+=hor 998 set foldopen+=hor
999 call setline(1, ['abc', 'def']) 999 call setline(1, ['abc', 'def'])
1000 call cursor(1, 1) 1000 call cursor(1, 1)
1005 1005
1006 set foldopen-=hor 1006 set foldopen-=hor
1007 bw! 1007 bw!
1008 endfunc 1008 endfunc
1009 1009
1010 func! Test_edit_INS() 1010 func Test_edit_INS()
1011 " Test for Pressing <Insert> 1011 " Test for Pressing <Insert>
1012 new 1012 new
1013 call setline(1, ['abc', 'def']) 1013 call setline(1, ['abc', 'def'])
1014 call cursor(1, 1) 1014 call cursor(1, 1)
1015 call feedkeys("i\<Insert>ZYX>", 'tnix') 1015 call feedkeys("i\<Insert>ZYX>", 'tnix')
1019 call feedkeys("i\<Insert>Z\<Insert>YX>", 'tnix') 1019 call feedkeys("i\<Insert>Z\<Insert>YX>", 'tnix')
1020 call assert_equal(['ZYX>bc', 'def'], getline(1, '$')) 1020 call assert_equal(['ZYX>bc', 'def'], getline(1, '$'))
1021 bw! 1021 bw!
1022 endfunc 1022 endfunc
1023 1023
1024 func! Test_edit_LEFT_RIGHT() 1024 func Test_edit_LEFT_RIGHT()
1025 " Left, Shift-Left, Right, Shift-Right 1025 " Left, Shift-Left, Right, Shift-Right
1026 new 1026 new
1027 call setline(1, ['abc def ghi', 'ABC DEF GHI', 'ZZZ YYY XXX']) 1027 call setline(1, ['abc def ghi', 'ABC DEF GHI', 'ZZZ YYY XXX'])
1028 let _ww=&ww 1028 let _ww=&ww
1029 set ww= 1029 set ww=
1066 call assert_equal([0, 3, 1, 0], getpos('.')) 1066 call assert_equal([0, 3, 1, 0], getpos('.'))
1067 let &ww = _ww 1067 let &ww = _ww
1068 bw! 1068 bw!
1069 endfunc 1069 endfunc
1070 1070
1071 func! Test_edit_MOUSE() 1071 func Test_edit_MOUSE()
1072 " This is a simple test, since we not really using the mouse here 1072 " This is a simple test, since we not really using the mouse here
1073 if !has("mouse") 1073 if !has("mouse")
1074 return 1074 return
1075 endif 1075 endif
1076 10new 1076 10new
1121 call assert_equal([0, 2, 20, 0], getpos('.')) 1121 call assert_equal([0, 2, 20, 0], getpos('.'))
1122 set mouse& startofline 1122 set mouse& startofline
1123 bw! 1123 bw!
1124 endfunc 1124 endfunc
1125 1125
1126 func! Test_edit_PAGEUP_PAGEDOWN() 1126 func Test_edit_PAGEUP_PAGEDOWN()
1127 10new 1127 10new
1128 call setline(1, repeat(['abc def ghi'], 30)) 1128 call setline(1, repeat(['abc def ghi'], 30))
1129 call cursor(1, 1) 1129 call cursor(1, 1)
1130 call feedkeys("i\<PageDown>\<esc>", 'tnix') 1130 call feedkeys("i\<PageDown>\<esc>", 'tnix')
1131 call assert_equal([0, 9, 1, 0], getpos('.')) 1131 call assert_equal([0, 9, 1, 0], getpos('.'))
1220 call feedkeys("A\<S-Down>\<esc>", 'tnix') 1220 call feedkeys("A\<S-Down>\<esc>", 'tnix')
1221 call assert_equal([0, 30, 11, 0], getpos('.')) 1221 call assert_equal([0, 30, 11, 0], getpos('.'))
1222 bw! 1222 bw!
1223 endfunc 1223 endfunc
1224 1224
1225 func! Test_edit_forbidden() 1225 func Test_edit_forbidden()
1226 new 1226 new
1227 " 1) edit in the sandbox is not allowed 1227 " 1) edit in the sandbox is not allowed
1228 call setline(1, 'a') 1228 call setline(1, 'a')
1229 com! Sandbox :sandbox call feedkeys("i\<del>\<esc>", 'tnix') 1229 com! Sandbox :sandbox call feedkeys("i\<del>\<esc>", 'tnix')
1230 call assert_fails(':Sandbox', 'E48:') 1230 call assert_fails(':Sandbox', 'E48:')
1280 endtry 1280 endtry
1281 endif 1281 endif
1282 bw! 1282 bw!
1283 endfunc 1283 endfunc
1284 1284
1285 func! Test_edit_rightleft() 1285 func Test_edit_rightleft()
1286 " Cursor in rightleft mode moves differently 1286 " Cursor in rightleft mode moves differently
1287 if !exists("+rightleft") 1287 if !exists("+rightleft")
1288 return 1288 return
1289 endif 1289 endif
1290 call NewWindow(10, 20) 1290 call NewWindow(10, 20)