Pop.Box/spec/class_spec.lua
Paul Liverman III 8ea4b63878 Squashed 'src/lib/middleclass/' content from commit 27a64f1
git-subtree-dir: src/lib/middleclass
git-subtree-split: 27a64f107e61532006030a6168e4fe6a71eee9a2
2017-10-10 00:17:15 -07:00

29 lines
849 B
Lua

local class = require 'middleclass'
describe('class()', function()
describe('when given no params', function()
it('it throws an error', function()
assert.error(class)
end)
end)
describe('when given a name', function()
it('the resulting class has the correct name and Object as its superclass', function()
local TheClass = class('TheClass')
assert.equal(TheClass.name, 'TheClass')
assert.is_nil(TheClass.super)
end)
end)
describe('when given a name and a superclass', function()
it('the resulting class has the correct name and superclass', function()
local TheSuperClass = class('TheSuperClass')
local TheSubClass = class('TheSubClass', TheSuperClass)
assert.equal(TheSubClass.name, 'TheSubClass')
assert.equal(TheSubClass.super, TheSuperClass)
end)
end)
end)