Mercurial > vim
annotate src/testdir/test_cpoptions.vim @ 26406:fcc57227e99b v8.2.3734
patch 8.2.3734: Vim9: crash when no pattern match found
Commit: https://github.com/vim/vim/commit/01a4dcbceefa99696bd1ef8631c3f7ce9f6e0cc2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 4 13:15:10 2021 +0000
patch 8.2.3734: Vim9: crash when no pattern match found
Problem: Vim9: crash when no pattern match found.
Solution: Check for error.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 Dec 2021 14:30:03 +0100 |
parents | 3cdbce5ba73f |
children | f3804bc56d33 |
rev | line source |
---|---|
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1 " Test for the various 'cpoptions' (cpo) flags |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 source check.vim |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
4 source shared.vim |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 source view_util.vim |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 " Test for the 'a' flag in 'cpo'. Reading a file should set the alternate |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 " file name. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 func Test_cpo_a() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 call writefile(['one'], 'Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 " Wipe out all the buffers, so that the alternate file is empty |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 edit Xfoo | %bw |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 set cpo-=a |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 read Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 call assert_equal('', @#) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 set cpo+=a |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 read Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 call assert_equal('Xfile', @#) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 " Test for the 'A' flag in 'cpo'. Writing a file should set the alternate |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 " file name. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 func Test_cpo_A() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 " Wipe out all the buffers, so that the alternate file is empty |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 edit Xfoo | %bw |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 set cpo-=A |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 new Xfile1 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 write Xfile2 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 call assert_equal('', @#) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 %bw |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 call delete('Xfile2') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 new Xfile1 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 set cpo+=A |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 write Xfile2 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 call assert_equal('Xfile2', @#) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 call delete('Xfile2') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 " Test for the 'b' flag in 'cpo'. "\|" at the end of a map command is |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 " recognized as the end of the map. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 func Test_cpo_b() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 set cpo+=b |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 nnoremap <F5> :pwd\<CR>\|let i = 1 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 call assert_equal(':pwd\<CR>\', maparg('<F5>')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 nunmap <F5> |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 exe "nnoremap <F5> :pwd\<C-V>|let i = 1" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 call assert_equal(':pwd|let i = 1', maparg('<F5>')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 nunmap <F5> |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 set cpo-=b |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 nnoremap <F5> :pwd\<CR>\|let i = 1 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 call assert_equal(':pwd\<CR>|let i = 1', maparg('<F5>')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 nunmap <F5> |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
66 " Test for the 'B' flag in 'cpo'. A backslash in mappings, abbreviations, user |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
67 " commands and menu commands has no special meaning. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
68 func Test_cpo_B() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
69 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
70 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
71 set cpo-=B |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
72 iabbr <buffer> abc ab\<BS>d |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
73 exe "normal iabc " |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
74 call assert_equal('ab<BS>d ', getline(1)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
75 %d |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
76 set cpo+=B |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
77 iabbr <buffer> abc ab\<BS>d |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
78 exe "normal iabc " |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
79 call assert_equal('abd ', getline(1)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
80 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
81 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
82 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
83 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 " Test for the 'c' flag in 'cpo'. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 func Test_cpo_c() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 set cpo+=c |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 call setline(1, ' abababababab') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 exe "normal gg/abab\<CR>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 call assert_equal(3, searchcount().total) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 set cpo-=c |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 exe "normal gg/abab\<CR>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 call assert_equal(5, searchcount().total) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 " Test for the 'C' flag in 'cpo' (line continuation) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 func Test_cpo_C() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 call writefile(['let l = [', '\ 1,', '\ 2]'], 'Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 set cpo-=C |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 source Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 call assert_equal([1, 2], g:l) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 set cpo+=C |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
107 call assert_fails('source Xfile', ['E697:', 'E10:']) |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 " Test for the 'd' flag in 'cpo' (tags relative to the current file) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 func Test_cpo_d() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 call mkdir('Xdir') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 call writefile(["one\tXfile1\t/^one$/"], 'tags') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 call writefile(["two\tXfile2\t/^two$/"], 'Xdir/tags') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 set tags=./tags |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 set cpo-=d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 edit Xdir/Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 call assert_equal('two', taglist('.*')[0].name) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 set cpo+=d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 call assert_equal('one', taglist('.*')[0].name) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 %bw! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 call delete('tags') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 call delete('Xdir', 'rf') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 set tags& |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 " Test for the 'D' flag in 'cpo' (digraph after a r, f or t) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 func Test_cpo_D() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 CheckFeature digraphs |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 set cpo-=D |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 call setline(1, 'abcdefgh|') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 exe "norm! 1gg0f\<c-k>!!" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 call assert_equal(9, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 set cpo+=D |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 exe "norm! 1gg0f\<c-k>!!" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 call assert_equal(1, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 set cpo-=D |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 " Test for the 'e' flag in 'cpo' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 func Test_cpo_e() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 let @a='let i = 45' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 set cpo+=e |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 call feedkeys(":@a\<CR>", 'xt') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 call assert_equal(45, i) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 set cpo-=e |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 call feedkeys(":@a\<CR>6\<CR>", 'xt') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 call assert_equal(456, i) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 " Test for the 'E' flag in 'cpo' with yank, change, delete, etc. operators |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 func Test_cpo_E() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 call setline(1, '') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 set cpo+=E |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 " yank an empty line |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 call assert_beeps('normal "ayl') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 " change an empty line |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 call assert_beeps('normal lcTa') |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
170 call assert_beeps('normal 0c0') |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 " delete an empty line |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 call assert_beeps('normal D') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 call assert_beeps('normal dl') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 call assert_equal('', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 " change case of an empty line |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 call assert_beeps('normal gul') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 call assert_beeps('normal gUl') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 " replace a character |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 call assert_beeps('normal vrx') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 " increment and decrement |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 call assert_beeps('exe "normal v\<C-A>"') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 call assert_beeps('exe "normal v\<C-X>"') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 set cpo-=E |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 " Test for the 'f' flag in 'cpo' (read in an empty buffer sets the file name) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 func Test_cpo_f() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 set cpo-=f |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 read test_cpoptions.vim |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 call assert_equal('', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 set cpo+=f |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 read test_cpoptions.vim |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 call assert_equal('test_cpoptions.vim', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 " Test for the 'F' flag in 'cpo' (write in an empty buffer sets the file name) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 func Test_cpo_F() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 set cpo-=F |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 write Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 call assert_equal('', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 set cpo+=F |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 write Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 call assert_equal('Xfile', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 " Test for the 'g' flag in 'cpo' (jump to line 1 when re-editing a file) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 func Test_cpo_g() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 new test_cpoptions.vim |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 set cpo-=g |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 normal 20G |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 edit |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 call assert_equal(20, line('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 set cpo+=g |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 edit |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 call assert_equal(1, line('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 " Test for inserting text in a line with only spaces ('H' flag in 'cpoptions') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 func Test_cpo_H() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 set cpo-=H |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 call setline(1, ' ') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 normal! Ia |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 call assert_equal(' a', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 set cpo+=H |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 call setline(1, ' ') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 normal! Ia |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 call assert_equal(' a ', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
249 " TODO: Add a test for the 'i' flag in 'cpo' |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
250 " Interrupting the reading of a file will leave it modified. |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
251 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 " Test for the 'I' flag in 'cpo' (deleting autoindent when using arrow keys) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 func Test_cpo_I() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 setlocal autoindent |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 set cpo+=I |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 exe "normal i one\<CR>\<Up>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 call assert_equal(' ', getline(2)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 set cpo-=I |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 exe "normal i one\<CR>\<Up>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 call assert_equal('', getline(2)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
267 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
268 " Test for the 'j' flag in 'cpo' is in the test_join.vim file. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
269 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 " Test for the 'J' flag in 'cpo' (two spaces after a sentence) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 func Test_cpo_J() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 set cpo-=J |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 call setline(1, 'one. two! three? four."'' five.)]') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 normal 0 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 for colnr in [6, 12, 19, 28, 34] |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 normal ) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 call assert_equal(colnr, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 endfor |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 for colnr in [28, 19, 12, 6, 1] |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 normal ( |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 call assert_equal(colnr, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 endfor |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 set cpo+=J |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 normal 0 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 for colnr in [12, 28, 34] |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 normal ) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 call assert_equal(colnr, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 endfor |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 for colnr in [28, 12, 1] |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 normal ( |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 call assert_equal(colnr, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 endfor |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
298 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
299 " TODO: Add a test for the 'k' flag in 'cpo'. |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
300 " Disable the recognition of raw key codes in mappings, abbreviations, and the |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
301 " "to" part of menu commands. |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
302 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
303 " TODO: Add a test for the 'K' flag in 'cpo'. |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
304 " Don't wait for a key code to complete when it is halfway a mapping. |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
305 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
306 " Test for the 'l' flag in 'cpo' (backslash in a [] range) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 func Test_cpo_l() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
308 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
309 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
310 call setline(1, ['', "a\tc" .. '\t']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
311 set cpo-=l |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
312 exe 'normal gg/[\t]' .. "\<CR>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
313 call assert_equal([2, 8], [col('.'), virtcol('.')]) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 set cpo+=l |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
315 exe 'normal gg/[\t]' .. "\<CR>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 call assert_equal([4, 10], [col('.'), virtcol('.')]) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
317 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
318 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
321 " Test for inserting tab in virtual replace mode ('L' flag in 'cpoptions') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 func Test_cpo_L() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 set cpo-=L |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 call setline(1, 'abcdefghijklmnopqr') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 exe "normal 0gR\<Tab>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
328 call assert_equal("\<Tab>ijklmnopqr", getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 set cpo+=L |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 set list |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 call setline(1, 'abcdefghijklmnopqr') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 exe "normal 0gR\<Tab>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
333 call assert_equal("\<Tab>cdefghijklmnopqr", getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 set nolist |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 call setline(1, 'abcdefghijklmnopqr') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
336 exe "normal 0gR\<Tab>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 call assert_equal("\<Tab>ijklmnopqr", getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
340 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
342 " TODO: Add a test for the 'm' flag in 'cpo'. |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
343 " When included, a showmatch will always wait half a second. When not |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
344 " included, a showmatch will wait half a second or until a character is typed. |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
345 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
346 " Test for the 'M' flag in 'cpo' (% with escape parenthesis) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
347 func Test_cpo_M() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
348 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 call setline(1, ['( \( )', '\( ( \)']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
351 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
352 set cpo-=M |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 call cursor(1, 1) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
354 normal % |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
355 call assert_equal(6, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 call cursor(1, 4) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
357 call assert_beeps('normal %') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 call cursor(2, 2) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
359 normal % |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
360 call assert_equal(7, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
361 call cursor(2, 4) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
362 call assert_beeps('normal %') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
363 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
364 set cpo+=M |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
365 call cursor(1, 4) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
366 normal % |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
367 call assert_equal(6, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 call cursor(1, 1) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
369 call assert_beeps('normal %') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
370 call cursor(2, 4) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 normal % |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 call assert_equal(7, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 call cursor(2, 1) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 call assert_beeps('normal %') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
378 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 " Test for the 'n' flag in 'cpo' (using number column for wrapped lines) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 func Test_cpo_n() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
383 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 call setline(1, repeat('a', &columns)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 setlocal number |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 set cpo-=n |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 redraw! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
388 call assert_equal(' aaaa', Screenline(2)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 set cpo+=n |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 redraw! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
391 call assert_equal('aaaa', Screenline(2)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
393 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
396 " Test for the 'o' flag in 'cpo' (line offset to search command) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 func Test_cpo_o() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 call setline(1, ['', 'one', 'two', 'three', 'one', 'two', 'three']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 set cpo-=o |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 exe "normal /one/+2\<CR>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 normal n |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 call assert_equal(7, line('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 set cpo+=o |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 exe "normal /one/+2\<CR>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 normal n |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 call assert_equal(5, line('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
413 " Test for the 'O' flag in 'cpo' (overwriting an existing file) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
414 func Test_cpo_O() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
416 new Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
417 call setline(1, 'one') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
418 call writefile(['two'], 'Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
419 set cpo-=O |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
420 call assert_fails('write', 'E13:') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 set cpo+=O |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
422 write |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
423 call assert_equal(['one'], readfile('Xfile')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
424 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
429 " Test for the 'p' flag in 'cpo' is in the test_lispwords.vim file. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
430 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
431 " Test for the 'P' flag in 'cpo' (appending to a file sets the current file |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 " name) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 func Test_cpo_P() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
435 call writefile([], 'Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
436 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 call setline(1, 'one') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 set cpo+=F |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 set cpo-=P |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 write >> Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 call assert_equal('', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 set cpo+=P |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 write >> Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 call assert_equal('Xfile', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
447 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
448 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
450 " Test for the 'q' flag in 'cpo' (joining multiple lines) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
451 func Test_cpo_q() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 call setline(1, ['one', 'two', 'three', 'four', 'five']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
455 set cpo-=q |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 normal gg4J |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
457 call assert_equal(14, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
458 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
459 call setline(1, ['one', 'two', 'three', 'four', 'five']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
460 set cpo+=q |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
461 normal gg4J |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
462 call assert_equal(4, col('.')) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
463 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
466 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
467 " Test for the 'r' flag in 'cpo' (redo command with a search motion) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 func Test_cpo_r() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
471 call setline(1, repeat(['one two three four'], 2)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 set cpo-=r |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 exe "normal ggc/two\<CR>abc " |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 let @/ = 'three' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 normal 2G. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 call assert_equal('abc two three four', getline(2)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
478 call setline(1, repeat(['one two three four'], 2)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 set cpo+=r |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
480 exe "normal ggc/two\<CR>abc " |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
481 let @/ = 'three' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 normal 2G. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
483 call assert_equal('abc three four', getline(2)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
486 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
488 " Test for the 'R' flag in 'cpo' (clear marks after a filter command) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
489 func Test_cpo_R() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
490 CheckUnix |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
491 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
493 call setline(1, ['three', 'one', 'two']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 set cpo-=R |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 3mark r |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
496 %!sort |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
497 call assert_equal(3, line("'r")) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
498 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
499 call setline(1, ['three', 'one', 'two']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
500 set cpo+=R |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
501 3mark r |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
502 %!sort |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
503 call assert_equal(0, line("'r")) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
508 " TODO: Add a test for the 's' flag in 'cpo'. |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
509 " Set buffer options when entering the buffer for the first time. If not |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
510 " present the options are set when the buffer is created. |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
511 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 " Test for the 'S' flag in 'cpo' (copying buffer options) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 func Test_cpo_S() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 new Xfile1 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 set noautoindent |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 new Xfile2 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 set cpo-=S |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 set autoindent |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 wincmd p |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 call assert_equal(0, &autoindent) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 wincmd p |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 call assert_equal(1, &autoindent) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
524 set cpo+=S |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 wincmd p |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
526 call assert_equal(1, &autoindent) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
527 set noautoindent |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
528 wincmd p |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
529 call assert_equal(0, &autoindent) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
530 wincmd t |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
531 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
532 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
533 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
534 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
535 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
536 " Test for the 't' flag in 'cpo' is in the test_tagjump.vim file. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
537 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 " Test for the 'u' flag in 'cpo' (Vi-compatible undo) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 func Test_cpo_u() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
540 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
541 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 set cpo-=u |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
543 exe "normal iabc\<C-G>udef\<C-G>ughi" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
544 normal uu |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
545 call assert_equal('abc', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
546 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
547 set cpo+=u |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
548 exe "normal iabc\<C-G>udef\<C-G>ughi" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 normal uu |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
550 call assert_equal('abcdefghi', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
554 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
555 " TODO: Add a test for the 'v' flag in 'cpo'. |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
556 " Backspaced characters remain visible on the screen in Insert mode. |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
557 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
558 " Test for the 'w' flag in 'cpo' ('cw' on a blank character changes only one |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
559 " character) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
560 func Test_cpo_w() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
561 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
562 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
563 set cpo+=w |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
564 call setline(1, 'here are some words') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
565 norm! 1gg0elcwZZZ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
566 call assert_equal('hereZZZ are some words', getline('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
567 norm! 1gg2elcWYYY |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
568 call assert_equal('hereZZZ areYYY some words', getline('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
569 set cpo-=w |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
570 call setline(1, 'here are some words') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
571 norm! 1gg0elcwZZZ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
572 call assert_equal('hereZZZare some words', getline('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
573 norm! 1gg2elcWYYY |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
574 call assert_equal('hereZZZare someYYYwords', getline('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
575 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
576 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
577 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
578 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
579 " Test for the 'W' flag in 'cpo' is in the test_writefile.vim file |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
580 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
581 " Test for the 'x' flag in 'cpo' (Esc on command-line executes command) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
582 func Test_cpo_x() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
583 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
584 set cpo-=x |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
585 let i = 1 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
586 call feedkeys(":let i=10\<Esc>", 'xt') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
587 call assert_equal(1, i) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
588 set cpo+=x |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
589 call feedkeys(":let i=10\<Esc>", 'xt') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
590 call assert_equal(10, i) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
591 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
592 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
593 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
594 " Test for the 'X' flag in 'cpo' ('R' with a count) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
595 func Test_cpo_X() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
596 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
597 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
598 call setline(1, 'aaaaaa') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
599 set cpo-=X |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
600 normal gg4Rx |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
601 call assert_equal('xxxxaa', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
602 normal ggRy |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
603 normal 4. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
604 call assert_equal('yyyyaa', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
605 call setline(1, 'aaaaaa') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
606 set cpo+=X |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
607 normal gg4Rx |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
608 call assert_equal('xxxxaaaaa', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
609 normal ggRy |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
610 normal 4. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
611 call assert_equal('yyyyxxxaaaaa', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
612 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
616 " Test for the 'y' flag in 'cpo' (repeating a yank command) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
617 func Test_cpo_y() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
618 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
619 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
620 call setline(1, ['one', 'two']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
621 set cpo-=y |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
622 normal ggyy |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
623 normal 2G. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
624 call assert_equal("one\n", @") |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
625 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
626 call setline(1, ['one', 'two']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
627 set cpo+=y |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
628 normal ggyy |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
629 normal 2G. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
630 call assert_equal("two\n", @") |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
631 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
632 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
633 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
635 " Test for the 'Z' flag in 'cpo' (write! resets 'readonly') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
636 func Test_cpo_Z() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
637 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
638 call writefile([], 'Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
639 new Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
640 setlocal readonly |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
641 set cpo-=Z |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
642 write! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
643 call assert_equal(0, &readonly) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
644 set cpo+=Z |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
645 setlocal readonly |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 write! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
647 call assert_equal(1, &readonly) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
648 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
649 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
650 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
651 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
652 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
653 " Test for the '!' flag in 'cpo' is in the test_normal.vim file |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
655 " Test for displaying dollar when changing text ('$' flag in 'cpoptions') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 func Test_cpo_dollar() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
657 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
658 let g:Line = '' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
659 func SaveFirstLine() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
660 let g:Line = Screenline(1) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
661 return '' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
662 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
663 inoremap <expr> <buffer> <F2> SaveFirstLine() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
664 call test_override('redraw_flag', 1) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 set cpo+=$ |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
666 call setline(1, 'one two three') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
667 redraw! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
668 exe "normal c2w\<F2>vim" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
669 call assert_equal('one tw$ three', g:Line) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
670 call assert_equal('vim three', getline(1)) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 set cpo-=$ |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
672 call test_override('ALL', 0) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 delfunc SaveFirstLine |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 %bw! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
675 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
676 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
677 " Test for the '%' flag in 'cpo' (parenthesis matching inside strings) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
678 func Test_cpo_percent() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
679 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
680 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
681 call setline(1, ' if (strcmp("ab)cd(", s))') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
682 set cpo-=% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
683 normal 8|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
684 call assert_equal(28, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
685 normal 15|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
686 call assert_equal(27, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
687 normal 27|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
688 call assert_equal(15, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
689 call assert_beeps("normal 19|%") |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
690 call assert_beeps("normal 22|%") |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
691 set cpo+=% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
692 normal 8|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
693 call assert_equal(28, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
694 normal 15|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
695 call assert_equal(19, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
696 normal 27|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
697 call assert_equal(22, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
698 normal 19|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
699 call assert_equal(15, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
700 normal 22|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
701 call assert_equal(27, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
702 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
703 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
704 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
705 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
706 " Test for cursor movement with '-' in 'cpoptions' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
707 func Test_cpo_minus() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
708 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
709 call setline(1, ['foo', 'bar', 'baz']) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
710 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
711 set cpo+=- |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
712 call assert_beeps('normal 10j') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
713 call assert_equal(1, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
714 normal G |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
715 call assert_beeps('normal 10k') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
716 call assert_equal(3, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
717 call assert_fails(10, 'E16:') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
718 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
719 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
720 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
721 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
722 " Test for the '+' flag in 'cpo' ('write file' command resets the 'modified' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
723 " flag) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
724 func Test_cpo_plus() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
725 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
726 call writefile([], 'Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
727 new Xfile |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
728 call setline(1, 'foo') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
729 write X1 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
730 call assert_equal(1, &modified) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
731 set cpo+=+ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
732 write X2 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
733 call assert_equal(0, &modified) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
734 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
735 call delete('Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
736 call delete('X1') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
737 call delete('X2') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
738 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
739 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
740 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
741 " Test for the '*' flag in 'cpo' (':*' is same as ':@') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
742 func Test_cpo_star() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
743 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
744 let x = 0 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
745 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
746 set cpo-=* |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
747 let @a = 'let x += 1' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
748 call assert_fails('*a', 'E20:') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
749 set cpo+=* |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
750 *a |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
751 call assert_equal(1, x) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
752 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
753 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
754 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
755 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
756 " Test for the '<' flag in 'cpo' is in the test_mapping.vim file |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
757 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
758 " Test for the '>' flag in 'cpo' (use a new line when appending to a register) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
759 func Test_cpo_gt() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
760 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
761 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
762 call setline(1, 'one two') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
763 set cpo-=> |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
764 let @r = '' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
765 normal gg"Rye |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
766 normal "Rye |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
767 call assert_equal("oneone", @r) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
768 set cpo+=> |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
769 let @r = '' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
770 normal gg"Rye |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
771 normal "Rye |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
772 call assert_equal("\none\none", @r) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
773 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
774 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
775 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
776 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
777 " Test for the ';' flag in 'cpo' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
778 " Test for t,f,F,T movement commands and 'cpo-;' setting |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
779 func Test_cpo_semicolon() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
780 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
781 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
782 call append(0, ["aaa two three four", " zzz", "yyy ", |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
783 \ "bbb yee yoo four", "ccc two three four", |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
784 \ "ddd yee yoo four"]) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
785 set cpo-=; |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
786 1 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
787 normal! 0tt;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
788 2 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
789 normal! 0fz;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
790 3 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
791 normal! $Fy;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
792 4 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
793 normal! $Ty;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
794 set cpo+=; |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
795 5 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
796 normal! 0tt;;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
797 6 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
798 normal! $Ty;;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
799 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
800 call assert_equal('aaa two', getline(1)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
801 call assert_equal(' z', getline(2)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
802 call assert_equal('y', getline(3)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
803 call assert_equal('bbb y', getline(4)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
804 call assert_equal('ccc', getline(5)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
805 call assert_equal('ddd yee y', getline(6)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
806 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
807 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
808 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
809 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
810 " Test for the '#' flag in 'cpo' (count before 'D', 'o' and 'O' operators) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
811 func Test_cpo_hash() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
812 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
813 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
814 set cpo-=# |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
815 call setline(1, ['one', 'two', 'three']) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
816 normal gg2D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
817 call assert_equal(['three'], getline(1, '$')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
818 normal gg2ofour |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
819 call assert_equal(['three', 'four', 'four'], getline(1, '$')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
820 normal gg2Otwo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
821 call assert_equal(['two', 'two', 'three', 'four', 'four'], getline(1, '$')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
822 %d |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
823 set cpo+=# |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
824 call setline(1, ['one', 'two', 'three']) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
825 normal gg2D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
826 call assert_equal(['', 'two', 'three'], getline(1, '$')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
827 normal gg2oone |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
828 call assert_equal(['', 'one', 'two', 'three'], getline(1, '$')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
829 normal gg2Ozero |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
830 call assert_equal(['zero', '', 'one', 'two', 'three'], getline(1, '$')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
831 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
832 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
833 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
834 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
835 " Test for the '&' flag in 'cpo'. The swap file is kept when a buffer is still |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
836 " loaded and ':preserve' is used. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
837 func Test_cpo_ampersand() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
838 call writefile(['one'], 'Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
839 let after =<< trim [CODE] |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
840 set cpo+=& |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
841 preserve |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
842 qall |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
843 [CODE] |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
844 if RunVim([], after, 'Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
845 call assert_equal(1, filereadable('.Xfile.swp')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
846 call delete('.Xfile.swp') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
847 endif |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
848 call delete('Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
849 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
850 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
851 " Test for the '\' flag in 'cpo' (backslash in a [] range in a search pattern) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
852 func Test_cpo_backslash() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
853 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
854 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
855 call setline(1, ['', " \\-string"]) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
856 set cpo-=\ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
857 exe 'normal gg/[ \-]' .. "\<CR>n" |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
858 call assert_equal(3, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
859 set cpo+=\ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
860 exe 'normal gg/[ \-]' .. "\<CR>n" |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
861 call assert_equal(2, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
862 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
863 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
864 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
865 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
866 " Test for the '/' flag in 'cpo' is in the test_substitute.vim file |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
867 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
868 " Test for the '{' flag in 'cpo' (the "{" and "}" commands stop at a { |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
869 " character at the start of a line) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
870 func Test_cpo_brace() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
871 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
872 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
873 call setline(1, ['', '{', ' int i;', '}', '']) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
874 set cpo-={ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
875 normal gg} |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
876 call assert_equal(5, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
877 normal G{ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
878 call assert_equal(1, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
879 set cpo+={ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
880 normal gg} |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
881 call assert_equal(2, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
882 normal G{ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
883 call assert_equal(2, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
884 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
885 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
886 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
887 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
888 " Test for the '.' flag in 'cpo' (:cd command fails if the current buffer is |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
889 " modified) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
890 func Test_cpo_dot() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
891 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
892 new Xfoo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
893 call setline(1, 'foo') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
894 let save_dir = getcwd() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
895 set cpo+=. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
896 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
897 " :cd should fail when buffer is modified and 'cpo' contains dot. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
898 call assert_fails('cd ..', 'E747:') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
899 call assert_equal(save_dir, getcwd()) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
900 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
901 " :cd with exclamation mark should succeed. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
902 cd! .. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
903 call assert_notequal(save_dir, getcwd()) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
904 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
905 " :cd should succeed when buffer has been written. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
906 w! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
907 exe 'cd ' .. fnameescape(save_dir) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
908 call assert_equal(save_dir, getcwd()) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
909 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
910 call delete('Xfoo') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
911 set cpo& |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
912 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
913 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
914 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
915 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
916 " vim: shiftwidth=2 sts=2 expandtab |