comparison src/testdir/test_stat.vim @ 17889:0d64e74be8b2 v8.1.1941

patch 8.1.1941: getftype() test fails on Mac Commit: https://github.com/vim/vim/commit/ad5db44c0165b6254199e7af5962b42caf8b857c Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 30 13:12:25 2019 +0200 patch 8.1.1941: getftype() test fails on Mac Problem: getftype() test fails on Mac. Solution: Skip /dev/fd/.
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Aug 2019 13:15:03 +0200
parents 4935244c1128
children 2ef19eed524a
comparison
equal deleted inserted replaced
17888:d4d44677c041 17889:0d64e74be8b2
141 call assert_equal('fifo', getftype('Xfifo')) 141 call assert_equal('fifo', getftype('Xfifo'))
142 call delete('Xfifo') 142 call delete('Xfifo')
143 endif 143 endif
144 144
145 for cdevfile in systemlist('find /dev -type c -maxdepth 2 2>/dev/null') 145 for cdevfile in systemlist('find /dev -type c -maxdepth 2 2>/dev/null')
146 let type = getftype(cdevfile) 146 " On Mac /def/fd/2 is found but the type is "fifo"
147 " ignore empty result, can happen if the file disappeared 147 if cdevfile !~ '/dev/fd/'
148 if type != '' 148 let type = getftype(cdevfile)
149 call assert_equal('cdev', type) 149 " ignore empty result, can happen if the file disappeared
150 if type != ''
151 call assert_equal('cdev', type, 'for ' .. cdevfile)
152 endif
150 endif 153 endif
151 endfor 154 endfor
152 155
153 for bdevfile in systemlist('find /dev -type b -maxdepth 2 2>/dev/null') 156 for bdevfile in systemlist('find /dev -type b -maxdepth 2 2>/dev/null')
154 let type = getftype(bdevfile) 157 let type = getftype(bdevfile)
155 " ignore empty result, can happen if the file disappeared 158 " ignore empty result, can happen if the file disappeared
156 if type != '' 159 if type != ''
157 call assert_equal('bdev', type) 160 call assert_equal('bdev', type, 'for ' .. bdevfile)
158 endif 161 endif
159 endfor 162 endfor
160 163
161 " The /run/ directory typically contains socket files. 164 " The /run/ directory typically contains socket files.
162 " If it does not, test won't fail but will not test socket files. 165 " If it does not, test won't fail but will not test socket files.
163 for socketfile in systemlist('find /run -type s -maxdepth 2 2>/dev/null') 166 for socketfile in systemlist('find /run -type s -maxdepth 2 2>/dev/null')
164 let type = getftype(socketfile) 167 let type = getftype(socketfile)
165 " ignore empty result, can happen if the file disappeared 168 " ignore empty result, can happen if the file disappeared
166 if type != '' 169 if type != ''
167 call assert_equal('socket', type) 170 call assert_equal('socket', type, 'for ' .. socketfile)
168 endif 171 endif
169 endfor 172 endfor
170 173
171 " TODO: file type 'other' is not tested. How can we test it? 174 " TODO: file type 'other' is not tested. How can we test it?
172 endfunc 175 endfunc