"Add root for test classes" Object subclass: #TestStRoot. NSObject subclass: #TestNSRoot.
Object>>#boom Number>>#boom | Generate garbage |
Object class>>#build:subclasses: | Create multiple subclasses of the receiver |
"Add testing methods" self nativeCodeFollows! smalltalk.bind(smalltalk.Object,"boom",0 ,function () {var self=this;return smalltalk.Smalltalk.classes().inject_into_("", (function(total,each){return total._comma(each.name())._comma(each.selectors().printString());}));;return self;} ,"garbage",unescape("boom%0D%0A%09%22%20Generate%20some%20garbage.%20%22%0D%0A%0D%0A%09%5ESmalltalk%20classes%20inject%3A%20%27%27%20into%3A%20%5B%3Atotal%20%3Aeach%7C%0D%0A%09%09total%09%2Ceach%20name%0D%0A%09%09%09%2Ceach%20selectors%20printString%0D%0A%09%5D")); smalltalk.bind(smalltalk.Number,"boom",0 ,function () {var self=this;self.timesRepeat_((function(i){self.print_(i);return smalltalk.whoImplements(smalltalk.Number,'boom').$superclass.$fn.prototype['boom'].apply(self, []).reversed();}));return self;} ,"garbage",unescape("boom%0D%0A%09%22%20Generate%20more%20garbage.%20%22%0D%0A%0D%0A%09self%20timesRepeat%3A%20%5B%3Ai%7C%0D%0A%09%09self%20print%3A%20i.%0D%0A%09%09super%20boom%20reversed%0D%0A%09%5D.")); smalltalk.bind(smalltalk.Object.$klass,"build:subclasses:",0 ,function (tag, count) {var self=this;count.timesRepeat_((function(i){var clsName=nil;clsName="Test"._comma(tag)._comma(i.asString());return self.subclass_category_(clsName, "testing");})); smalltalk.Coco8Implementation.launch(); self.print_(unescape("Class%20count%3D")._comma(smalltalk.Smalltalk.classes().size()));return self;} ,"testing",unescape("build%3A%20tag%20subclasses%3A%20count%0D%0A%09%22%20Generate%20testing%20classes.%20%22%0D%0A%0D%0A%09count%20timesRepeat%3A%20%5B%3Ai%7C%20%7C%20clsName%20%7C%0D%0A%09%09clsName%20%3A%3D%20%23Test%20%2Ctag%20%2C%20i%20asString.%0D%0A%09%09%22%22self%20subclass%3A%20clsName%20category%3A%20%23testing%22%0D%0A%09%09%7B%27%20smalltalk.addClass%28clsName%2Cself%2C%27testing%27%29%3B%27%7D%22%0D%0A%09%5D.%0D%0A%09Coco8Implementation%20launch.%0D%0A%20%20%20%20%20%20%20%20self%20print%3A%20%27Class%20count%3D%27%2CSmalltalk%20classes%20size")); /* original s8 code... ! Object methodsFor: #garbage ! boom " Generate some garbage. " ^Smalltalk classes inject: '' into: [:total :each| total ,each name ,each selectors printString ]! ! ! Number methodsFor: #garbage ! boom " Generate more garbage. " self timesRepeat: [:i| self print: i. super boom reversed ].! ! ! Object class methodsFor: #testing ! build: tag subclasses: count " Generate testing classes. " count timesRepeat: [:i| | clsName | clsName := #Test ,tag , i asString. ""self subclass: clsName category: #testing" {' smalltalk.addClass(clsName,self,'testing');'}" ]. Coco8Implementation launch. self print: 'Class count=',Smalltalk classes size! ! */