Add tests for resources whose name is also used as a string

This commit is contained in:
Robin Wellner 2016-10-31 12:20:29 +01:00
parent 714a51faed
commit 3b8dae1dde

View File

@ -219,6 +219,18 @@ describe("bitser", function()
assert.are.equal(serdeser({this = temp_resource}).this, temp_resource) assert.are.equal(serdeser({this = temp_resource}).this, temp_resource)
bitser.unregister("temp_resource_or_whatever") bitser.unregister("temp_resource_or_whatever")
end) end)
it("serializes resources with the same name as serialized strings", function()
local temp_resource = {}
bitser.register('temp', temp_resource)
test_serdeser({temp='temp', {temp_resource}})
bitser.unregister('temp')
end)
it("serializes resources with the same long name as serialized strings", function()
local temp_resource = {}
bitser.register('temp_resource_or_whatever', temp_resource)
test_serdeser({temp_resource_or_whatever='temp_resource_or_whatever', {temp_resource}})
bitser.unregister('temp_resource_or_whatever')
end)
it("cannot serialize functions", function() it("cannot serialize functions", function()
assert.has_error(function() bitser.dumps(function() end) end, "cannot serialize type function") assert.has_error(function() bitser.dumps(function() end) end, "cannot serialize type function")
end) end)