aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Wienecke <wienecke.t@gmail.com>2014-03-14 22:55:14 +0100
committerThiago de Arruda <tpadilha84@gmail.com>2014-03-15 11:50:22 -0300
commit1949acc806e89dc0d2766b2b41eae1cac3186642 (patch)
tree1baad3b84e7ce42b7394e8ccc66670845cc5ccaf /test
parentc83e8b4dc74ba010e0279b67ef8ffa14103d89f6 (diff)
downloadrneovim-1949acc806e89dc0d2766b2b41eae1cac3186642.tar.gz
rneovim-1949acc806e89dc0d2766b2b41eae1cac3186642.tar.bz2
rneovim-1949acc806e89dc0d2766b2b41eae1cac3186642.zip
Revive vim_fname (-> os_file_exists); fix misuse of mch_getperm.
* Move vim_fname from misc1 to os/fs:os_file_exists. * Add unit tests for os_file_exists. * Replace misuse of mch_getperm with os_file_exists.
Diffstat (limited to 'test')
-rw-r--r--test/unit/os/fs.moon11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/os/fs.moon b/test/unit/os/fs.moon
index c111c89049..30e6abb31c 100644
--- a/test/unit/os/fs.moon
+++ b/test/unit/os/fs.moon
@@ -18,6 +18,7 @@ int is_executable(char_u *name);
int mch_can_exe(char_u *name);
long mch_getperm(char_u *name);
int mch_setperm(char_u *name, long perm);
+int os_file_exists(const char_u *name);
]]
-- import constants parsed by ffi
@@ -320,3 +321,13 @@ describe 'fs function', ->
it 'fails if given file does not exist', ->
perm = ffi.C.kS_IXUSR
eq FAIL, (mch_setperm 'non-existing-file', perm)
+
+ describe 'os_file_exists', ->
+ os_file_exists = (filename) ->
+ fs.os_file_exists (to_cstr filename)
+
+ it 'returns FALSE when given a non-existing file', ->
+ eq FALSE, (os_file_exists 'non-existing-file')
+
+ it 'returns TRUE when given an existing file', ->
+ eq TRUE, (os_file_exists 'unit-test-directory/test.file')