diff options
author | ZyX <kp-pav@yandex.ru> | 2016-06-23 22:25:35 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2016-06-24 00:07:56 +0300 |
commit | a3b05a03b62b2c5be92a63ba3890b0359a335ba7 (patch) | |
tree | 663f7369d68ce90e483c336a1a7de478781ab111 /test/unit/os/fileio_spec.lua | |
parent | 2dd154457ceb4bbc122b9e1ad34bf693ee3dd510 (diff) | |
download | rneovim-a3b05a03b62b2c5be92a63ba3890b0359a335ba7.tar.gz rneovim-a3b05a03b62b2c5be92a63ba3890b0359a335ba7.tar.bz2 rneovim-a3b05a03b62b2c5be92a63ba3890b0359a335ba7.zip |
unittests: Fix bug somewhere that makes file_read tests SEGV
Diffstat (limited to 'test/unit/os/fileio_spec.lua')
-rw-r--r-- | test/unit/os/fileio_spec.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/unit/os/fileio_spec.lua b/test/unit/os/fileio_spec.lua index 22b61786c0..3f0bd16e6c 100644 --- a/test/unit/os/fileio_spec.lua +++ b/test/unit/os/fileio_spec.lua @@ -67,7 +67,10 @@ local function file_read(fp, size) if size == nil then size = 0 else - buf = ffi.new('char[?]', size, ('\0'):rep(size)) + -- For some reason if length of NUL-bytes-string is the same as `char[?]` + -- size luajit garbage collector crashes. But it does not do so in + -- os_read[v] tests in os/fs_spec.lua. + buf = ffi.new('char[?]', size + 1, ('\0'):rep(size)) end local ret1 = m.file_read(fp, buf, size) local ret2 = '' |