annotate src/testdir/test_cursor_func.vim @ 7590:4d9814f9fc39

commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 15 15:56:58 2016 +0100 Add missing test file.
author Christian Brabandt <cb@256bit.org>
date Fri, 15 Jan 2016 16:00:06 +0100
parents
children 26f555e9aab1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7590
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for cursor().
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_wrong_arguments()
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 try
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 call cursor(1. 3)
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " not reached
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 call assert_false(1)
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 catch
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call assert_exception('E474:')
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endtry
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 endfunc
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 func Test_move_cursor()
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 new
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call setline(1, ['aaa', 'bbb', 'ccc', 'ddd'])
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call cursor([1, 1, 0, 1])
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call assert_equal([1, 1, 0, 1], getcurpos()[1:])
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call cursor([4, 3, 0, 3])
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call assert_equal([4, 3, 0, 3], getcurpos()[1:])
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call cursor(2, 2)
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_equal([2, 2, 0, 3], getcurpos()[1:])
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " line number zero keeps the line number
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call cursor(0, 1)
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_equal([2, 1, 0, 3], getcurpos()[1:])
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " col number zero keeps the column
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call cursor(3, 0)
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call assert_equal([3, 1, 0, 3], getcurpos()[1:])
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " below last line goes to last line
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call cursor(9, 1)
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal([4, 1, 0, 3], getcurpos()[1:])
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 quit!
4d9814f9fc39 commit https://github.com/vim/vim/commit/5a46a58eb6e50cb5204909cc2202e3400761263f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 endfunc