aboutsummaryrefslogtreecommitdiff
path: root/test/unit/os
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-06-22 01:01:21 +0300
committerZyX <kp-pav@yandex.ru>2016-06-24 00:07:54 +0300
commitfec7983ecd7ac58f4f8ad9f8b4dc8f6937b87099 (patch)
tree263f4d0c65266b90ab414c1c9b9e948725bfe49a /test/unit/os
parent3e7c8e714915672a032eef2950b25264a3c91c58 (diff)
downloadrneovim-fec7983ecd7ac58f4f8ad9f8b4dc8f6937b87099.tar.gz
rneovim-fec7983ecd7ac58f4f8ad9f8b4dc8f6937b87099.tar.bz2
rneovim-fec7983ecd7ac58f4f8ad9f8b4dc8f6937b87099.zip
unittests: Add tests for file.c
Also fixes some errors found.
Diffstat (limited to 'test/unit/os')
-rw-r--r--test/unit/os/fs_spec.lua29
1 files changed, 7 insertions, 22 deletions
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua
index d7e98b43ce..1f7f6fb791 100644
--- a/test/unit/os/fs_spec.lua
+++ b/test/unit/os/fs_spec.lua
@@ -6,6 +6,7 @@ local helpers = require('test.unit.helpers')
local cimport = helpers.cimport
local cppimport = helpers.cppimport
local internalize = helpers.internalize
+local ok = helpers.ok
local eq = helpers.eq
local neq = helpers.neq
local ffi = helpers.ffi
@@ -17,10 +18,6 @@ local NULL = helpers.NULL
local NODE_NORMAL = 0
local NODE_WRITABLE = 1
-local function ok(expr)
- assert.is_true(expr)
-end
-
cimport('unistd.h')
cimport('./src/nvim/os/shell.h')
cimport('./src/nvim/option_defs.h')
@@ -31,6 +28,12 @@ cppimport('sys/stat.h')
cppimport('fcntl.h')
cppimport('uv-errno.h')
+local s = ''
+for i = 0, 255 do
+ s = s .. (i == 0 and '\0' or ('%c'):format(i))
+end
+local fcontents = s:rep(16)
+
local buffer = ""
local directory = nil
local absolute_executable = nil
@@ -547,12 +550,6 @@ describe('fs function', function()
describe('os_read', function()
local file = 'test-unit-os-fs_spec-os_read.dat'
- local s = ''
- for i = 0, 255 do
- s = s .. (i == 0 and '\0' or ('%c'):format(i))
- end
- local fcontents = s:rep(16)
-
before_each(function()
local f = io.open(file, 'w')
f:write(fcontents)
@@ -607,12 +604,6 @@ describe('fs function', function()
end
local file = 'test-unit-os-fs_spec-os_readv.dat'
- local s = ''
- for i = 0, 255 do
- s = s .. (i == 0 and '\0' or ('%c'):format(i))
- end
- local fcontents = s:rep(16)
-
before_each(function()
local f = io.open(file, 'w')
f:write(fcontents)
@@ -673,12 +664,6 @@ describe('fs function', function()
-- Function may be absent
local file = 'test-unit-os-fs_spec-os_write.dat'
- local s = ''
- for i = 0, 255 do
- s = s .. (i == 0 and '\0' or ('%c'):format(i))
- end
- local fcontents = s:rep(16)
-
before_each(function()
local f = io.open(file, 'w')
f:write(fcontents)