Patch 8.2.2916
Problem: Operators are not fully tested.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes #8290)
Files: src/ops.c, src/testdir/test_netbeans.vim,
src/testdir/test_normal.vim, src/testdir/test_visual.vim
*** ../vim-8.2.2915/src/ops.c 2021-05-18 21:46:27.712961269 +0200
--- src/ops.c 2021-05-31 19:19:18.579926605 +0200
***************
*** 2383,2391 ****
#ifdef FEAT_NETBEANS_INTG
if (netbeans_active() && one_change)
{
! char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
netbeans_removed(curbuf, pos.lnum, pos.col, (long)length);
netbeans_inserted(curbuf, pos.lnum, pos.col,
&ptr[pos.col], length);
}
--- 2383,2392 ----
#ifdef FEAT_NETBEANS_INTG
if (netbeans_active() && one_change)
{
! char_u *ptr;
netbeans_removed(curbuf, pos.lnum, pos.col, (long)length);
+ ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
netbeans_inserted(curbuf, pos.lnum, pos.col,
&ptr[pos.col], length);
}
*** ../vim-8.2.2915/src/testdir/test_netbeans.vim 2020-12-18
19:49:52.345571854 +0100
--- src/testdir/test_netbeans.vim 2021-05-31 19:19:18.579926605 +0200
***************
*** 367,372 ****
--- 367,412 ----
call assert_match('2:insert=\d\+ 26 "\t"', l[-1])
let g:last += 18
+ " Test for changing case of multiple lines using ~
+ normal ggVG~
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 6)')
+ let l = ReadXnetbeans()
+ call assert_match('2:remove=\d\+ 0 8', l[-6])
+ call assert_match('2:insert=\d\+ 0 "FOO BAR2"', l[-5])
+ call assert_match('2:remove=\d\+ 9 8', l[-4])
+ call assert_match('2:insert=\d\+ 9 "BLUE SKy"', l[-3])
+ call assert_match('2:remove=\d\+ 18 9', l[-2])
+ call assert_match('2:insert=\d\+ 18 "\tFOO BAR3"', l[-1])
+ let g:last += 6
+
+ " Test for changing case of a visual block using ~
+ exe "normal ggw\<C-V>$~"
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 2)')
+ let l = ReadXnetbeans()
+ call assert_match('2:remove=\d\+ 4 4', l[-2])
+ call assert_match('2:insert=\d\+ 4 "bar2"', l[-1])
+ let g:last += 2
+
+ " Increment a number using <C-A> in visual mode
+ exe "normal! gg$v6\<C-A>"
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 6)')
+ let l = ReadXnetbeans()
+ call assert_match('2:remove=\d\+ 0 9', l[-4])
+ call assert_match('2:insert=\d\+ 0 "FOO bar8"', l[-3])
+ call assert_match('2:remove=\d\+ 7 1', l[-2])
+ call assert_match('2:insert=\d\+ 7 "8"', l[-1])
+ let g:last += 6
+
+ " Decrement a number using <C-X> in visual mode
+ exe "normal! gg$v3\<C-X>"
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 6)')
+ let l = ReadXnetbeans()
+ call assert_match('2:remove=\d\+ 0 9', l[-4])
+ call assert_match('2:insert=\d\+ 0 "FOO bar5"', l[-3])
+ call assert_match('2:remove=\d\+ 7 1', l[-2])
+ call assert_match('2:insert=\d\+ 7 "5"', l[-1])
+ let g:last += 6
+
" stopDocumentListen test
call appendbufline(cmdbufnr, '$', 'stopDocumentListen_Test')
call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
*** ../vim-8.2.2915/src/testdir/test_normal.vim 2021-05-30 22:17:21.035457554
+0200
--- src/testdir/test_normal.vim 2021-05-31 19:19:18.579926605 +0200
***************
*** 3377,3380 ****
--- 3377,3410 ----
bw!
endfunc
+ " Some commands like yy, cc, dd, >>, << and !! accept a count after
+ " typing the first letter of the command.
+ func Test_normal_count_after_operator()
+ new
+ setlocal shiftwidth=4 tabstop=8 autoindent
+ call setline(1, ['one', 'two', 'three', 'four', 'five'])
+ let @a = ''
+ normal! j"ay4y
+ call assert_equal("two\nthree\nfour\nfive\n", @a)
+ normal! 3G>2>
+ call assert_equal(['one', 'two', ' three', ' four', 'five'],
+ \ getline(1, '$'))
+ exe "normal! 3G0c2cred\nblue"
+ call assert_equal(['one', 'two', ' red', ' blue', 'five'],
+ \ getline(1, '$'))
+ exe "normal! gg<8<"
+ call assert_equal(['one', 'two', 'red', 'blue', 'five'],
+ \ getline(1, '$'))
+ exe "normal! ggd3d"
+ call assert_equal(['blue', 'five'], getline(1, '$'))
+ call setline(1, range(1, 4))
+ call feedkeys("gg!3!\<C-B>\"\<CR>", 'xt')
+ call assert_equal('".,.+2!', @:)
+ call feedkeys("gg!1!\<C-B>\"\<CR>", 'xt')
+ call assert_equal('".!', @:)
+ call feedkeys("gg!9!\<C-B>\"\<CR>", 'xt')
+ call assert_equal('".,$!', @:)
+ bw!
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2915/src/testdir/test_visual.vim 2021-05-30 22:17:21.035457554
+0200
--- src/testdir/test_visual.vim 2021-05-31 19:19:18.579926605 +0200
***************
*** 818,824 ****
--- 818,916 ----
exe "normal ld\<C-V>j"
call assert_equal(['13', '46', '789'], getline(1, '$'))
+ " Test from ':help v_b_I_example'
+ %d _
+ setlocal tabstop=8 shiftwidth=4
+ let lines =<< trim END
+ abcdefghijklmnopqrstuvwxyz
+ abc defghijklmnopqrstuvwxyz
+ abcdef ghi jklmnopqrstuvwxyz
+ abcdefghijklmnopqrstuvwxyz
+ END
+ call setline(1, lines)
+ exe "normal ggfo\<C-V>3jISTRING"
+ let expected =<< trim END
+ abcdefghijklmnSTRINGopqrstuvwxyz
+ abc STRING defghijklmnopqrstuvwxyz
+ abcdef ghi STRING jklmnopqrstuvwxyz
+ abcdefghijklmnSTRINGopqrstuvwxyz
+ END
+ call assert_equal(expected, getline(1, '$'))
+
+ " Test from ':help v_b_A_example'
+ %d _
+ let lines =<< trim END
+ abcdefghijklmnopqrstuvwxyz
+ abc defghijklmnopqrstuvwxyz
+ abcdef ghi jklmnopqrstuvwxyz
+ abcdefghijklmnopqrstuvwxyz
+ END
+ call setline(1, lines)
+ exe "normal ggfo\<C-V>3j$ASTRING"
+ let expected =<< trim END
+ abcdefghijklmnopqrstuvwxyzSTRING
+ abc defghijklmnopqrstuvwxyzSTRING
+ abcdef ghi jklmnopqrstuvwxyzSTRING
+ abcdefghijklmnopqrstuvwxyzSTRING
+ END
+ call assert_equal(expected, getline(1, '$'))
+
+ " Test from ':help v_b_<_example'
+ %d _
+ let lines =<< trim END
+ abcdefghijklmnopqrstuvwxyz
+ abc defghijklmnopqrstuvwxyz
+ abcdef ghi jklmnopqrstuvwxyz
+ abcdefghijklmnopqrstuvwxyz
+ END
+ call setline(1, lines)
+ exe "normal ggfo\<C-V>3j3l<.."
+ let expected =<< trim END
+ abcdefghijklmnopqrstuvwxyz
+ abc defghijklmnopqrstuvwxyz
+ abcdef ghi jklmnopqrstuvwxyz
+ abcdefghijklmnopqrstuvwxyz
+ END
+ call assert_equal(expected, getline(1, '$'))
+
+ " Test from ':help v_b_>_example'
+ %d _
+ let lines =<< trim END
+ abcdefghijklmnopqrstuvwxyz
+ abc defghijklmnopqrstuvwxyz
+ abcdef ghi jklmnopqrstuvwxyz
+ abcdefghijklmnopqrstuvwxyz
+ END
+ call setline(1, lines)
+ exe "normal ggfo\<C-V>3j>.."
+ let expected =<< trim END
+ abcdefghijklmn opqrstuvwxyz
+ abc defghijklmnopqrstuvwxyz
+ abcdef ghi jklmnopqrstuvwxyz
+ abcdefghijklmn opqrstuvwxyz
+ END
+ call assert_equal(expected, getline(1, '$'))
+
+ " Test from ':help v_b_r_example'
+ %d _
+ let lines =<< trim END
+ abcdefghijklmnopqrstuvwxyz
+ abc defghijklmnopqrstuvwxyz
+ abcdef ghi jklmnopqrstuvwxyz
+ abcdefghijklmnopqrstuvwxyz
+ END
+ call setline(1, lines)
+ exe "normal ggfo\<C-V>5l3jrX"
+ let expected =<< trim END
+ abcdefghijklmnXXXXXXuvwxyz
+ abc XXXXXXhijklmnopqrstuvwxyz
+ abcdef ghi XXXXXX jklmnopqrstuvwxyz
+ abcdefghijklmnXXXXXXuvwxyz
+ END
+ call assert_equal(expected, getline(1, '$'))
+
bwipe!
+ set tabstop& shiftwidth&
endfunc
" Test block-insert using cursor keys for movement
*** ../vim-8.2.2915/src/version.c 2021-05-31 18:40:45.996805282 +0200
--- src/version.c 2021-05-31 19:21:36.607633228 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2916,
/**/
--
An indication you must be a manager:
You can explain to somebody the difference between "re-engineering",
"down-sizing", "right-sizing", and "firing people's asses".
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202105311723.14VHNcZZ2088444%40masaka.moolenaar.net.