1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0262
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
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 ///
|