Skip to content

Commit a2f2885

Browse files
committed
patch 8.0.0292: the stat test is a bit slow
Problem: The stat test is a bit slow. Solution: Remove a couple of sleep comments and reduce another.
1 parent 23fa81d commit a2f2885

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

src/testdir/test_stat.vim

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,54 @@
11
" Tests for stat functions and checktime
22

33
func Test_existent_file()
4-
let fname='Xtest.tmp'
4+
let fname = 'Xtest.tmp'
55

6-
let ts=localtime()
7-
sleep 1
8-
let fl=['Hello World!']
6+
let ts = localtime()
7+
let fl = ['Hello World!']
98
call writefile(fl, fname)
10-
let tf=getftime(fname)
11-
sleep 1
12-
let te=localtime()
9+
let tf = getftime(fname)
10+
let te = localtime()
1311

1412
call assert_true(ts <= tf && tf <= te)
1513
call assert_equal(strlen(fl[0] . "\n"), getfsize(fname))
1614
call assert_equal('file', getftype(fname))
1715
call assert_equal('rw-', getfperm(fname)[0:2])
16+
17+
call delete(fname)
1818
endfunc
1919

2020
func Test_existent_directory()
21-
let dname='.'
21+
let dname = '.'
2222

2323
call assert_equal(0, getfsize(dname))
2424
call assert_equal('dir', getftype(dname))
2525
call assert_equal('rwx', getfperm(dname)[0:2])
2626
endfunc
2727

2828
func Test_checktime()
29-
let fname='Xtest.tmp'
29+
let fname = 'Xtest.tmp'
3030

31-
let fl=['Hello World!']
31+
let fl = ['Hello World!']
3232
call writefile(fl, fname)
3333
set autoread
3434
exec 'e' fname
35-
sleep 2
36-
let fl=readfile(fname)
35+
" FAT has a granularity of 2 seconds, otherwise it's usually 1 second
36+
if has('win32')
37+
sleep 2
38+
else
39+
sleep 1
40+
endif
41+
let fl = readfile(fname)
3742
let fl[0] .= ' - checktime'
3843
call writefile(fl, fname)
3944
checktime
4045
call assert_equal(fl[0], getline(1))
46+
47+
call delete(fname)
4148
endfunc
4249

4350
func Test_nonexistent_file()
44-
let fname='Xtest.tmp'
51+
let fname = 'Xtest.tmp'
4552

4653
call delete(fname)
4754
call assert_equal(-1, getftime(fname))
@@ -55,7 +62,7 @@ func Test_win32_symlink_dir()
5562
" So we use an existing symlink for this test.
5663
if has('win32')
5764
" Check if 'C:\Users\All Users' is a symlink to a directory.
58-
let res=system('dir C:\Users /a')
65+
let res = system('dir C:\Users /a')
5966
if match(res, '\C<SYMLINKD> *All Users') >= 0
6067
" Get the filetype of the symlink.
6168
call assert_equal('dir', getftype('C:\Users\All Users'))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
292,
767769
/**/
768770
291,
769771
/**/

0 commit comments

Comments
 (0)