aboutsummaryrefslogtreecommitdiff
path: root/test/unit/helpers.moon
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/helpers.moon')
-rw-r--r--test/unit/helpers.moon8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/unit/helpers.moon b/test/unit/helpers.moon
index c12a6473f6..b1670d01ea 100644
--- a/test/unit/helpers.moon
+++ b/test/unit/helpers.moon
@@ -30,11 +30,17 @@ internalize = (cdata) ->
ffi.gc cdata, ffi.C.free
return ffi.string cdata
+cstr = ffi.typeof 'char[?]'
+
+to_cstr = (string) ->
+ cstr (string.len string) + 1, string
+
return {
cimport: cimport
internalize: internalize
eq: (expected, actual) -> assert.are.same expected, actual
ffi: ffi
lib: libnvim
- cstr: ffi.typeof 'char[?]'
+ cstr: cstr
+ to_cstr: to_cstr
}