diff --git a/spec/bitser_spec.lua b/spec/bitser_spec.lua index a14b124..437b410 100644 --- a/spec/bitser_spec.lua +++ b/spec/bitser_spec.lua @@ -1,14 +1,5 @@ -local bitser = require 'bitser' local ffi = require 'ffi' -local function serdeser(value) - return bitser.loads(bitser.dumps(value)) -end - -local function test_serdeser(value) - assert.are.same(serdeser(value), value) -end - love = {filesystem = {newFileData = function() return {getPointer = function() local buf = ffi.new("uint8_t[?]", #love.s) @@ -17,10 +8,20 @@ love = {filesystem = {newFileData = function() end, getSize = function() return #love.s end} -end, write = function(s) +end, write = function(fname, s) love.s = s end}} +local bitser = require 'bitser' + +local function serdeser(value) + return bitser.loads(bitser.dumps(value)) +end + +local function test_serdeser(value) + assert.are.same(serdeser(value), value) +end + describe("bitser", function() it("serializes simple values", function() test_serdeser(true)