diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-08-16 23:13:55 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-08-17 01:15:04 -0400 |
commit | 8f09fa1a49ffa1fc00eabf78c54908d515d0aaa5 (patch) | |
tree | 72117f7016f3fbfaf936ffa93745bc52c3f34b4c /test/unit/os/fs_spec.lua | |
parent | d5cd15e67f8a4cfdc6a29d39efbce2697578783c (diff) | |
download | rneovim-8f09fa1a49ffa1fc00eabf78c54908d515d0aaa5.tar.gz rneovim-8f09fa1a49ffa1fc00eabf78c54908d515d0aaa5.tar.bz2 rneovim-8f09fa1a49ffa1fc00eabf78c54908d515d0aaa5.zip |
os/fs.c: remove os_file_is_readonly()
os_file_is_readonly() in its current form is equivalent to
!os_file_is_writable(). This does not appear to be a bug, because Vim's
use of check_file_readonly() (which we changed to os_file_is_readonly())
is equivalent to !os_file_is_writable() in every case.
os_file_is_readonly() also fails this test:
returns false if the file is non-read, non-write
A more useful form would define behavior under these cases:
- path is executable (but not writable)
- path is non-existent
- path is directory
But there is no reason for os_file_is_readonly() to exist, so remove it.
Diffstat (limited to 'test/unit/os/fs_spec.lua')
-rw-r--r-- | test/unit/os/fs_spec.lua | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index c5723d20e1..28e831229f 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -229,10 +229,6 @@ describe('fs function', function() return res end - local function os_file_is_readonly(filename) - return fs.os_file_is_readonly((to_cstr(filename))) - end - local function os_file_is_readable(filename) return fs.os_file_is_readable((to_cstr(filename))) end @@ -324,55 +320,6 @@ describe('fs function', function() end end) - describe('os_file_is_readonly', function() - -- pending('returns ? if the file does not exist', function() end) - -- pending('returns ? if the path is a directory', function() end) - -- pending('returns ? if the file is executable', function() end) - - it('returns false if the file is non-read, non-write', function() - local perm = os_getperm('unit-test-directory/test.file') - perm = unset_bit(perm, ffi.C.kS_IWUSR) - perm = unset_bit(perm, ffi.C.kS_IWGRP) - perm = unset_bit(perm, ffi.C.kS_IWOTH) - perm = unset_bit(perm, ffi.C.kS_IRUSR) - perm = unset_bit(perm, ffi.C.kS_IRGRP) - perm = unset_bit(perm, ffi.C.kS_IROTH) - - eq(OK, (os_setperm('unit-test-directory/test.file', perm))) - eq(1, os_file_is_writable('unit-test-directory/test.file')) - eq(false, os_file_is_readonly('unit-test-directory/test.file')) - end) - - it('returns false if the file is write-only', function() - local perm = os_getperm('unit-test-directory/test.file') - perm = set_bit(perm, ffi.C.kS_IWUSR) - perm = set_bit(perm, ffi.C.kS_IWGRP) - perm = set_bit(perm, ffi.C.kS_IWOTH) - perm = unset_bit(perm, ffi.C.kS_IRUSR) - perm = unset_bit(perm, ffi.C.kS_IRGRP) - perm = unset_bit(perm, ffi.C.kS_IROTH) - - eq(OK, (os_setperm('unit-test-directory/test.file', perm))) - eq(1, os_file_is_writable('unit-test-directory/test.file')) - eq(false, os_file_is_readonly('unit-test-directory/test.file')) - end) - - it('returns true if the file is read-only', function() - local perm = os_getperm('unit-test-directory/test.file') - local perm_orig = perm - perm = unset_bit(perm, ffi.C.kS_IWUSR) - perm = unset_bit(perm, ffi.C.kS_IWGRP) - perm = unset_bit(perm, ffi.C.kS_IWOTH) - - eq(OK, (os_setperm('unit-test-directory/test.file', perm))) - eq(true, os_file_is_readonly('unit-test-directory/test.file')) - eq(OK, (os_setperm('unit-test-directory/test.file', perm_orig))) - end) - - it('returns false if the file is read-write', function() - eq(false, os_file_is_readonly('unit-test-directory/test.file')) - end) - end) describe('os_file_is_readable', function() it('returns false if the file is not readable', function() |