0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.1.0687: sentence text object in Visual mode is not tested

Problem:    Sentence text object in Visual mode is not tested.
Solution:   Add a test. (Dominique Pelle, closes #3758)
This commit is contained in:
Bram Moolenaar
2019-01-03 23:10:32 +01:00
parent 5823f84dd0
commit 6d3a1940be
2 changed files with 43 additions and 0 deletions

View File

@@ -273,3 +273,44 @@ func Test_virtual_replace2()
%d_
set bs&vim
endfunc
func Test_Visual_sentence_textobject()
new
call setline(1, ['First sentence. Second sentence. Third', 'sentence. Fouth sentence'])
" When start and end of visual area are identical, 'as' or 'is' select
" the whole sentence.
norm! 1gofdvasy
call assert_equal('Second sentence. ', @")
norm! 1gofdvisy
call assert_equal('Second sentence.', @")
" When start and end of visual area are not identical, 'as' or 'is'
" extend the sentence in direction of the end of the visual area.
norm! 1gofdvlasy
call assert_equal('d sentence. ', @")
norm! gvasy
call assert_equal("d sentence. Third\nsentence. ", @")
norm! 1gofdvlisy
call assert_equal('d sentence.', @")
norm! gvisy
call assert_equal('d sentence. ', @")
norm! gvisy
call assert_equal("d sentence. Third\nsentence.", @")
" Extend visual area in opposite direction.
norm! 1gofdvhasy
call assert_equal(' Second', @")
norm! gvasy
call assert_equal("First sentence. Second", @")
norm! 1gofdvhisy
call assert_equal('Second', @")
norm! gvisy
call assert_equal(' Second', @")
norm! gvisy
call assert_equal('First sentence. Second', @")
bwipe!
endfunc