annotate src/testdir/test_cpoptions.vim @ 20848:d3fa0d29fa9a v8.2.0976

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