aboutsummaryrefslogtreecommitdiff
path: root/test/unit/os/fileio_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-07-04 17:03:07 +0300
committerZyX <kp-pav@yandex.ru>2017-07-04 18:37:01 +0300
commit5ab9e9f617934fae8f85ceb6db398dbf1e93471d (patch)
tree98a9aa561834cf61459cec70c5e6e75b36d11ade /test/unit/os/fileio_spec.lua
parent94bd0f9915b0515fde449e3ee003ecbff3ad1b42 (diff)
downloadrneovim-5ab9e9f617934fae8f85ceb6db398dbf1e93471d.tar.gz
rneovim-5ab9e9f617934fae8f85ceb6db398dbf1e93471d.tar.bz2
rneovim-5ab9e9f617934fae8f85ceb6db398dbf1e93471d.zip
os/fileio: Add msgpack_file_write function
Diffstat (limited to 'test/unit/os/fileio_spec.lua')
-rw-r--r--test/unit/os/fileio_spec.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/os/fileio_spec.lua b/test/unit/os/fileio_spec.lua
index e3c8e616ce..a33a9637ee 100644
--- a/test/unit/os/fileio_spec.lua
+++ b/test/unit/os/fileio_spec.lua
@@ -62,6 +62,10 @@ local function file_write(fp, buf)
return m.file_write(fp, buf, #buf)
end
+local function msgpack_file_write(fp, buf)
+ return m.msgpack_file_write(fp, buf, #buf)
+end
+
local function file_read(fp, size)
local buf = nil
if size == nil then
@@ -393,6 +397,18 @@ describe('file_write', function()
end)
end)
+describe('msgpack_file_write', function()
+ itp('can write the whole file at once', function()
+ local err, fp = file_open(filec, m.kFileCreateOnly, 384)
+ eq(0, err)
+ eq(true, fp.wr)
+ local wr = msgpack_file_write(fp, fcontents)
+ eq(0, wr)
+ eq(0, m.file_close(fp, false))
+ eq(fcontents, io.open(filec):read('*a'))
+ end)
+end)
+
describe('file_skip', function()
itp('can skip 3 bytes', function()
local err, fp = file_open(file1, 0, 384)