summaryrefslogtreecommitdiff
path: root/src/testdir/test_marks.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-31 15:41:57 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-31 15:41:57 +0200
commitcfb4b47de08e4437c692d382067dc1692cd83c23 (patch)
tree351716a60d481c4bf2b437d095875b2353b7840f /src/testdir/test_marks.vim
parentaaad995f8384a77a64efba6846c9c4ac99de0953 (diff)
downloadvim-git-cfb4b47de08e4437c692d382067dc1692cd83c23.tar.gz
patch 8.2.0861: cannot easily get all the current marksv8.2.0861
Problem: Cannot easily get all the current marks. Solution: Add getmarklist(). (Yegappan Lakshmanan, closes #6032)
Diffstat (limited to 'src/testdir/test_marks.vim')
-rw-r--r--src/testdir/test_marks.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_marks.vim b/src/testdir/test_marks.vim
index fcae2ac13..ffd50a12c 100644
--- a/src/testdir/test_marks.vim
+++ b/src/testdir/test_marks.vim
@@ -259,4 +259,29 @@ func Test_file_mark()
call delete('Xtwo')
endfunc
+" Test for the getmarklist() function
+func Test_getmarklist()
+ new
+ " global marks
+ delmarks A-Z 0-9 \" ^.[]
+ call assert_equal([], getmarklist())
+ call setline(1, ['one', 'two', 'three'])
+ mark A
+ call cursor(3, 5)
+ normal mN
+ call assert_equal([{'file' : '', 'mark' : "'A", 'pos' : [bufnr(), 1, 0, 0]},
+ \ {'file' : '', 'mark' : "'N", 'pos' : [bufnr(), 3, 4, 0]}],
+ \ getmarklist())
+ " buffer local marks
+ delmarks!
+ call assert_equal([{'mark' : "''", 'pos' : [bufnr(), 1, 0, 0]},
+ \ {'mark' : "'\"", 'pos' : [bufnr(), 1, 0, 0]}], getmarklist(bufnr()))
+ call cursor(2, 2)
+ normal mr
+ call assert_equal({'mark' : "'r", 'pos' : [bufnr(), 2, 1, 0]},
+ \ getmarklist(bufnr())[0])
+ call assert_equal([], getmarklist({}))
+ close!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab