summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-12 13:18:46 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-12 13:18:46 +0200
commitff3be4fe1e2e723de48b826cb992c798e296c41e (patch)
treef421f7e83449b0c95330d0d7d2a8367d6f59a1f3
parent0cb8ac71ae42f66d525ad855db01361ca38d935a (diff)
downloadvim-git-8.0.1816.tar.gz
patch 8.0.1816: no test for setcmdpos()v8.0.1816
Problem: No test for setcmdpos(). Solution: Add a test. (Dominique Pelle, closes #2901)
-rw-r--r--src/testdir/test_cmdline.vim21
-rw-r--r--src/version.c2
2 files changed, 23 insertions, 0 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index a79f2761c..473c35dcf 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -470,4 +470,25 @@ func Test_verbosefile()
call delete('Xlog')
endfunc
+func Test_setcmdpos()
+ func InsertTextAtPos(text, pos)
+ call assert_equal(0, setcmdpos(a:pos))
+ return a:text
+ endfunc
+
+ " setcmdpos() with position in the middle of the command line.
+ call feedkeys(":\"12\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt')
+ call assert_equal('"1ab2', @:)
+
+ call feedkeys(":\"12\<C-R>\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt')
+ call assert_equal('"1b2a', @:)
+
+ " setcmdpos() with position beyond the end of the command line.
+ call feedkeys(":\"12\<C-B>\<C-R>=InsertTextAtPos('a', 10)\<CR>b\<CR>", 'xt')
+ call assert_equal('"12ab', @:)
+
+ " setcmdpos() returns 1 when not editing the command line.
+ call assert_equal(1, setcmdpos(3))
+endfunc
+
set cpo&
diff --git a/src/version.c b/src/version.c
index 6346e6217..f94090fb4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1816,
+/**/
1815,
/**/
1814,