diff --git a/spec/Invoker_spec.lua b/spec/Invoker_spec.lua index 44cf967..781bf01 100644 --- a/spec/Invoker_spec.lua +++ b/spec/Invoker_spec.lua @@ -5,6 +5,7 @@ context( 'Invoker', function() local MyClass = class('MyClass') MyClass:include(Invoker) function MyClass:foo(x,y) return 'foo ' .. tostring(x) .. ', ' .. tostring(y) end + function MyClass:testSelf() return instanceOf(MyClass, self) end local obj = MyClass:new() @@ -22,5 +23,10 @@ context( 'Invoker', function() 'bar 3, 4' ) end) + + test('It should use self as implicit parameter in all cases', function() + assert_true(obj:invoke('testSelf')) + assert_true(obj:invoke(MyClass.testSelf)) + end) end)