Patch 8.2.2100
Problem:    Insufficient testing for function range and dict.
Solution:   Add a few tests. (Dominique Pellé, closes #7428)
Files:      src/testdir/test_functions.vim, src/testdir/test_lambda.vim,
            src/testdir/test_signals.vim, src/testdir/test_user_func.vim


*** ../vim-8.2.2099/src/testdir/test_functions.vim      2020-11-28 
20:32:26.086679786 +0100
--- src/testdir/test_functions.vim      2020-12-06 15:00:06.685917392 +0100
***************
*** 2099,2104 ****
--- 2099,2105 ----
    let mydict = {'data': [0, 1, 2, 3], 'len': function("Mylen")}
    eval mydict.len->call([], mydict)->assert_equal(4)
    call assert_fails("call call('Mylen', [], 0)", 'E715:')
+   call assert_fails('call foo', 'E107:')
  endfunc
  
  func Test_char2nr()
*** ../vim-8.2.2099/src/testdir/test_lambda.vim 2020-09-04 21:18:40.484161926 
+0200
--- src/testdir/test_lambda.vim 2020-12-06 15:00:06.685917392 +0100
***************
*** 247,252 ****
--- 247,257 ----
    call assert_equal(2, l:F())
    call assert_equal(3, l:F())
    call assert_equal(4, l:F())
+ 
+   call assert_match("^\n   function <SNR>\\d\\+_bar() closure"
+   \              .. "\n1        let x += 1"
+   \              .. "\n2        return x"
+   \              .. "\n   endfunction$", execute('func s:bar'))
  endfunc
  
  func Test_closure_unlet()
*** ../vim-8.2.2099/src/testdir/test_signals.vim        2020-06-01 
15:05:16.300297224 +0200
--- src/testdir/test_signals.vim        2020-12-06 15:00:06.685917392 +0100
***************
*** 153,160 ****
    call assert_equal(['foo'], getline(1, '$'))
  
    let result = readfile('XautoOut')
!   call assert_match('VimLeavePre triggered', result[0])
!   call assert_match('VimLeave triggered', result[1])
  
    %bwipe!
    call delete('.Xsig_TERM.swp')
--- 153,159 ----
    call assert_equal(['foo'], getline(1, '$'))
  
    let result = readfile('XautoOut')
!   call assert_equal(["VimLeavePre triggered", "VimLeave triggered"], result)
  
    %bwipe!
    call delete('.Xsig_TERM.swp')
*** ../vim-8.2.2099/src/testdir/test_user_func.vim      2020-09-23 
22:38:01.507927503 +0200
--- src/testdir/test_user_func.vim      2020-12-06 15:00:06.685917392 +0100
***************
*** 445,448 ****
--- 445,480 ----
    delfunc Xfunc
  endfunc
  
+ func Test_func_dict()
+   let mydict = {'a': 'b'}
+   function mydict.somefunc() dict
+     return len(self)
+   endfunc
+ 
+   call assert_equal("{'a': 'b', 'somefunc': function('2')}", string(mydict))
+   call assert_equal(2, mydict.somefunc())
+   call assert_match("^\n   function \\d\\\+() dict"
+   \              .. "\n1      return len(self)"
+   \              .. "\n   endfunction$", execute('func mydict.somefunc'))
+ endfunc
+ 
+ func Test_func_range()
+   new
+   call setline(1, range(1, 8))
+   func FuncRange() range
+     echo a:firstline
+     echo a:lastline
+   endfunc
+   3
+   call assert_equal("\n3\n3", execute('call FuncRange()'))
+   call assert_equal("\n4\n6", execute('4,6 call FuncRange()'))
+   call assert_equal("\n   function FuncRange() range"
+   \              .. "\n1      echo a:firstline"
+   \              .. "\n2      echo a:lastline"
+   \              .. "\n   endfunction",
+   \                 execute('function FuncRange'))
+ 
+   bwipe!
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2099/src/version.c       2020-12-06 14:37:04.717124932 +0100
--- src/version.c       2020-12-06 15:02:00.805592190 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2100,
  /**/

-- 
User:       I'm having problems with my text editor.
Help desk:  Which editor are you using?
User:       I don't know, but it's version VI (pronounced: 6).
Help desk:  Oh, then you should upgrade to version VIM (pronounced: 994).

 /// 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/202012061404.0B6E4CWr1088962%40masaka.moolenaar.net.

Raspunde prin e-mail lui