comparison src/testdir/test_cmdline.vim @ 13890:3aac8d62351c v8.0.1816

patch 8.0.1816: no test for setcmdpos() commit https://github.com/vim/vim/commit/ff3be4fe1e2e723de48b826cb992c798e296c41e Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 12 13:18:46 2018 +0200 patch 8.0.1816: no test for setcmdpos() Problem: No test for setcmdpos(). Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/2901)
author Christian Brabandt <cb@256bit.org>
date Sat, 12 May 2018 13:30:06 +0200
parents 1f95ec5de238
children c3f9c37160e7
comparison
equal deleted inserted replaced
13889:c50f74ab8035 13890:3aac8d62351c
468 let log = readfile('Xlog') 468 let log = readfile('Xlog')
469 call assert_match("foo\nbar", join(log, "\n")) 469 call assert_match("foo\nbar", join(log, "\n"))
470 call delete('Xlog') 470 call delete('Xlog')
471 endfunc 471 endfunc
472 472
473 func Test_setcmdpos()
474 func InsertTextAtPos(text, pos)
475 call assert_equal(0, setcmdpos(a:pos))
476 return a:text
477 endfunc
478
479 " setcmdpos() with position in the middle of the command line.
480 call feedkeys(":\"12\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt')
481 call assert_equal('"1ab2', @:)
482
483 call feedkeys(":\"12\<C-R>\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt')
484 call assert_equal('"1b2a', @:)
485
486 " setcmdpos() with position beyond the end of the command line.
487 call feedkeys(":\"12\<C-B>\<C-R>=InsertTextAtPos('a', 10)\<CR>b\<CR>", 'xt')
488 call assert_equal('"12ab', @:)
489
490 " setcmdpos() returns 1 when not editing the command line.
491 call assert_equal(1, setcmdpos(3))
492 endfunc
493
473 set cpo& 494 set cpo&