From 3b8dae1dded4a3e558184c8bb2bbd289a50319d4 Mon Sep 17 00:00:00 2001 From: Robin Wellner Date: Mon, 31 Oct 2016 12:20:29 +0100 Subject: [PATCH] Add tests for resources whose name is also used as a string --- spec/bitser_spec.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/bitser_spec.lua b/spec/bitser_spec.lua index 08eeb12..899260b 100644 --- a/spec/bitser_spec.lua +++ b/spec/bitser_spec.lua @@ -219,6 +219,18 @@ describe("bitser", function() assert.are.equal(serdeser({this = temp_resource}).this, temp_resource) bitser.unregister("temp_resource_or_whatever") 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() assert.has_error(function() bitser.dumps(function() end) end, "cannot serialize type function") end)