diff options
author | ZyX <kp-pav@yandex.ru> | 2017-04-08 04:31:02 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-04-09 03:36:17 +0300 |
commit | 44cd4e63f58fe240b1d8259600a60757f1bd2ce8 (patch) | |
tree | a16e380afe0773f8f4526dd7a20d86d614c20021 | |
parent | 94c1af7c41d9303884b8d9f948b81b1db68e5ab1 (diff) | |
download | rneovim-44cd4e63f58fe240b1d8259600a60757f1bd2ce8.tar.gz rneovim-44cd4e63f58fe240b1d8259600a60757f1bd2ce8.tar.bz2 rneovim-44cd4e63f58fe240b1d8259600a60757f1bd2ce8.zip |
unittests: Use Neovim memory allocation for vimconv_T
Not sure whether this is going to fix things though, but core dump does not
contain Neovim functions in stack in this case.
-rw-r--r-- | test/unit/eval/typval_spec.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test/unit/eval/typval_spec.lua b/test/unit/eval/typval_spec.lua index e26e1c918f..53ef299fce 100644 --- a/test/unit/eval/typval_spec.lua +++ b/test/unit/eval/typval_spec.lua @@ -743,10 +743,13 @@ describe('typval.c', function() collectgarbage() end) itp('copies list correctly and converts items', function() - local vc = ffi.gc(ffi.new('vimconv_T[1]'), function(vc) - lib.convert_setup(vc, nil, nil) - end) - -- UTF-8 ↔ latin1 conversions need no iconv + local vc = ffi.gc( + ffi.cast('vimconv_T*', lib.xcalloc(1, ffi.sizeof('vimconv_T'))), + function(vc) + lib.convert_setup(vc, nil, nil) + lib.xfree(vc) + end) + -- UTF-8 ↔ latin1 conversions needs no iconv eq(OK, lib.convert_setup(vc, to_cstr('utf-8'), to_cstr('latin1'))) local v = {{['«']='»'}, {'„'}, 1, '“', null_string, null_list, null_dict} |