diff options
Diffstat (limited to 'builtin/common/tests/serialize_spec.lua')
-rw-r--r-- | builtin/common/tests/serialize_spec.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/builtin/common/tests/serialize_spec.lua b/builtin/common/tests/serialize_spec.lua index 17c6a60f7..e46b7dcc5 100644 --- a/builtin/common/tests/serialize_spec.lua +++ b/builtin/common/tests/serialize_spec.lua @@ -3,6 +3,7 @@ _G.core = {} _G.setfenv = require 'busted.compatibility'.setfenv dofile("builtin/common/serialize.lua") +dofile("builtin/common/vector.lua") describe("serialize", function() it("works", function() @@ -53,4 +54,16 @@ describe("serialize", function() assert.is_nil(test_out.func) assert.equals(test_out.foo, "bar") end) + + it("vectors work", function() + local v = vector.new(1, 2, 3) + assert.same({{x = 1, y = 2, z = 3}}, core.deserialize(core.serialize({v}))) + assert.same({x = 1, y = 2, z = 3}, core.deserialize(core.serialize(v))) + + -- abuse + v = vector.new(1, 2, 3) + v.a = "bla" + assert.same({x = 1, y = 2, z = 3, a = "bla"}, + core.deserialize(core.serialize(v))) + end) end) |