diff options
author | chai <chaifix@163.com> | 2021-11-15 11:54:17 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-15 11:54:17 +0800 |
commit | 30f2f46474bf4eda5f10d4c64a07cde01d469f66 (patch) | |
tree | 6ff2ed3262037b3c9bae2d2b9059a1d65773f31c /Data/BuiltIn/Libraries/middleclass/spec/class_spec.lua | |
parent | 4c36bed53fe63ae6056730b3ecad2573f03d88f8 (diff) |
*rename DefaultContent -> BuiltIn
Diffstat (limited to 'Data/BuiltIn/Libraries/middleclass/spec/class_spec.lua')
-rw-r--r-- | Data/BuiltIn/Libraries/middleclass/spec/class_spec.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Data/BuiltIn/Libraries/middleclass/spec/class_spec.lua b/Data/BuiltIn/Libraries/middleclass/spec/class_spec.lua new file mode 100644 index 0000000..144cb9f --- /dev/null +++ b/Data/BuiltIn/Libraries/middleclass/spec/class_spec.lua @@ -0,0 +1,28 @@ +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) |