annotate src/testdir/test_stat.vim @ 14294:6c5c8de48152 v8.1.0163

patch 8.1.0163: insufficient testing for Tcl commit https://github.com/vim/vim/commit/2549acf794109731eab693bd396bb863d0e2cff4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 7 22:42:01 2018 +0200 patch 8.1.0163: insufficient testing for Tcl Problem: Insufficient testing for Tcl. Solution: Add a few more tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/3166)
author Christian Brabandt <cb@256bit.org>
date Sat, 07 Jul 2018 22:45:05 +0200
parents 977cab3d5474
children a7b2dc5f1306
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for stat functions and checktime
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
12150
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
3 func CheckFileTime(doSleep)
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
4 let fname = 'Xtest.tmp'
12150
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
5 let result = 0
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
7 let ts = localtime()
12150
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
8 if a:doSleep
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
9 sleep 1
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
10 endif
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
11 let fl = ['Hello World!']
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call writefile(fl, fname)
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
13 let tf = getftime(fname)
12150
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
14 if a:doSleep
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
15 sleep 1
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
16 endif
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
17 let te = localtime()
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
12150
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
19 let time_correct = (ts <= tf && tf <= te)
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
20 if a:doSleep || time_correct
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
21 call assert_true(time_correct)
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
22 call assert_equal(strlen(fl[0] . "\n"), getfsize(fname))
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
23 call assert_equal('file', getftype(fname))
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
24 call assert_equal('rw-', getfperm(fname)[0:2])
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
25 let result = 1
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
26 endif
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
27
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
28 call delete(fname)
12150
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
29 return result
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
30 endfunc
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
31
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
32 func Test_existent_file()
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
33 " On some systems the file timestamp is rounded to a multiple of 2 seconds.
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
34 " We need to sleep to handle that, but that makes the test slow. First try
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
35 " without the sleep, and if it fails try again with the sleep.
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
36 if CheckFileTime(0) == 0
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
37 call CheckFileTime(1)
709b898e2119 patch 8.0.0955: Test_existent_file() fails on some file systems
Christian Brabandt <cb@256bit.org>
parents: 10805
diff changeset
38 endif
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 endfunc
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 func Test_existent_directory()
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
42 let dname = '.'
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal(0, getfsize(dname))
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal('dir', getftype(dname))
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal('rwx', getfperm(dname)[0:2])
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 endfunc
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48
14290
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
49 func SleepForTimestamp()
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
50 " FAT has a granularity of 2 seconds, otherwise it's usually 1 second
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
51 if has('win32')
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
52 sleep 2
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
53 else
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
54 sleep 1
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
55 endif
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
56 endfunc
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
57
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 func Test_checktime()
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
59 let fname = 'Xtest.tmp'
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
61 let fl = ['Hello World!']
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call writefile(fl, fname)
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 set autoread
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 exec 'e' fname
14290
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
65 call SleepForTimestamp()
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
66 let fl = readfile(fname)
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 let fl[0] .= ' - checktime'
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 call writefile(fl, fname)
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 checktime
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call assert_equal(fl[0], getline(1))
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
71
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
72 call delete(fname)
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 endfunc
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74
14290
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
75 func Test_autoread_file_deleted()
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
76 new Xautoread
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
77 set autoread
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
78 call setline(1, 'original')
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
79 w!
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
80
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
81 call SleepForTimestamp()
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
82 if has('win32')
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
83 silent !echo changed > Xautoread
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
84 else
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
85 silent !echo 'changed' > Xautoread
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
86 endif
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
87 checktime
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
88 call assert_equal('changed', trim(getline(1)))
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
89
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
90 call SleepForTimestamp()
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
91 messages clear
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
92 if has('win32')
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
93 silent !del Xautoread
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
94 else
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
95 silent !rm Xautoread
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
96 endif
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
97 checktime
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
98 call assert_match('E211:', execute('messages'))
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
99 call assert_equal('changed', trim(getline(1)))
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
100
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
101 call SleepForTimestamp()
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
102 if has('win32')
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
103 silent !echo recreated > Xautoread
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
104 else
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
105 silent !echo 'recreated' > Xautoread
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
106 endif
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
107 checktime
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
108 call assert_equal('recreated', trim(getline(1)))
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
109
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
110 call delete('Xautoread')
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
111 bwipe!
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
112 endfunc
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
113
977cab3d5474 patch 8.1.0161: buffer not updated with 'autoread' set if file was deleted
Christian Brabandt <cb@256bit.org>
parents: 12150
diff changeset
114
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 func Test_nonexistent_file()
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
116 let fname = 'Xtest.tmp'
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 call delete(fname)
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 call assert_equal(-1, getftime(fname))
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 call assert_equal(-1, getfsize(fname))
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 call assert_equal('', getftype(fname))
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call assert_equal('', getfperm(fname))
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 endfunc
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 func Test_win32_symlink_dir()
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 " On Windows, non-admin users cannot create symlinks.
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 " So we use an existing symlink for this test.
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 if has('win32')
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 " Check if 'C:\Users\All Users' is a symlink to a directory.
10805
750779134e67 patch 8.0.0292: the stat test is a bit slow
Christian Brabandt <cb@256bit.org>
parents: 9387
diff changeset
130 let res = system('dir C:\Users /a')
9387
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 if match(res, '\C<SYMLINKD> *All Users') >= 0
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 " Get the filetype of the symlink.
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 call assert_equal('dir', getftype('C:\Users\All Users'))
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 endif
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 endif
f094d4085014 commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 endfunc