Patch 8.2.1810
Problem:    Some code in normal.c not covered by tests.
Solution:   Add normal mode tests. (Yegappan Lakshmanan, closes #7086)
Files:      src/testdir/test_charsearch.vim, src/testdir/test_normal.vim


*** ../vim-8.2.1809/src/testdir/test_charsearch.vim     2020-06-14 
13:50:51.743717732 +0200
--- src/testdir/test_charsearch.vim     2020-10-07 16:52:00.791790242 +0200
***************
*** 51,57 ****
    normal! tb
    call assert_equal([0, 1, 2, 6], getpos('.'))
    set virtualedit&
!   close!
  endfunc
  
  " Test for character search failure in latin1 encoding
--- 51,57 ----
    normal! tb
    call assert_equal([0, 1, 2, 6], getpos('.'))
    set virtualedit&
!   bw!
  endfunc
  
  " Test for character search failure in latin1 encoding
***************
*** 65,71 ****
    call assert_beeps('normal $Fz')
    call assert_beeps('normal $Tx')
    let &encoding = save_enc
!   close!
  endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
--- 65,98 ----
    call assert_beeps('normal $Fz')
    call assert_beeps('normal $Tx')
    let &encoding = save_enc
!   bw!
! endfunc
! 
! " Test for using character search to find a multibyte character with composing
! " characters.
! func Test_charsearch_composing_char()
!   new
!   call setline(1, "one two thq\u0328\u0301r\u0328\u0301ree")
!   call feedkeys("fr\u0328\u0301", 'xt')
!   call assert_equal([0, 1, 16, 0, 12], getcurpos())
! 
!   " use character search with a multi-byte character followed by a
!   " non-composing character
!   call setline(1, "abc deȉf ghi")
!   call feedkeys("ggcf\u0209\u0210", 'xt')
!   call assert_equal("\u0210f ghi", getline(1))
!   bw!
! endfunc
! 
! " Test for character search with 'hkmap'
! func Test_charsearch_hkmap()
!   new
!   set hkmap
!   call setline(1, "ùðáâ÷ëòéïçìêöî")
!   call feedkeys("fë", 'xt')
!   call assert_equal([0, 1, 11, 0, 6], getcurpos())
!   set hkmap&
!   bw!
  endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.1809/src/testdir/test_normal.vim 2020-10-04 16:16:50.919838655 
+0200
--- src/testdir/test_normal.vim 2020-10-07 16:52:00.791790242 +0200
***************
*** 118,123 ****
--- 118,156 ----
    call feedkeys("Vkk\<Up>yy", 'tx')
    call assert_equal(['47', '48', '49', '50'], getreg(0, 0, 1))
  
+   " Test for using special keys to start visual selection
+   %d
+   call setline(1, ['red fox tail', 'red fox tail', 'red fox tail'])
+   set keymodel=startsel
+   " Test for <S-PageUp> and <S-PageDown>
+   call cursor(1, 1)
+   call feedkeys("\<S-PageDown>y", 'xt')
+   call assert_equal([0, 1, 1, 0], getpos("'<"))
+   call assert_equal([0, 3, 1, 0], getpos("'>"))
+   call feedkeys("Gz\<CR>8|\<S-PageUp>y", 'xt')
+   call assert_equal([0, 2, 1, 0], getpos("'<"))
+   call assert_equal([0, 3, 8, 0], getpos("'>"))
+   " Test for <S-C-Home> and <S-C-End>
+   call cursor(2, 12)
+   call feedkeys("\<S-C-Home>y", 'xt')
+   call assert_equal([0, 1, 1, 0], getpos("'<"))
+   call assert_equal([0, 2, 12, 0], getpos("'>"))
+   call cursor(1, 4)
+   call feedkeys("\<S-C-End>y", 'xt')
+   call assert_equal([0, 1, 4, 0], getpos("'<"))
+   call assert_equal([0, 3, 13, 0], getpos("'>"))
+   " Test for <S-C-Left> and <S-C-Right>
+   call cursor(2, 5)
+   call feedkeys("\<S-C-Right>y", 'xt')
+   call assert_equal([0, 2, 5, 0], getpos("'<"))
+   call assert_equal([0, 2, 9, 0], getpos("'>"))
+   call cursor(2, 9)
+   call feedkeys("\<S-C-Left>y", 'xt')
+   call assert_equal([0, 2, 5, 0], getpos("'<"))
+   call assert_equal([0, 2, 9, 0], getpos("'>"))
+ 
+   set keymodel&
+ 
    " clean up
    bw!
  endfunc
***************
*** 409,414 ****
--- 442,455 ----
      call assert_equal(expected[i], expand('<cexpr>'), 'i == ' . i)
    endfor
  
+   " Test for <cexpr> in state.val and ptr->val
+   call setline(1, 'x = state.val;')
+   call cursor(1, 10)
+   call assert_equal('state.val', expand('<cexpr>'))
+   call setline(1, 'x = ptr->val;')
+   call cursor(1, 9)
+   call assert_equal('ptr->val', expand('<cexpr>'))
+ 
    if executable('echo')
      " Test expand(`...`) i.e. backticks command expansion.
      call assert_equal('abcde', expand('`echo abcde`'))
***************
*** 422,427 ****
--- 463,481 ----
    bw!
  endfunc
  
+ " Test for expand() in latin1 encoding
+ func Test_normal_expand_latin1()
+   new
+   let save_enc = &encoding
+   set encoding=latin1
+   call setline(1, 'val = item->color;')
+   call cursor(1, 11)
+   call assert_equal('color', expand("<cword>"))
+   call assert_equal('item->color', expand("<cexpr>"))
+   let &encoding = save_enc
+   bw!
+ endfunc
+ 
  func Test_normal11_showcmd()
    " test for 'showcmd'
    10new
***************
*** 446,451 ****
--- 500,512 ----
    redraw!
    call assert_match('1-3$', Screenline(&lines))
    call feedkeys("v", 'xt')
+   " test for visually selecting the end of line
+   call setline(1, ["foobar"])
+   call feedkeys("$vl", 'xt')
+   redraw!
+   call assert_match('2$', Screenline(&lines))
+   call feedkeys("y", 'xt')
+   call assert_equal("r\n", @")
    bw!
  endfunc
  
***************
*** 2021,2026 ****
--- 2082,2094 ----
    normal gglvjjrx
    call assert_equal(['axx', 'xxx', 'xxf'], getline(1, '$'))
  
+   " replace with a multibyte character (with multiple composing characters)
+   %d
+   new
+   call setline(1, 'aaa')
+   exe "normal $ra\u0328\u0301"
+   call assert_equal("aaa\u0328\u0301", getline(1))
+ 
    " clean up
    set noautoindent
    bw!
*** ../vim-8.2.1809/src/version.c       2020-10-07 16:12:33.909930340 +0200
--- src/version.c       2020-10-07 16:53:57.567409880 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1810,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
39. You move into a new house and setup the Wifi router before
    unpacking any kitchen stuff.

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
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/202010071455.097EtS212965819%40masaka.moolenaar.net.

Raspunde prin e-mail lui