Patch 8.2.1505
Problem:    Not all file read and writecode is tested.
Solution:   Add a few tests. (Dominique Pellé, closes #6764)
Files:      src/testdir/test_eval_stuff.vim, src/testdir/test_fnamemodify.vim,
            src/testdir/test_functions.vim


*** ../vim-8.2.1504/src/testdir/test_eval_stuff.vim     2020-08-06 
16:37:56.728521924 +0200
--- src/testdir/test_eval_stuff.vim     2020-08-21 22:42:28.388940475 +0200
***************
*** 74,91 ****
    new
    call setline(1, ['one', 'two', 'three'])
    setlocal ff=dos
!   silent write XReadfile
!   let lines = 'XReadfile'->readfile()
    call assert_equal(['one', 'two', 'three'], lines)
!   let lines = readfile('XReadfile', '', 2)
    call assert_equal(['one', 'two'], lines)
!   let lines = readfile('XReadfile', 'b')
    call assert_equal(["one\r", "two\r", "three\r", ""], lines)
!   let lines = readfile('XReadfile', 'b', 2)
    call assert_equal(["one\r", "two\r"], lines)
  
    bwipe!
!   call delete('XReadfile')
  endfunc
  
  func Test_let_errmsg()
--- 74,104 ----
    new
    call setline(1, ['one', 'two', 'three'])
    setlocal ff=dos
!   silent write XReadfile_bin
!   let lines = 'XReadfile_bin'->readfile()
    call assert_equal(['one', 'two', 'three'], lines)
!   let lines = readfile('XReadfile_bin', '', 2)
    call assert_equal(['one', 'two'], lines)
!   let lines = readfile('XReadfile_bin', 'b')
    call assert_equal(["one\r", "two\r", "three\r", ""], lines)
!   let lines = readfile('XReadfile_bin', 'b', 2)
    call assert_equal(["one\r", "two\r"], lines)
  
    bwipe!
!   call delete('XReadfile_bin')
! endfunc
! 
! func Test_readfile_bom()
!   call writefile(["\ufeffFOO", "FOO\ufeffBAR"], 'XReadfile_bom')
!   call assert_equal(['FOO', 'FOOBAR'], readfile('XReadfile_bom'))
!   call delete('XReadfile_bom')
! endfunc
! 
! func Test_readfile_max()
!   call writefile(range(1, 4), 'XReadfile_max')
!   call assert_equal(['1', '2'], readfile('XReadfile_max', '', 2))
!   call assert_equal(['3', '4'], readfile('XReadfile_max', '', -2))
!   call delete('XReadfile_max')
  endfunc
  
  func Test_let_errmsg()
*** ../vim-8.2.1504/src/testdir/test_fnamemodify.vim    2020-06-10 
13:12:25.071026049 +0200
--- src/testdir/test_fnamemodify.vim    2020-08-21 22:42:28.388940475 +0200
***************
*** 11,16 ****
--- 11,17 ----
    call assert_equal('/', fnamemodify('.', ':p')[-1:])
    call assert_equal('r', fnamemodify('.', ':p:h')[-1:])
    call assert_equal('t', fnamemodify('test.out', ':p')[-1:])
+   call assert_equal($HOME .. "/foo" , fnamemodify('~/foo', ':p'))
    call assert_equal('test.out', fnamemodify('test.out', ':.'))
    call assert_equal('a', fnamemodify('../testdir/a', ':.'))
    call assert_equal('~/testdir/test.out', fnamemodify('test.out', ':~'))
***************
*** 93,96 ****
--- 94,102 ----
    call assert_equal('', fnamemodify(test_null_string(), test_null_string()))
  endfunc
  
+ func Test_fnamemodify_fail()
+   call assert_fails('call fnamemodify({}, ":p")', 'E731:')
+   call assert_fails('call fnamemodify("x", {})', 'E731:')
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.1504/src/testdir/test_functions.vim      2020-08-12 
18:50:31.879655802 +0200
--- src/testdir/test_functions.vim      2020-08-21 22:42:28.388940475 +0200
***************
*** 2516,2521 ****
--- 2516,2534 ----
  func Test_glob()
    call assert_equal('', glob(test_null_string()))
    call assert_equal('', globpath(test_null_string(), test_null_string()))
+ 
+   call writefile([], 'Xglob1')
+   call writefile([], 'XGLOB2')
+   set wildignorecase
+   " Sort output of glob() otherwise we end up with different
+   " ordering depending on whether file system is case-sensitive.
+   call assert_equal(['XGLOB2', 'Xglob1'], sort(glob('Xglob[12]', 0, 1)))
+   set wildignorecase&
+ 
+   call delete('Xglob1')
+   call delete('XGLOB2')
+ 
+   call assert_fails("call glob('*', 0, {})", 'E728:')
  endfunc
  
  " Test for browse()
*** ../vim-8.2.1504/src/version.c       2020-08-21 22:36:43.666719887 +0200
--- src/version.c       2020-08-21 22:44:44.128246224 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1505,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
261. You find diskettes in your pockets when doing laundry.

 /// 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/202008212047.07LKl4dL554576%40masaka.moolenaar.net.

Raspunde prin e-mail lui