From 9d4e706b680626bd76a6b3c0804393e17a11f1fd Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Tue, 29 Sep 2020 00:51:08 +0300 Subject: [PATCH] tmp --- tests/test-class5.lua | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/tests/test-class5.lua b/tests/test-class5.lua index d6057033..d696901c 100644 --- a/tests/test-class5.lua +++ b/tests/test-class5.lua @@ -2,25 +2,35 @@ -- while also using a table for input methods. local class = require('pl.class') +-- From a plain table of methods local A = class({ + info = "foo", _init = function (self) self.info = "A" end }) +-- From a plain table of methods, inherit from a base local B = class(A, nil, { _init = function(self) - self:super() + print("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") + -- self._base._init(self) + -- self:super() self.info = self.info .. "B" end }) -local C = class(B, nil, { - _init = function(self) - self:super() - self.info = self.info .. "C" - end - }) +-- -- From a base plus a plain table +-- local C = class(B, nil, { +-- -- local C = class({ +-- -- _base = B, +-- _init = function(self) +-- -- self._base._init(self) +-- -- self:super() +-- self.info = self.info .. "C" +-- end +-- }) -local foo = C() -assert(foo.ino == "ABC") +local foo = B() +print("DEBUG:"..foo.info) +assert(foo.info == "AB")