Mercurial > vim
annotate src/testdir/test_file_perm.vim @ 17555:c2eb5118ba89 v8.1.1775
patch 8.1.1775: error message may be empty in filetype test
commit https://github.com/vim/vim/commit/eee9f65b2a213e9031f172d9d3b22adad6cb985d
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jul 29 21:14:42 2019 +0200
patch 8.1.1775: error message may be empty in filetype test
Problem: Error message may be empty in filetype test.
Solution: Use v:exception instead. (Daniel Hahler, closs https://github.com/vim/vim/issues/4744)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 29 Jul 2019 21:15:08 +0200 |
parents | 988ddc5742f5 |
children | 4935244c1128 |
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')) |
c0b5c2b0a5ee
commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 call assert_equal(0, setfperm('Xtest', 'r--------')) |
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') |
c0b5c2b0a5ee
commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call assert_true(len(getfperm('Xtest')) == 9) |
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') |
c0b5c2b0a5ee
commit https://github.com/vim/vim/commit/8049253b96838b3584600e5ad229abad37a95b10
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endfunc |