Mercurial > vim
annotate src/testdir/test_cpoptions.vim @ 22502:1503ecd54f8a v8.2.1799
patch 8.2.1799: some Normal mode commands not fully tested
Commit: https://github.com/vim/vim/commit/d1ad99b65470d3e754f6a0588a6b0dc2214a1eab
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 4 16:16:54 2020 +0200
patch 8.2.1799: some Normal mode commands not fully tested
Problem: Some Normal mode commands not fully tested.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/7073)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 04 Oct 2020 16:30:03 +0200 |
parents | 6a4806e326dd |
children | 3cdbce5ba73f |
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') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 " delete an empty line |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 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
|
172 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
|
173 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
|
174 " 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
|
175 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
|
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 " replace a character |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 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
|
179 " increment and decrement |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 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
|
181 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
|
182 set cpo-=E |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 " 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
|
187 func Test_cpo_f() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 set cpo-=f |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 read test_cpoptions.vim |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 call assert_equal('', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 set cpo+=f |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 read test_cpoptions.vim |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 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
|
197 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 " 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
|
202 func Test_cpo_F() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 set cpo-=F |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 write Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 call assert_equal('', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 set cpo+=F |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 write Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 call assert_equal('Xfile', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 " 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
|
218 func Test_cpo_g() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 new test_cpoptions.vim |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 set cpo-=g |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 normal 20G |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 edit |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 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
|
225 set cpo+=g |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 edit |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 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
|
228 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 " 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
|
233 func Test_cpo_H() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 set cpo-=H |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 call setline(1, ' ') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 normal! Ia |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 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
|
240 set cpo+=H |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 call setline(1, ' ') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 normal! Ia |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 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
|
244 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
248 " 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
|
249 " 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
|
250 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 " 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
|
252 func Test_cpo_I() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 setlocal autoindent |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 set cpo+=I |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 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
|
258 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
|
259 set cpo-=I |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 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
|
262 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
|
263 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
267 " 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
|
268 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 " 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
|
270 func Test_cpo_J() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 set cpo-=J |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 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
|
275 normal 0 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 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
|
277 normal ) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 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
|
279 endfor |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 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
|
281 normal ( |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 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
|
283 endfor |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 set cpo+=J |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 normal 0 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 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
|
287 normal ) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 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
|
289 endfor |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 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
|
291 normal ( |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 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
|
293 endfor |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
298 " 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
|
299 " 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
|
300 " "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
|
301 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
302 " 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
|
303 " 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
|
304 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
305 " 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
|
306 func Test_cpo_l() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
308 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
309 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
|
310 set cpo-=l |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
311 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
|
312 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
|
313 set cpo+=l |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 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
|
315 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
|
316 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
317 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
318 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 " 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
|
321 func Test_cpo_L() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 set cpo-=L |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 call setline(1, 'abcdefghijklmnopqr') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 exe "normal 0gR\<Tab>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 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
|
328 set cpo+=L |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 set list |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 call setline(1, 'abcdefghijklmnopqr') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 exe "normal 0gR\<Tab>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 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
|
333 set nolist |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 call setline(1, 'abcdefghijklmnopqr') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 exe "normal 0gR\<Tab>" |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
336 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
|
337 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
340 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
341 " 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
|
342 " 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
|
343 " 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
|
344 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
345 " 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
|
346 func Test_cpo_M() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
347 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
348 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 call setline(1, ['( \( )', '\( ( \)']) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
351 set cpo-=M |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
352 call cursor(1, 1) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 normal % |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
354 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
|
355 call cursor(1, 4) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 call assert_beeps('normal %') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
357 call cursor(2, 2) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 normal % |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
359 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
|
360 call cursor(2, 4) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
361 call assert_beeps('normal %') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
362 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
363 set cpo+=M |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
364 call cursor(1, 4) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
365 normal % |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
366 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
|
367 call cursor(1, 1) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 call assert_beeps('normal %') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
369 call cursor(2, 4) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
370 normal % |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 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
|
372 call cursor(2, 1) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 call assert_beeps('normal %') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
378 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 " 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
|
380 func Test_cpo_n() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
383 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
|
384 setlocal number |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 set cpo-=n |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 redraw! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 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
|
388 set cpo+=n |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 redraw! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 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
|
391 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
393 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 " 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
|
396 func Test_cpo_o() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 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
|
400 set cpo-=o |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 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
|
402 normal n |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 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
|
404 set cpo+=o |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 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
|
406 normal n |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 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
|
408 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 " 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
|
413 func Test_cpo_O() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
414 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 new Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
416 call setline(1, 'one') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
417 call writefile(['two'], 'Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
418 set cpo-=O |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
419 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
|
420 set cpo+=O |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 write |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
422 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
|
423 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
424 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
428 " 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
|
429 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 " 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
|
431 " name) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 func Test_cpo_P() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 call writefile([], 'Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
435 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
436 call setline(1, 'one') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 set cpo+=F |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 set cpo-=P |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 write >> Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 call assert_equal('', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 set cpo+=P |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 write >> Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 call assert_equal('Xfile', @%) |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
447 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
448 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 " 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
|
450 func Test_cpo_q() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
451 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 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
|
454 set cpo-=q |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
455 normal gg4J |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 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
|
457 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
458 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
|
459 set cpo+=q |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
460 normal gg4J |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
461 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
|
462 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
463 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
466 " 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
|
467 func Test_cpo_r() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 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
|
471 set cpo-=r |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 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
|
473 let @/ = 'three' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 normal 2G. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 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
|
476 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 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
|
478 set cpo+=r |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 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
|
480 let @/ = 'three' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
481 normal 2G. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 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
|
483 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
486 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 " 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
|
488 func Test_cpo_R() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
489 CheckUnix |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
490 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
491 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 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
|
493 set cpo-=R |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 3mark r |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 %!sort |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
496 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
|
497 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
498 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
|
499 set cpo+=R |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
500 3mark r |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
501 %!sort |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
502 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
|
503 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
507 " 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
|
508 " 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
|
509 " 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
|
510 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 " 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
|
512 func Test_cpo_S() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 new Xfile1 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 set noautoindent |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 new Xfile2 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 set cpo-=S |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 set autoindent |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 wincmd p |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 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
|
521 wincmd p |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 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
|
523 set cpo+=S |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
524 wincmd p |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 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
|
526 set noautoindent |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
527 wincmd p |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
528 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
|
529 wincmd t |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
530 close! |
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 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
533 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
534 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
535 " 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
|
536 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
537 " 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
|
538 func Test_cpo_u() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
540 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
541 set cpo-=u |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 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
|
543 normal uu |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
544 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
|
545 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
546 set cpo+=u |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
547 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
|
548 normal uu |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 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
|
550 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
554 " 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
|
555 " 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
|
556 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
557 " 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
|
558 " character) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
559 func Test_cpo_w() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
560 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
561 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
562 set cpo+=w |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
563 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
|
564 norm! 1gg0elcwZZZ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
565 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
|
566 norm! 1gg2elcWYYY |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
567 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
|
568 set cpo-=w |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
569 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
|
570 norm! 1gg0elcwZZZ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
571 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
|
572 norm! 1gg2elcWYYY |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
573 call assert_equal('hereZZZare someYYYwords', getline('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
574 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
575 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
576 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
577 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
578 " 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
|
579 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
580 " 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
|
581 func Test_cpo_x() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
582 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
583 set cpo-=x |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
584 let i = 1 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
585 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
|
586 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
|
587 set cpo+=x |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
588 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
|
589 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
|
590 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
591 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
592 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
593 " 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
|
594 func Test_cpo_X() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
595 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
596 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
597 call setline(1, 'aaaaaa') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
598 set cpo-=X |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
599 normal gg4Rx |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
600 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
|
601 normal ggRy |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
602 normal 4. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
603 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
|
604 call setline(1, 'aaaaaa') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
605 set cpo+=X |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
606 normal gg4Rx |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
607 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
|
608 normal ggRy |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
609 normal 4. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
610 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
|
611 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
612 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 " 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
|
616 func Test_cpo_y() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
617 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
618 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
619 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
|
620 set cpo-=y |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
621 normal ggyy |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
622 normal 2G. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
623 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
|
624 %d |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
625 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
|
626 set cpo+=y |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
627 normal ggyy |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
628 normal 2G. |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
629 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
|
630 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
631 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
632 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
633 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 " 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
|
635 func Test_cpo_Z() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
636 let save_cpo = &cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
637 call writefile([], 'Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
638 new Xfile |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
639 setlocal readonly |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
640 set cpo-=Z |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
641 write! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
642 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
|
643 set cpo+=Z |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
644 setlocal readonly |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
645 write! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 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
|
647 close! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
648 call delete('Xfile') |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
649 let &cpo = save_cpo |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
650 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
651 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
652 " 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
|
653 |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 " 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
|
655 func Test_cpo_dollar() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 new |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
657 let g:Line = '' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
658 func SaveFirstLine() |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
659 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
|
660 return '' |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
661 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
662 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
|
663 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
|
664 set cpo+=$ |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 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
|
666 redraw! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
667 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
|
668 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
|
669 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
|
670 set cpo-=$ |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 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
|
672 delfunc SaveFirstLine |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 %bw! |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 endfunc |
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
675 |
20848
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
676 " 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
|
677 func Test_cpo_percent() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
678 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
679 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
680 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
|
681 set cpo-=% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
682 normal 8|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
683 call assert_equal(28, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
684 normal 15|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
685 call assert_equal(27, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
686 normal 27|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
687 call assert_equal(15, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
688 call assert_beeps("normal 19|%") |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
689 call assert_beeps("normal 22|%") |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
690 set cpo+=% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
691 normal 8|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
692 call assert_equal(28, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
693 normal 15|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
694 call assert_equal(19, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
695 normal 27|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
696 call assert_equal(22, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
697 normal 19|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
698 call assert_equal(15, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
699 normal 22|% |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
700 call assert_equal(27, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
701 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
702 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
703 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
704 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
705 " 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
|
706 func Test_cpo_minus() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
707 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
708 call setline(1, ['foo', 'bar', 'baz']) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
709 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
710 set cpo+=- |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
711 call assert_beeps('normal 10j') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
712 call assert_equal(1, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
713 normal G |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
714 call assert_beeps('normal 10k') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
715 call assert_equal(3, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
716 call assert_fails(10, 'E16:') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
717 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
718 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
719 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
720 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
721 " 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
|
722 " flag) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
723 func Test_cpo_plus() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
724 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
725 call writefile([], 'Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
726 new Xfile |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
727 call setline(1, 'foo') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
728 write X1 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
729 call assert_equal(1, &modified) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
730 set cpo+=+ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
731 write X2 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
732 call assert_equal(0, &modified) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
733 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
734 call delete('Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
735 call delete('X1') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
736 call delete('X2') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
737 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
738 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
739 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
740 " 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
|
741 func Test_cpo_star() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
742 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
743 let x = 0 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
744 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
745 set cpo-=* |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
746 let @a = 'let x += 1' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
747 call assert_fails('*a', 'E20:') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
748 set cpo+=* |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
749 *a |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
750 call assert_equal(1, x) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
751 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
752 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
753 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
754 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
755 " 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
|
756 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
757 " 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
|
758 func Test_cpo_gt() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
759 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
760 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
761 call setline(1, 'one two') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
762 set cpo-=> |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
763 let @r = '' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
764 normal gg"Rye |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
765 normal "Rye |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
766 call assert_equal("oneone", @r) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
767 set cpo+=> |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
768 let @r = '' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
769 normal gg"Rye |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
770 normal "Rye |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
771 call assert_equal("\none\none", @r) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
772 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
773 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
774 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
775 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
776 " Test for the ';' flag in 'cpo' |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
777 " 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
|
778 func Test_cpo_semicolon() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
779 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
780 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
781 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
|
782 \ "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
|
783 \ "ddd yee yoo four"]) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
784 set cpo-=; |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
785 1 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
786 normal! 0tt;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
787 2 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
788 normal! 0fz;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
789 3 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
790 normal! $Fy;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
791 4 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
792 normal! $Ty;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
793 set cpo+=; |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
794 5 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
795 normal! 0tt;;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
796 6 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
797 normal! $Ty;;D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
798 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
799 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
|
800 call assert_equal(' z', getline(2)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
801 call assert_equal('y', getline(3)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
802 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
|
803 call assert_equal('ccc', getline(5)) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
804 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
|
805 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
806 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
807 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
808 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
809 " 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
|
810 func Test_cpo_hash() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
811 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
812 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
813 set cpo-=# |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
814 call setline(1, ['one', 'two', 'three']) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
815 normal gg2D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
816 call assert_equal(['three'], getline(1, '$')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
817 normal gg2ofour |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
818 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
|
819 normal gg2Otwo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
820 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
|
821 %d |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
822 set cpo+=# |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
823 call setline(1, ['one', 'two', 'three']) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
824 normal gg2D |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
825 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
|
826 normal gg2oone |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
827 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
|
828 normal gg2Ozero |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
829 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
|
830 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
831 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
832 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
833 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
834 " 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
|
835 " loaded and ':preserve' is used. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
836 func Test_cpo_ampersand() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
837 call writefile(['one'], 'Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
838 let after =<< trim [CODE] |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
839 set cpo+=& |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
840 preserve |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
841 qall |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
842 [CODE] |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
843 if RunVim([], after, 'Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
844 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
|
845 call delete('.Xfile.swp') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
846 endif |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
847 call delete('Xfile') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
848 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
849 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
850 " 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
|
851 func Test_cpo_backslash() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
852 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
853 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
854 call setline(1, ['', " \\-string"]) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
855 set cpo-=\ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
856 exe 'normal gg/[ \-]' .. "\<CR>n" |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
857 call assert_equal(3, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
858 set cpo+=\ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
859 exe 'normal gg/[ \-]' .. "\<CR>n" |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
860 call assert_equal(2, col('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
861 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
862 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
863 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
864 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
865 " 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
|
866 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
867 " 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
|
868 " 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
|
869 func Test_cpo_brace() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
870 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
871 new |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
872 call setline(1, ['', '{', ' int i;', '}', '']) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
873 set cpo-={ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
874 normal gg} |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
875 call assert_equal(5, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
876 normal G{ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
877 call assert_equal(1, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
878 set cpo+={ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
879 normal gg} |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
880 call assert_equal(2, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
881 normal G{ |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
882 call assert_equal(2, line('.')) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
883 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
884 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
885 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
886 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
887 " 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
|
888 " modified) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
889 func Test_cpo_dot() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
890 let save_cpo = &cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
891 new Xfoo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
892 call setline(1, 'foo') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
893 let save_dir = getcwd() |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
894 set cpo+=. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
895 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
896 " :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
|
897 call assert_fails('cd ..', 'E747:') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
898 call assert_equal(save_dir, getcwd()) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
899 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
900 " :cd with exclamation mark should succeed. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
901 cd! .. |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
902 call assert_notequal(save_dir, getcwd()) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
903 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
904 " :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
|
905 w! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
906 exe 'cd ' .. fnameescape(save_dir) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
907 call assert_equal(save_dir, getcwd()) |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
908 |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
909 call delete('Xfoo') |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
910 set cpo& |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
911 close! |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
912 let &cpo = save_cpo |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
913 endfunc |
d3fa0d29fa9a
patch 8.2.0976: some 'cpoptions' not tested
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
914 |
20832
045442aa392b
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
915 " vim: shiftwidth=2 sts=2 expandtab |