I hope it'll recognise the global now...

This commit is contained in:
Robin Wellner 2016-02-23 14:37:22 +01:00
parent 95e58fb654
commit d6ac0e2636

View File

@ -1,14 +1,5 @@
local bitser = require 'bitser'
local ffi = require 'ffi' 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() love = {filesystem = {newFileData = function()
return {getPointer = function() return {getPointer = function()
local buf = ffi.new("uint8_t[?]", #love.s) local buf = ffi.new("uint8_t[?]", #love.s)
@ -17,10 +8,20 @@ love = {filesystem = {newFileData = function()
end, getSize = function() end, getSize = function()
return #love.s return #love.s
end} end}
end, write = function(s) end, write = function(fname, s)
love.s = s love.s = s
end}} 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() describe("bitser", function()
it("serializes simple values", function() it("serializes simple values", function()
test_serdeser(true) test_serdeser(true)