From 776b056d697fc00bb45247e7c7e53fba338ce324 Mon Sep 17 00:00:00 2001 From: "R.E.J. Wellner" Date: Tue, 28 Apr 2020 17:11:46 +0200 Subject: [PATCH] either i don't understand luaspec or i'm losing my mind --- spec/bitser_spec.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spec/bitser_spec.lua b/spec/bitser_spec.lua index cdf33e5..4d71ba3 100644 --- a/spec/bitser_spec.lua +++ b/spec/bitser_spec.lua @@ -302,21 +302,25 @@ describe("bitser", function() it("can read and write simple cdata", function() test_serdeser(ffi.new('double', 42.5)) end) - before = function () - ffi.cdef[[ + it("can read and write cdata with a registered ctype", function() + pcall(ffi.cdef,[[ struct some_struct { int a; double b; }; - ]] - end - it("can read and write cdata with a registered ctype", function() + ]]) local value = ffi.new('struct some_struct', 42, 1.25) bitser.register('struct_type', ffi.typeof(value)) test_serdeser(value) bitser.unregister('struct_type') end) it("can read and write cdata without registering its ctype", function() + pcall(ffi.cdef,[[ + struct some_struct { + int a; + double b; + }; + ]]) local value = ffi.new('struct some_struct', 42, 1.25) test_serdeser(value) end)