To: vim_dev@googlegroups.com Subject: Patch 8.1.0262 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0262 Problem: Not enough testing for getftype(). Solution: Add a test. (Dominique Pelle, closes #3300) Files: src/evalfunc.c, src/testdir/test_stat.vim *** ../vim-8.1.0261/src/evalfunc.c 2018-07-29 16:09:14.632945629 +0200 --- src/evalfunc.c 2018-08-09 22:00:49.920858612 +0200 *************** *** 5111,5117 **** # endif # ifdef S_ISSOCK else if (S_ISSOCK(st.st_mode)) ! t = "fifo"; # endif else t = "other"; --- 5111,5117 ---- # endif # ifdef S_ISSOCK else if (S_ISSOCK(st.st_mode)) ! t = "socket"; # endif else t = "other"; *** ../vim-8.1.0261/src/testdir/test_stat.vim 2018-07-07 18:34:08.430551330 +0200 --- src/testdir/test_stat.vim 2018-08-09 22:00:49.924858584 +0200 *************** *** 122,127 **** --- 122,162 ---- call assert_equal('', getfperm(fname)) endfunc + func Test_getftype() + call assert_equal('file', getftype(v:progpath)) + call assert_equal('dir', getftype('.')) + + if !has('unix') + return + endif + + silent !ln -s Xfile Xlink + call assert_equal('link', getftype('Xlink')) + call delete('Xlink') + + if executable('mkfifo') + silent !mkfifo Xfifo + call assert_equal('fifo', getftype('Xfifo')) + call delete('Xfifo') + endif + + for cdevfile in systemlist('find /dev -type c -maxdepth 2 2>/dev/null') + call assert_equal('cdev', getftype(cdevfile)) + endfor + + for bdevfile in systemlist('find /dev -type b -maxdepth 2 2>/dev/null') + call assert_equal('bdev', getftype(bdevfile)) + endfor + + " The /run/ directory typically contains socket files. + " If it does not, test won't fail but will not test socket files. + for socketfile in systemlist('find /run -type s -maxdepth 2 2>/dev/null') + call assert_equal('socket', getftype(socketfile)) + endfor + + " TODO: file type 'other' is not tested. How can we test it? + endfunc + func Test_win32_symlink_dir() " On Windows, non-admin users cannot create symlinks. " So we use an existing symlink for this test. *** ../vim-8.1.0261/src/version.c 2018-08-09 21:52:20.716362389 +0200 --- src/version.c 2018-08-09 22:08:41.385639374 +0200 *************** *** 796,797 **** --- 796,799 ---- { /* Add new patch number below this line */ + /**/ + 262, /**/ -- 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 -- 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 ///