annotate src/testdir/test_cpoptions.vim @ 35056:79c73c4b3ecb

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