annotate src/testdir/test_vartabs.vim @ 32721:94f4a488412e v9.0.1683

Updated runtime files Commit: https://github.com/vim/vim/commit/6efb1980336ff324e9c57a4e282530b952fca816 Author: Christian Brabandt <cb@256bit.org> Date: Thu Aug 10 05:44:25 2023 +0200 Updated runtime files This is a collection of various PRs from github that all require a minor patch number: 1) https://github.com/vim/vim/pull/12612 Do not conflate dictionary key with end of block 2) https://github.com/vim/vim/pull/12729: When saving and restoring 'undolevels', the constructs `&undolevels` and `:set undolevels` are problematic. The construct `&undolevels` reads an unpredictable value; it will be the local option value (if one has been set), or the global option value (otherwise), making it unsuitable for saving a value for later restoration. Similarly, if a local option value has been set for 'undolevels', temporarily modifying the option via `:set undolevels` changes the local value as well as the global value, requiring extra work to restore both values. Saving and restoring the option value in one step via the construct `:let &undolevels = &undolevels` appears to make no changes to the 'undolevels' option, but if a local option has been set to a different value than the global option, it has the unintended effect of changing the global 'undolevels' value to the local value. Update the documentation to explain these issues and recommend explicit use of global and local option values when saving and restoring. Update some unit tests to use `g:undolevels`. 3) https://github.com/vim/vim/pull/12702: Problem: Pip requirements files are not recognized. Solution: Add a pattern to match pip requirements files. 4) https://github.com/vim/vim/pull/12688: Add indent file and tests for ABB Rapid 5) https://github.com/vim/vim/pull/12668: Use Lua 5.1 numeric escapes in tests and add to CI Only Lua 5.2+ and LuaJIT understand hexadecimal escapes in strings. Lua 5.1 only supports decimal escapes: > A character in a string can also be specified by its numerical value > using the escape sequence \ddd, where ddd is a sequence of up to three > decimal digits. (Note that if a numerical escape is to be followed by a > digit, it must be expressed using exactly three digits.) Strings in Lua > can contain any 8-bit value, including embedded zeros, which can be > specified as '\0'. To make sure this works with Lua 5.4 and Lua 5.1 change the Vim CI to run with Lua 5.1 as well as Lua 5.4 6) https://github.com/vim/vim/pull/12631: Add hurl filetype detection 7) https://github.com/vim/vim/pull/12573: Problem: Files for haskell persistent library are not recognized Solution: Add pattern persistentmodels for haskell persistent library closes: #12612 closes: #12729 closes: #12702 closes: #12688 closes: #12668 closes: #12631 closes: #12573 Co-authored-by: lacygoill <lacygoill@lacygoill.me> Co-authored-by: Michael Henry <drmikehenry@drmikehenry.com> Co-authored-by: ObserverOfTime <chronobserver@disroot.org> Co-authored-by: KnoP-01 <knosowski@graeffrobotics.de> Co-authored-by: James McCoy <jamessan@jamessan.com> Co-authored-by: Jacob Pfeifer <jacob@pfeifer.dev> Co-authored-by: Borys Lykah <lykahb@fastmail.com>
author Christian Brabandt <cb@256bit.org>
date Thu, 10 Aug 2023 06:30:06 +0200
parents dd203ec9a0e1
children 22c03485f222
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for variable tabstops
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 CheckFeature vartabs
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
6 source view_util.vim
16376
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
7
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
8 func s:compare_lines(expect, actual)
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
9 call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
10 endfunc
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
11
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
12 func Test_vartabs()
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 %d
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 " Test normal operation of tabstops ...
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 set ts=4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call setline(1, join(split('aaaaa', '\zs'), "\t"))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 retab 8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 let expect = "a a\<tab>a a\<tab>a"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " ... and softtabstops
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 set ts=8 sts=6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 exe "norm! Sb\<tab>b\<tab>b\<tab>b\<tab>b"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 let expect = "b b\<tab> b\<tab> b\<tab>b"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " Test variable tabstops.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 set sts=0 vts=4,8,4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 exe "norm! Sc\<tab>c\<tab>c\<tab>c\<tab>c\<tab>c"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 retab 8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 let expect = "c c\<tab> c\<tab>c\<tab>c\<tab>c"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 set et vts=4,8,4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 exe "norm! Sd\<tab>d\<tab>d\<tab>d\<tab>d\<tab>d"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 let expect = "d d d d d d"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 " Changing ts should have no effect if vts is in use.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call cursor(1, 1)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 set ts=6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 exe "norm! Se\<tab>e\<tab>e\<tab>e\<tab>e\<tab>e"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 let expect = "e e e e e e"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 " Clearing vts should revert to using ts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 set vts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 exe "norm! Sf\<tab>f\<tab>f\<tab>f\<tab>f\<tab>f"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 let expect = "f f f f f f"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 " Test variable softtabstops.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 set noet ts=8 vsts=12,2,6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 exe "norm! Sg\<tab>g\<tab>g\<tab>g\<tab>g\<tab>g"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 let expect = "g\<tab> g g\<tab> g\<tab> g\<tab>g"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 " Variable tabstops and softtabstops combined.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 set vsts=6,12,8 vts=4,6,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 exe "norm! Sh\<tab>h\<tab>h\<tab>h\<tab>h"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 let expect = "h\<tab> h\<tab>\<tab>h\<tab>h\<tab>h"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 " Retab with a single value, not using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 set ts=8 sts=0 vts= vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 exe "norm! Si\<tab>i\<tab>i\<tab>i\<tab>i"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 retab 4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 let expect = "i\<tab>\<tab>i\<tab>\<tab>i\<tab>\<tab>i\<tab>\<tab>i"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 " Retab with a single value, using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 set ts=8 sts=0 vts=6 vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 exe "norm! Sj\<tab>j\<tab>j\<tab>j\<tab>j"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 retab 4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 let expect = "j\<tab> j\<tab>\<tab>j\<tab> j\<tab>\<tab>j"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 " Retab with multiple values, not using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 set ts=6 sts=0 vts= vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 exe "norm! Sk\<tab>k\<tab>k\<tab>k\<tab>k\<tab>k"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 retab 4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 let expect = "k\<tab> k\<tab>k k\<tab> k\<tab> k"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 " Retab with multiple values, using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 set ts=8 sts=0 vts=6 vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 exe "norm! Sl\<tab>l\<tab>l\<tab>l\<tab>l\<tab>l"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 retab 4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 let expect = "l\<tab> l\<tab>l l\<tab> l\<tab> l"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
19603
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
94 " Test for 'retab' with vts
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
95 set ts=8 sts=0 vts=5,3,6,2 vsts=
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
96 exe "norm! S l"
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
97 .retab!
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
98 call assert_equal("\t\t\t\tl", getline(1))
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
99
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
100 " Test for 'retab' with same values as vts
19603
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
101 set ts=8 sts=0 vts=5,3,6,2 vsts=
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
102 exe "norm! S l"
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
103 .retab! 5,3,6,2
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
104 call assert_equal("\t\t\t\tl", getline(1))
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
105
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 " Check that global and local values are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 set ts=4 vts=6 sts=8 vsts=10
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 " Check that local values only are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 setlocal ts=5 vts=7 sts=9 vsts=11
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 call assert_equal(&ts, 5)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call assert_equal(&vts, '7')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 call assert_equal(&sts, 9)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 call assert_equal(&vsts, '11')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 " Check that global values only are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 setglobal ts=6 vts=8 sts=10 vsts=12
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 call assert_equal(&ts, 5)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 call assert_equal(&vts, '7')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 call assert_equal(&sts, 9)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 call assert_equal(&vsts, '11')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 call assert_equal(&ts, 6)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 call assert_equal(&vts, '8')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 call assert_equal(&sts, 10)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 call assert_equal(&vsts, '12')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 set ts& vts& sts& vsts& et&
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 endfunc
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148
27543
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
149 func Test_retab_invalid_arg()
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
150 new
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
151 call setline(1, "\ttext")
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
152 retab 0
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
153 call assert_fails("retab -8", 'E487: Argument must be positive')
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
154 call assert_fails("retab 10000", 'E475:')
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
155 call assert_fails("retab 720575940379279360", 'E475:')
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
156 bwipe!
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
157 endfunc
8e8fb566dfa5 patch 8.2.4298: divide by zero with huge tabstop value
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
158
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
159 func Test_vartabs_breakindent()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
160 CheckOption breakindent
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 %d
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 " Test normal operation of tabstops ...
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 set ts=4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 call setline(1, join(split('aaaaa', '\zs'), "\t"))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 retab 8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 let expect = "a a\<tab>a a\<tab>a"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 " ... and softtabstops
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 set ts=8 sts=6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 exe "norm! Sb\<tab>b\<tab>b\<tab>b\<tab>b"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 let expect = "b b\<tab> b\<tab> b\<tab>b"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 " Test variable tabstops.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 set sts=0 vts=4,8,4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 exe "norm! Sc\<tab>c\<tab>c\<tab>c\<tab>c\<tab>c"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 retab 8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 let expect = "c c\<tab> c\<tab>c\<tab>c\<tab>c"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 set et vts=4,8,4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 exe "norm! Sd\<tab>d\<tab>d\<tab>d\<tab>d\<tab>d"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 let expect = "d d d d d d"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 " Changing ts should have no effect if vts is in use.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 call cursor(1, 1)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 set ts=6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 exe "norm! Se\<tab>e\<tab>e\<tab>e\<tab>e\<tab>e"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 let expect = "e e e e e e"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 " Clearing vts should revert to using ts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 set vts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 exe "norm! Sf\<tab>f\<tab>f\<tab>f\<tab>f\<tab>f"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 let expect = "f f f f f f"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 " Test variable softtabstops.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 set noet ts=8 vsts=12,2,6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 exe "norm! Sg\<tab>g\<tab>g\<tab>g\<tab>g\<tab>g"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 let expect = "g\<tab> g g\<tab> g\<tab> g\<tab>g"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 " Variable tabstops and softtabstops combined.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 set vsts=6,12,8 vts=4,6,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 exe "norm! Sh\<tab>h\<tab>h\<tab>h\<tab>h"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 let expect = "h\<tab> h\<tab>\<tab>h\<tab>h\<tab>h"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 " Retab with a single value, not using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 set ts=8 sts=0 vts= vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 exe "norm! Si\<tab>i\<tab>i\<tab>i\<tab>i"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 retab 4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 let expect = "i\<tab>\<tab>i\<tab>\<tab>i\<tab>\<tab>i\<tab>\<tab>i"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 " Retab with a single value, using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 set ts=8 sts=0 vts=6 vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 exe "norm! Sj\<tab>j\<tab>j\<tab>j\<tab>j"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 retab 4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 let expect = "j\<tab> j\<tab>\<tab>j\<tab> j\<tab>\<tab>j"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 " Retab with multiple values, not using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 set ts=6 sts=0 vts= vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 exe "norm! Sk\<tab>k\<tab>k\<tab>k\<tab>k\<tab>k"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 retab 4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 let expect = "k\<tab> k\<tab>k k\<tab> k\<tab> k"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 " Retab with multiple values, using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 set ts=8 sts=0 vts=6 vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 exe "norm! Sl\<tab>l\<tab>l\<tab>l\<tab>l\<tab>l"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 retab 4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 let expect = "l\<tab> l\<tab>l l\<tab> l\<tab> l"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 " Check that global and local values are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 set ts=4 vts=6 sts=8 vsts=10
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 " Check that local values only are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 setlocal ts=5 vts=7 sts=9 vsts=11
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 call assert_equal(&ts, 5)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258 call assert_equal(&vts, '7')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 call assert_equal(&sts, 9)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 call assert_equal(&vsts, '11')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268 " Check that global values only are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 setglobal ts=6 vts=8 sts=10 vsts=12
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270 call assert_equal(&ts, 5)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 call assert_equal(&vts, '7')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 call assert_equal(&sts, 9)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
273 call assert_equal(&vsts, '11')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 call assert_equal(&ts, 6)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 call assert_equal(&vts, '8')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 call assert_equal(&sts, 10)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 call assert_equal(&vsts, '12')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 endfunc
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
283
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
284 func Test_vartabs_linebreak()
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
285 if winwidth(0) < 40
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
286 return
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
287 endif
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
288 new
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
289 40vnew
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
290 %d
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
291 setl linebreak vartabstop=10,20,30,40
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
292 call setline(1, "\tx\tx\tx\tx")
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
293
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
294 let expect = [' x ',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
295 \ 'x x ',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
296 \ 'x ']
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
297 let lines = ScreenLines([1, 3], winwidth(0))
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
298 call s:compare_lines(expect, lines)
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
299 setl list listchars=tab:>-
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
300 let expect = ['>---------x>------------------ ',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
301 \ 'x>------------------x>------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
302 \ 'x ']
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
303 let lines = ScreenLines([1, 3], winwidth(0))
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
304 call s:compare_lines(expect, lines)
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
305 setl linebreak vartabstop=40
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
306 let expect = ['>---------------------------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
307 \ 'x>--------------------------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
308 \ 'x>--------------------------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
309 \ 'x>--------------------------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
310 \ 'x ']
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
311 let lines = ScreenLines([1, 5], winwidth(0))
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
312 call s:compare_lines(expect, lines)
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
313
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
314 " cleanup
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
315 bw!
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
316 bw!
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
317 set nolist listchars&vim
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
318 endfunc
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
319
15062
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
320 func Test_vartabs_shiftwidth()
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
321 "return
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
322 if winwidth(0) < 40
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
323 return
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
324 endif
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
325 new
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
326 40vnew
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
327 %d
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
328 " setl varsofttabstop=10,20,30,40
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
329 setl shiftwidth=0 vartabstop=10,20,30,40
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
330 call setline(1, "x")
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
331
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
332 " Check without any change.
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
333 let expect = ['x ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
334 let lines = ScreenLines(1, winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
335 call s:compare_lines(expect, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
336 " Test 1:
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
337 " shiftwidth depends on the indent, first check with cursor at the end of the
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
338 " line (which is the same as the start of the line, since there is only one
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
339 " character).
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
340 norm! $>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
341 let expect1 = [' x ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
342 let lines = ScreenLines(1, winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
343 call s:compare_lines(expect1, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
344 call assert_equal(10, shiftwidth())
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
345 call assert_equal(10, shiftwidth(1))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
346 call assert_equal(20, shiftwidth(virtcol('.')))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
347 norm! $>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
348 let expect2 = [' x ', '~ ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
349 let lines = ScreenLines([1, 2], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
350 call s:compare_lines(expect2, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
351 call assert_equal(20, shiftwidth(virtcol('.')-2))
18000
7a19c8d6bb9e patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
352 call assert_equal(30, virtcol('.')->shiftwidth())
15062
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
353 norm! $>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
354 let expect3 = [' ', ' x ', '~ ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
355 let lines = ScreenLines([1, 3], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
356 call s:compare_lines(expect3, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
357 call assert_equal(30, shiftwidth(virtcol('.')-2))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
358 call assert_equal(40, shiftwidth(virtcol('.')))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
359 norm! $>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
360 let expect4 = [' ', ' ', ' x ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
361 let lines = ScreenLines([1, 3], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
362 call assert_equal(40, shiftwidth(virtcol('.')))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
363 call s:compare_lines(expect4, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
364
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
365 " Test 2: Put the cursor at the first column, result should be the same
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
366 call setline(1, "x")
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
367 norm! 0>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
368 let lines = ScreenLines(1, winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
369 call s:compare_lines(expect1, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
370 norm! 0>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
371 let lines = ScreenLines([1, 2], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
372 call s:compare_lines(expect2, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
373 norm! 0>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
374 let lines = ScreenLines([1, 3], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
375 call s:compare_lines(expect3, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
376 norm! 0>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
377 let lines = ScreenLines([1, 3], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
378 call s:compare_lines(expect4, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
379
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
380 call assert_fails('call shiftwidth([])', 'E745:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
381
15062
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
382 " cleanup
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
383 bw!
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
384 bw!
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
385 endfunc
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
386
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
387 func Test_vartabs_failures()
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
388 call assert_fails('set vts=8,')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
389 call assert_fails('set vsts=8,')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
390 call assert_fails('set vts=8,,8')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
391 call assert_fails('set vsts=8,,8')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
392 call assert_fails('set vts=8,,8,')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
393 call assert_fails('set vsts=8,,8,')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
394 call assert_fails('set vts=,8')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
395 call assert_fails('set vsts=,8')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
396 endfunc
16376
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
397
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
398 func Test_vartabs_reset()
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
399 set vts=8
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
400 set all&
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
401 call assert_equal('', &vts)
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
402 endfunc
19603
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
403
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
404 func s:SaveCol(l)
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
405 call add(a:l, [col('.'), virtcol('.')])
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
406 return ''
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
407 endfunc
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
408
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
409 " Test for 'varsofttabstop'
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
410 func Test_varsofttabstop()
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
411 new
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
412 inoremap <expr> <F2> s:SaveCol(g:cols)
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
413
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
414 set backspace=indent,eol,start
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
415 set varsofttabstop=6,2,5,3
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
416 let g:cols = []
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
417 call feedkeys("a\t\<F2>\t\<F2>\t\<F2>\t\<F2> ", 'xt')
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
418 call assert_equal("\t\t ", getline(1))
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
419 call assert_equal([[7, 7], [2, 9], [7, 14], [3, 17]], g:cols)
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
420
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
421 let g:cols = []
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
422 call feedkeys("a\<bs>\<F2>\<bs>\<F2>\<bs>\<F2>\<bs>\<F2>\<bs>\<F2>", 'xt')
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
423 call assert_equal('', getline(1))
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
424 call assert_equal([[3, 17], [7, 14], [2, 9], [7, 7], [1, 1]], g:cols)
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
425
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
426 set varsofttabstop&
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
427 set backspace&
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
428 iunmap <F2>
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
429 close!
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
430 endfunc
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
431
24882
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
432 " Setting 'shiftwidth' to a negative value, should set it to either the value
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
433 " of 'tabstop' (if 'vartabstop' is not set) or to the first value in
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
434 " 'vartabstop'
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
435 func Test_shiftwidth_vartabstop()
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
436 setlocal tabstop=7 vartabstop=
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
437 call assert_fails('set shiftwidth=-1', 'E487:')
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
438 call assert_equal(7, &shiftwidth)
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
439 setlocal tabstop=7 vartabstop=5,7,10
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
440 call assert_fails('set shiftwidth=-1', 'E487:')
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
441 call assert_equal(5, &shiftwidth)
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
442 setlocal shiftwidth& vartabstop& tabstop&
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
443 endfunc
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
444
27821
c3b34e4bbe34 patch 8.2.4436: crash with weird 'vartabstop' value
Bram Moolenaar <Bram@vim.org>
parents: 27543
diff changeset
445 func Test_vartabstop_latin1()
c3b34e4bbe34 patch 8.2.4436: crash with weird 'vartabstop' value
Bram Moolenaar <Bram@vim.org>
parents: 27543
diff changeset
446 let save_encoding = &encoding
c3b34e4bbe34 patch 8.2.4436: crash with weird 'vartabstop' value
Bram Moolenaar <Bram@vim.org>
parents: 27543
diff changeset
447 new
27823
6a692e597de5 patch 8.2.4437: vartabs test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 27821
diff changeset
448 set encoding=iso8859-1
27853
dd203ec9a0e1 patch 8.2.4452: test for what 8.2.4436 fixes does not check for regression
Bram Moolenaar <Bram@vim.org>
parents: 27823
diff changeset
449 set compatible linebreak list revins smarttab
27821
c3b34e4bbe34 patch 8.2.4436: crash with weird 'vartabstop' value
Bram Moolenaar <Bram@vim.org>
parents: 27543
diff changeset
450 set vartabstop=400
27823
6a692e597de5 patch 8.2.4437: vartabs test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 27821
diff changeset
451 exe "norm i00\t\<C-D>"
27821
c3b34e4bbe34 patch 8.2.4436: crash with weird 'vartabstop' value
Bram Moolenaar <Bram@vim.org>
parents: 27543
diff changeset
452 bwipe!
c3b34e4bbe34 patch 8.2.4436: crash with weird 'vartabstop' value
Bram Moolenaar <Bram@vim.org>
parents: 27543
diff changeset
453 let &encoding = save_encoding
27853
dd203ec9a0e1 patch 8.2.4452: test for what 8.2.4436 fixes does not check for regression
Bram Moolenaar <Bram@vim.org>
parents: 27823
diff changeset
454 set nocompatible linebreak& list& revins& smarttab& vartabstop&
27821
c3b34e4bbe34 patch 8.2.4436: crash with weird 'vartabstop' value
Bram Moolenaar <Bram@vim.org>
parents: 27543
diff changeset
455 endfunc
c3b34e4bbe34 patch 8.2.4436: crash with weird 'vartabstop' value
Bram Moolenaar <Bram@vim.org>
parents: 27543
diff changeset
456
c3b34e4bbe34 patch 8.2.4436: crash with weird 'vartabstop' value
Bram Moolenaar <Bram@vim.org>
parents: 27543
diff changeset
457
19603
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
458 " vim: shiftwidth=2 sts=2 expandtab