To: vim_dev@googlegroups.com Subject: Patch 8.1.1841 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1841 Problem: No test for Ex shift commands. Solution: Add a test. (Dominique Pelle, closes #4801) Files: src/testdir/Make_all.mak, src/testdir/test_alot.vim, src/testdir/test_shift.vim *** ../vim-8.1.1840/src/testdir/Make_all.mak 2019-08-11 22:50:53.828345974 +0200 --- src/testdir/Make_all.mak 2019-08-12 14:36:16.082467911 +0200 *************** *** 227,232 **** --- 227,233 ---- test_searchpos \ test_set \ test_sha256 \ + test_shift \ test_shortpathname \ test_signals \ test_signs \ *** ../vim-8.1.1840/src/testdir/test_alot.vim 2019-04-28 18:04:56.062492159 +0200 --- src/testdir/test_alot.vim 2019-08-12 14:30:57.176317214 +0200 *************** *** 52,57 **** --- 52,58 ---- source test_scroll_opt.vim source test_searchpos.vim source test_set.vim + source test_shift.vim source test_sort.vim source test_sha256.vim source test_statusline.vim *** ../vim-8.1.1840/src/testdir/test_shift.vim 2019-08-12 14:36:51.482264735 +0200 --- src/testdir/test_shift.vim 2019-08-12 14:34:05.167246797 +0200 *************** *** 0 **** --- 1,113 ---- + " Test shifting lines with :> and :< + + source check.vim + + func Test_ex_shift_right() + set shiftwidth=2 + + " shift right current line. + call setline(1, range(1, 5)) + 2 + > + 3 + >> + call assert_equal(['1', + \ ' 2', + \ ' 3', + \ '4', + \ '5'], getline(1, '$')) + + " shift right with range. + call setline(1, range(1, 4)) + 2,3>> + call assert_equal(['1', + \ ' 2', + \ ' 3', + \ '4', + \ '5'], getline(1, '$')) + + " shift right with range and count. + call setline(1, range(1, 4)) + 2>3 + call assert_equal(['1', + \ ' 2', + \ ' 3', + \ ' 4', + \ '5'], getline(1, '$')) + + bw! + set shiftwidth& + endfunc + + func Test_ex_shift_left() + set shiftwidth=2 + + call setline(1, range(1, 5)) + %>>> + + " left shift current line. + 2< + 3<< + 4<<<<< + call assert_equal([' 1', + \ ' 2', + \ ' 3', + \ '4', + \ ' 5'], getline(1, '$')) + + " shift right with range. + call setline(1, range(1, 5)) + %>>> + 2,3<< + call assert_equal([' 1', + \ ' 2', + \ ' 3', + \ ' 4', + \ ' 5'], getline(1, '$')) + + " shift right with range and count. + call setline(1, range(1, 5)) + %>>> + 2<<3 + call assert_equal([' 1', + \ ' 2', + \ ' 3', + \ ' 4', + \ ' 5'], getline(1, '$')) + + bw! + set shiftwidth& + endfunc + + func Test_ex_shift_rightleft() + CheckFeature rightleft + + set shiftwidth=2 rightleft + + call setline(1, range(1, 4)) + 2,3<< + call assert_equal(['1', + \ ' 2', + \ ' 3', + \ '4'], getline(1, '$')) + + 3,4> + call assert_equal(['1', + \ ' 2', + \ ' 3', + \ '4'], getline(1, '$')) + + bw! + set rightleft& shiftwidth& + endfunc + + func Test_ex_shift_errors() + call assert_fails('><', 'E488:') + call assert_fails('<>', 'E488:') + + call assert_fails('>!', 'E477:') + call assert_fails('', 'E493:') + call assert_fails('2,1<', 'E493:') + endfunc *** ../vim-8.1.1840/src/version.c 2019-08-12 14:20:30.079043316 +0200 --- src/version.c 2019-08-12 14:32:18.391920227 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1841, /**/ -- hundred-and-one symptoms of being an internet addict: 40. You tell the cab driver you live at http://123.elm.street/house/bluetrim.html 41. You actually try that 123.elm.street address. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///