annotate src/testdir/test_file_perm.vim @ 29247:5f314b2ed494 v8.2.5142

patch 8.2.5142: startup test fails if there is a status bar Commit: https://github.com/vim/vim/commit/fa04eae5a5b9394079bde2d37ce6f9f8a5567d48 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 21 14:38:40 2022 +0100 patch 8.2.5142: startup test fails if there is a status bar Problem: Startup test fails if there is a status bar at the top of the screen. (Ernie Rael) Solution: Use a larger vertical offset in the test.
author Bram Moolenaar <Bram@vim.org>
date Tue, 21 Jun 2022 18:45:07 +0200
parents 546bdeef35f1
children 13b02c1ea0f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8451
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test getting and setting file permissions.
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_file_perm()
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 call assert_equal('', getfperm('Xtest'))
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 8461
diff changeset
5 call assert_equal(0, 'Xtest'->setfperm('r--------'))
8451
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 call writefile(['one'], 'Xtest')
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 8461
diff changeset
8 call assert_true(len('Xtest'->getfperm()) == 9)
8451
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call assert_equal(1, setfperm('Xtest', 'rwx------'))
8461
988ddc5742f5 commit https://github.com/vim/vim/commit/8322e1f06e8fa39a6bb790a7d8d7db5d7aff3366
Christian Brabandt <cb@256bit.org>
parents: 8451
diff changeset
11 if has('win32')
988ddc5742f5 commit https://github.com/vim/vim/commit/8322e1f06e8fa39a6bb790a7d8d7db5d7aff3366
Christian Brabandt <cb@256bit.org>
parents: 8451
diff changeset
12 call assert_equal('rw-rw-rw-', getfperm('Xtest'))
988ddc5742f5 commit https://github.com/vim/vim/commit/8322e1f06e8fa39a6bb790a7d8d7db5d7aff3366
Christian Brabandt <cb@256bit.org>
parents: 8451
diff changeset
13 else
988ddc5742f5 commit https://github.com/vim/vim/commit/8322e1f06e8fa39a6bb790a7d8d7db5d7aff3366
Christian Brabandt <cb@256bit.org>
parents: 8451
diff changeset
14 call assert_equal('rwx------', getfperm('Xtest'))
988ddc5742f5 commit https://github.com/vim/vim/commit/8322e1f06e8fa39a6bb790a7d8d7db5d7aff3366
Christian Brabandt <cb@256bit.org>
parents: 8451
diff changeset
15 endif
8451
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call assert_equal(1, setfperm('Xtest', 'r--r--r--'))
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call assert_equal('r--r--r--', getfperm('Xtest'))
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call assert_fails("setfperm('Xtest', '---')")
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal(1, setfperm('Xtest', 'rwx------'))
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call delete('Xtest')
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
24
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
25 call assert_fails("call setfperm(['Xfile'], 'rw-rw-rw-')", 'E730:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
26 call assert_fails("call setfperm('Xfile', [])", 'E730:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
27 call assert_fails("call setfperm('Xfile', 'rwxrwxrwxrw')", 'E475:')
8451
c0b5c2b0a5ee commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 endfunc
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
29
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
30 " vim: shiftwidth=2 sts=2 expandtab