annotate src/testdir/test_marks.vim @ 28817:1ad71fcbf546 v8.2.4932

patch 8.2.4932: not easy to filter the output of maplist() Commit: https://github.com/vim/vim/commit/d8f5f766219273a8579947cc80b92580b6988a4b Author: Ernie Rael <errael@raelity.com> Date: Tue May 10 17:50:39 2022 +0100 patch 8.2.4932: not easy to filter the output of maplist() Problem: Not easy to filter the output of maplist(). Solution: Add mode_bits to the dictionary. (Ernie Rael, closes https://github.com/vim/vim/issues/10356)
author Bram Moolenaar <Bram@vim.org>
date Tue, 10 May 2022 19:00:04 +0200
parents 902aab6dc499
children 14c0d0c72bcd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21403
diff changeset
1 " Test for marks
10068
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Test that a deleted mark is restored after delete-undo-redo-undo.
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14319
diff changeset
4 func Test_Restore_DelMark()
10068
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 enew!
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call append(0, [" textline A", " textline B", " textline C"])
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 normal! 2gg
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 set nocp viminfo+=nviminfo
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 exe "normal! i\<C-G>u\<Esc>"
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 exe "normal! maddu\<C-R>u"
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let pos = getpos("'a")
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call assert_equal(2, pos[1])
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_equal(1, pos[2])
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 enew!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14319
diff changeset
15 endfunc
10068
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " Test that CTRL-A and CTRL-X updates last changed mark '[, '].
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14319
diff changeset
18 func Test_Incr_Marks()
10068
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 enew!
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call append(0, ["123 123 123", "123 123 123", "123 123 123"])
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 normal! gg
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 execute "normal! \<C-A>`[v`]rAjwvjw\<C-X>`[v`]rX"
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_equal("AAA 123 123", getline(1))
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_equal("123 XXXXXXX", getline(2))
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal("XXX 123 123", getline(3))
c577c6a2e88b commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 enew!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14319
diff changeset
27 endfunc
10730
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
28
25998
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
29 func Test_previous_jump_mark()
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
30 new
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
31 call setline(1, ['']->repeat(6))
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
32 normal Ggg
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
33 call assert_equal(6, getpos("''")[1])
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
34 normal jjjjj
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
35 call assert_equal(6, getpos("''")[1])
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
36 bwipe!
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
37 endfunc
902aab6dc499 patch 8.2.3532: the previous '' mark is restored after moving the cursor
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
38
10730
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
39 func Test_setpos()
19121
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
40 new Xone
10730
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
41 let onebuf = bufnr('%')
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
42 let onewin = win_getid()
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
43 call setline(1, ['aaa', 'bbb', 'ccc'])
19121
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
44 new Xtwo
10730
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
45 let twobuf = bufnr('%')
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
46 let twowin = win_getid()
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
47 call setline(1, ['aaa', 'bbb', 'ccc'])
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
48
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
49 " for the cursor the buffer number is ignored
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
50 call setpos(".", [0, 2, 1, 0])
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
51 call assert_equal([0, 2, 1, 0], getpos("."))
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
52 call setpos(".", [onebuf, 3, 3, 0])
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
53 call assert_equal([0, 3, 3, 0], getpos("."))
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
54
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
55 call setpos("''", [0, 1, 3, 0])
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
56 call assert_equal([0, 1, 3, 0], getpos("''"))
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
57 call setpos("''", [onebuf, 2, 2, 0])
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
58 call assert_equal([0, 2, 2, 0], getpos("''"))
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
59
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
60 " buffer-local marks
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
61 for mark in ["'a", "'\"", "'[", "']", "'<", "'>"]
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
62 call win_gotoid(twowin)
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
63 call setpos(mark, [0, 2, 1, 0])
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
64 call assert_equal([0, 2, 1, 0], getpos(mark), "for mark " . mark)
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
65 call setpos(mark, [onebuf, 1, 3, 0])
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
66 call win_gotoid(onewin)
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
67 call assert_equal([0, 1, 3, 0], getpos(mark), "for mark " . mark)
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
68 endfor
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
69
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
70 " global marks
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
71 call win_gotoid(twowin)
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
72 call setpos("'N", [0, 2, 1, 0])
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
73 call assert_equal([twobuf, 2, 1, 0], getpos("'N"))
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
74 call setpos("'N", [onebuf, 1, 3, 0])
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
75 call assert_equal([onebuf, 1, 3, 0], getpos("'N"))
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
76
19121
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
77 " try invalid column and check virtcol()
10730
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
78 call win_gotoid(onewin)
19121
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
79 call setpos("'a", [0, 1, 2, 0])
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
80 call assert_equal([0, 1, 2, 0], getpos("'a"))
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
81 call setpos("'a", [0, 1, -5, 0])
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
82 call assert_equal([0, 1, 2, 0], getpos("'a"))
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
83 call setpos("'a", [0, 1, 0, 0])
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
84 call assert_equal([0, 1, 1, 0], getpos("'a"))
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
85 call setpos("'a", [0, 1, 4, 0])
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
86 call assert_equal([0, 1, 4, 0], getpos("'a"))
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
87 call assert_equal(4, virtcol("'a"))
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
88 call setpos("'a", [0, 1, 5, 0])
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
89 call assert_equal([0, 1, 5, 0], getpos("'a"))
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
90 call assert_equal(4, virtcol("'a"))
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
91 call setpos("'a", [0, 1, 21341234, 0])
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
92 call assert_equal([0, 1, 21341234, 0], getpos("'a"))
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
93 call assert_equal(4, virtcol("'a"))
a51fee786930 patch 8.2.0120: virtcol() does not check arguments to be valid
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
94
19724
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
95 " Test with invalid buffer number, line number and column number
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
96 call cursor(2, 2)
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
97 call setpos('.', [-1, 1, 1, 0])
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
98 call assert_equal([2, 2], [line('.'), col('.')])
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
99 call setpos('.', [0, -1, 1, 0])
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
100 call assert_equal([2, 2], [line('.'), col('.')])
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
101 call setpos('.', [0, 1, -1, 0])
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
102 call assert_equal([2, 2], [line('.'), col('.')])
b3e93a05c3ca patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
103
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
104 call assert_fails("call setpos('ab', [0, 1, 1, 0])", 'E474:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19724
diff changeset
105
10730
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
106 bwipe!
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
107 call win_gotoid(twowin)
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
108 bwipe!
44e9340dc604 patch 8.0.0255: setpos() does not use the buffer argument for all marks
Christian Brabandt <cb@256bit.org>
parents: 10068
diff changeset
109 endfunc
12612
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
110
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
111 func Test_marks_cmd()
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
112 new Xone
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
113 call setline(1, ['aaa', 'bbb'])
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
114 norm! maG$mB
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
115 w!
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
116 new Xtwo
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
117 call setline(1, ['ccc', 'ddd'])
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
118 norm! $mcGmD
21403
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
119 exe "norm! GVgg\<Esc>G"
12612
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
120 w!
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
121
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
122 b Xone
14305
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
123 let a = split(execute('marks'), "\n")
12612
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
124 call assert_equal(9, len(a))
21403
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
125 call assert_equal(['mark line col file/text',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
126 \ " ' 2 0 bbb",
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
127 \ ' a 1 0 aaa',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
128 \ ' B 2 2 bbb',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
129 \ ' D 2 0 Xtwo',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
130 \ ' " 1 0 aaa',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
131 \ ' [ 1 0 aaa',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
132 \ ' ] 2 0 bbb',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
133 \ ' . 2 0 bbb'], a)
12612
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
134
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
135 b Xtwo
14305
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
136 let a = split(execute('marks'), "\n")
21403
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
137 call assert_equal(11, len(a))
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
138 call assert_equal(['mark line col file/text',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
139 \ " ' 1 0 ccc",
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
140 \ ' c 1 2 ccc',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
141 \ ' B 2 2 Xone',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
142 \ ' D 2 0 ddd',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
143 \ ' " 2 0 ddd',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
144 \ ' [ 1 0 ccc',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
145 \ ' ] 2 0 ddd',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
146 \ ' . 2 0 ddd',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
147 \ ' < 1 0 ccc',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
148 \ ' > 2 0 ddd'], a)
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
149 norm! Gdd
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
150 w!
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
151 let a = split(execute('marks <>'), "\n")
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
152 call assert_equal(3, len(a))
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
153 call assert_equal(['mark line col file/text',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
154 \ ' < 1 0 ccc',
d387121083a4 patch 8.2.1252: ":marks" may show '< and '> mixed up
Bram Moolenaar <Bram@vim.org>
parents: 20635
diff changeset
155 \ ' > 2 0 -invalid-'], a)
12612
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
156
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
157 b Xone
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
158 delmarks aB
14305
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
159 let a = split(execute('marks aBcD'), "\n")
12612
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
160 call assert_equal(2, len(a))
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
161 call assert_equal('mark line col file/text', a[0])
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
162 call assert_equal(' D 2 0 Xtwo', a[1])
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
163
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
164 b Xtwo
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
165 delmarks cD
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
166 call assert_fails('marks aBcD', 'E283:')
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
167
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
168 call delete('Xone')
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
169 call delete('Xtwo')
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
170 %bwipe
3b600d16d9cb patch 8.0.1184: the :marks command is not tested
Christian Brabandt <cb@256bit.org>
parents: 10730
diff changeset
171 endfunc
14305
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
172
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
173 func Test_marks_cmd_multibyte()
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
174 new Xone
14319
f7e80dbb4f00 patch 8.1.0175: marks test fails in very wide window
Christian Brabandt <cb@256bit.org>
parents: 14305
diff changeset
175 call setline(1, [repeat('á', &columns)])
14305
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
176 norm! ma
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
177
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
178 let a = split(execute('marks a'), "\n")
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
179 call assert_equal(2, len(a))
14319
f7e80dbb4f00 patch 8.1.0175: marks test fails in very wide window
Christian Brabandt <cb@256bit.org>
parents: 14305
diff changeset
180 let expected = ' a 1 0 ' . repeat('á', &columns - 16)
14305
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
181 call assert_equal(expected, a[1])
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
182
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
183 bwipe!
8a4c0ab88201 patch 8.1.0168: output of :marks is too short with multi-byte chars
Christian Brabandt <cb@256bit.org>
parents: 12612
diff changeset
184 endfunc
15736
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
185
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
186 func Test_delmarks()
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
187 new
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
188 norm mx
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
189 norm `x
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
190 delmarks x
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
191 call assert_fails('norm `x', 'E20:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
192
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
193 " Deleting an already deleted mark should not fail.
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
194 delmarks x
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
195
18979
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
196 " getpos() should return all zeros after deleting a filemark.
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
197 norm mA
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
198 delmarks A
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
199 call assert_equal([0, 0, 0, 0], getpos("'A"))
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
200
15736
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
201 " Test deleting a range of marks.
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
202 norm ma
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
203 norm mb
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
204 norm mc
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
205 norm mz
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
206 delmarks b-z
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
207 norm `a
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
208 call assert_fails('norm `b', 'E20:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
209 call assert_fails('norm `c', 'E20:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
210 call assert_fails('norm `z', 'E20:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
211 call assert_fails('delmarks z-b', 'E475:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
212
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
213 call assert_fails('delmarks', 'E471:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
214 call assert_fails('delmarks /', 'E475:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
215
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
216 " Test delmarks!
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
217 norm mx
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
218 norm `x
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
219 delmarks!
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
220 call assert_fails('norm `x', 'E20:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
221 call assert_fails('delmarks! x', 'E474:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
222
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
223 bwipe!
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
224 endfunc
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
225
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
226 func Test_mark_error()
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
227 call assert_fails('mark', 'E471:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
228 call assert_fails('mark xx', 'E488:')
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
229 call assert_fails('mark _', 'E191:')
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
230 call assert_beeps('normal! m~')
19958
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
231
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
232 call setpos("'k", [0, 100, 1, 0])
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
233 call assert_fails("normal 'k", 'E19:')
15736
6839f99d2269 patch 8.1.0875: not all errors of marks and findfile()/finddir() are tested
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
234 endfunc
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
235
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
236 " Test for :lockmarks when pasting content
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
237 func Test_lockmarks_with_put()
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
238 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
239 call append(0, repeat(['sky is blue'], 4))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
240 normal gg
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
241 1,2yank r
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
242 put r
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
243 normal G
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
244 lockmarks put r
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
245 call assert_equal(2, line("'["))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
246 call assert_equal(3, line("']"))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
247
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
248 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
249 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
250
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19121
diff changeset
251 " Test for :k command to set a mark
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19121
diff changeset
252 func Test_marks_k_cmd()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19121
diff changeset
253 new
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19121
diff changeset
254 call setline(1, ['foo', 'bar', 'baz', 'qux'])
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19121
diff changeset
255 1,3kr
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19121
diff changeset
256 call assert_equal([0, 3, 1, 0], getpos("'r"))
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19121
diff changeset
257 close!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19121
diff changeset
258 endfunc
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19121
diff changeset
259
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
260 " Test for file marks (A-Z)
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
261 func Test_file_mark()
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
262 new Xone
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
263 call setline(1, ['aaa', 'bbb'])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
264 norm! G$mB
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
265 w!
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
266 new Xtwo
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
267 call setline(1, ['ccc', 'ddd'])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
268 norm! GmD
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
269 w!
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
270
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
271 enew
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
272 normal! `B
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
273 call assert_equal('Xone', bufname())
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
274 call assert_equal([2, 3], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
275 normal! 'D
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
276 call assert_equal('Xtwo', bufname())
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
277 call assert_equal([2, 1], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
278
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
279 call delete('Xone')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
280 call delete('Xtwo')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
281 endfunc
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
282
20615
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
283 " Test for the getmarklist() function
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
284 func Test_getmarklist()
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
285 new
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
286 " global marks
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
287 delmarks A-Z 0-9 \" ^.[]
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
288 call assert_equal([], getmarklist())
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
289 call setline(1, ['one', 'two', 'three'])
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
290 mark A
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
291 call cursor(3, 5)
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
292 normal mN
20635
3e36a51ff152 patch 8.2.0871: cannot use getmarklist() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20615
diff changeset
293 call assert_equal([{'file' : '', 'mark' : "'A", 'pos' : [bufnr(), 1, 1, 0]},
3e36a51ff152 patch 8.2.0871: cannot use getmarklist() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20615
diff changeset
294 \ {'file' : '', 'mark' : "'N", 'pos' : [bufnr(), 3, 5, 0]}],
20615
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
295 \ getmarklist())
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
296 " buffer local marks
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
297 delmarks!
20635
3e36a51ff152 patch 8.2.0871: cannot use getmarklist() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20615
diff changeset
298 call assert_equal([{'mark' : "''", 'pos' : [bufnr(), 1, 1, 0]},
3e36a51ff152 patch 8.2.0871: cannot use getmarklist() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20615
diff changeset
299 \ {'mark' : "'\"", 'pos' : [bufnr(), 1, 1, 0]}], getmarklist(bufnr()))
20615
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
300 call cursor(2, 2)
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
301 normal mr
20635
3e36a51ff152 patch 8.2.0871: cannot use getmarklist() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20615
diff changeset
302 call assert_equal({'mark' : "'r", 'pos' : [bufnr(), 2, 2, 0]},
3e36a51ff152 patch 8.2.0871: cannot use getmarklist() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20615
diff changeset
303 \ bufnr()->getmarklist()[0])
3e36a51ff152 patch 8.2.0871: cannot use getmarklist() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20615
diff changeset
304 call assert_equal([], {}->getmarklist())
20615
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
305 close!
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
306 endfunc
8eed1e9389bb patch 8.2.0861: cannot easily get all the current marks
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
307
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 15736
diff changeset
308 " vim: shiftwidth=2 sts=2 expandtab