mirror of
https://github.com/gvx/bitser.git
synced 2025-01-16 03:24:19 +00:00
Add a test for rxi/classic
This commit is contained in:
parent
608c1c4792
commit
3fd140cb28
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ luacov.*.out
|
||||
# optional class libraries, used for testing
|
||||
class.lua
|
||||
slither.lua
|
||||
classic.lua
|
||||
|
@ -8,3 +8,4 @@ luarocks install luacov-coveralls
|
||||
luarocks install middleclass
|
||||
wget https://raw.githubusercontent.com/bartbes/slither/b9cf6daa1e8995093aa80a40ee9ff98402eeb602/slither.lua
|
||||
wget https://raw.githubusercontent.com/vrld/hump/038bc9025f1cb850355f4b073357b087b8122da9/class.lua
|
||||
wget https://raw.githubusercontent.com/rxi/classic/e5610756c98ac2f8facd7ab90c94e1a097ecd2c6/classic.lua
|
||||
|
@ -195,6 +195,18 @@ describe("bitser", function()
|
||||
assert.are.equal(new_bojack.__class, Horse)
|
||||
bitser.unregisterClass('Horse')
|
||||
end)
|
||||
it("serializes Classic instances", function()
|
||||
local Object = require("classic")
|
||||
local Horse = bitser.registerClass('Horse', Object:extend())
|
||||
function Horse:new(name)
|
||||
self.name = name
|
||||
self[1] = 'instance can be sequence'
|
||||
end
|
||||
local bojack = Horse('Bojack Horseman')
|
||||
test_serdeser(bojack)
|
||||
assert.are.equal(getmetatable(serdeser(bojack)), Horse)
|
||||
bitser.unregisterClass('Horse')
|
||||
end)
|
||||
it("serializes custom class instances", function()
|
||||
local Horse_mt = bitser.registerClass('Horse', {__index = {}}, nil, setmetatable)
|
||||
local function Horse(name)
|
||||
|
Loading…
Reference in New Issue
Block a user