diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-11-17 22:37:31 -0500 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-11-17 22:38:22 -0500 |
commit | eab181a74e8534974f6cc887bae9b65fddcfe25e (patch) | |
tree | 61c216005712b2556eabd082d195aabae90616ee | |
parent | 2b7e58cb2c59d6ad6f548b00abd85f396a8a244f (diff) | |
download | rneovim-eab181a74e8534974f6cc887bae9b65fddcfe25e.tar.gz rneovim-eab181a74e8534974f6cc887bae9b65fddcfe25e.tar.bz2 rneovim-eab181a74e8534974f6cc887bae9b65fddcfe25e.zip |
vim-patch:8.1.0318: the getftype() test may fail for char devices
Problem: The getftype() test may fail for char devices if the file
disappeared in between the listing and the getftype() call.
Solution: Ignore empty result. (Ozaki Kiichi, closes vim/vim#3360)
https://github.com/vim/vim/commit/3b3a506f57a397d83db361be35189c591bff10fb
-rw-r--r-- | src/nvim/testdir/test_stat.vim | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_stat.vim b/src/nvim/testdir/test_stat.vim index c276df0a92..74b76d668e 100644 --- a/src/nvim/testdir/test_stat.vim +++ b/src/nvim/testdir/test_stat.vim @@ -141,17 +141,29 @@ func Test_getftype() endif for cdevfile in systemlist('find /dev -type c -maxdepth 2 2>/dev/null') - call assert_equal('cdev', getftype(cdevfile)) + let type = getftype(cdevfile) + " ignore empty result, can happen if the file disappeared + if type != '' + call assert_equal('cdev', type) + endif endfor for bdevfile in systemlist('find /dev -type b -maxdepth 2 2>/dev/null') - call assert_equal('bdev', getftype(bdevfile)) + let type = getftype(bdevfile) + " ignore empty result, can happen if the file disappeared + if type != '' + call assert_equal('bdev', type) + endif 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)) + let type = getftype(socketfile) + " ignore empty result, can happen if the file disappeared + if type != '' + call assert_equal('socket', type) + endif endfor " TODO: file type 'other' is not tested. How can we test it? |