12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820 |
- define(["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
- if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
- if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
- var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
- if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
- $core.addPackage("SUnit");
- $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
- $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.ResultAnnouncement.comment="I get signaled when a `TestCase` has been run.\x0a\x0aMy instances hold the result (instance of `TestResult`) of the test run.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "result",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@result"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "result\x0a\x09^ result",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ResultAnnouncement);
- $core.addMethod(
- $core.method({
- selector: "result:",
- protocol: "accessing",
- fn: function (aTestResult){
- var self=this,$self=this;
- $self["@result"]=aTestResult;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aTestResult"],
- source: "result: aTestResult\x0a\x09result := aTestResult",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ResultAnnouncement);
- $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.TestCase.comment="I am an implementation of the command pattern to run a test.\x0a\x0a## API\x0a\x0aMy instances are created with the class method `#selector:`,\x0apassing the symbol that names the method to be executed when the test case runs.\x0a\x0aWhen you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.\x0aAs that method develops and more `#test...` methods are added, you will find yourself refactoring temps\x0ainto instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.\x0aAs required, override `#tearDown` to nil references, release objects and deallocate.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "assert:",
- protocol: "testing",
- fn: function (aBoolean){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._assert_description_(aBoolean,"Assertion failed");
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBoolean"],
- source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["assert:description:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "assert:description:",
- protocol: "testing",
- fn: function (aBoolean,aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- if(!$core.assert(aBoolean)){
- $self._signalFailure_(aString);
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBoolean", "aString"],
- source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifFalse:", "signalFailure:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "assert:equals:",
- protocol: "testing",
- fn: function (actual,expected){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$5,$4,$3,$2;
- $1=$recv(actual).__eq(expected);
- $5=$recv(expected)._printString();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["printString"]=1;
- //>>excludeEnd("ctx");
- $4="Expected: ".__comma($5);
- $3=$recv($4).__comma(" but was: ");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx[","]=2;
- //>>excludeEnd("ctx");
- $2=$recv($3).__comma($recv(actual)._printString());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx[","]=1;
- //>>excludeEnd("ctx");
- return $self._assert_description_($1,$2);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["actual", "expected"],
- source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["assert:description:", "=", ",", "printString"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "async:",
- protocol: "async",
- fn: function (aBlock){
- var self=this,$self=this;
- var c;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $self._errorIfNotAsync_("#async");
- c=$self["@context"];
- return (function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $1=$self._isAsync();
- if($core.assert($1)){
- return $recv(c)._execute_(aBlock);
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- });
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: "accessing",
- fn: function (aRunningTestContext){
- var self=this,$self=this;
- $self["@context"]=aRunningTestContext;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aRunningTestContext"],
- source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "deny:",
- protocol: "testing",
- fn: function (aBoolean){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._assert_($recv(aBoolean)._not());
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBoolean"],
- source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["assert:", "not"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "errorIfNotAsync:",
- protocol: "error handling",
- fn: function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._isAsync();
- if(!$core.assert($1)){
- $self._error_($recv(aString).__comma(" used without prior #timeout:"));
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifFalse:", "isAsync", "error:", ","]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "finished",
- protocol: "async",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._errorIfNotAsync_("#finished");
- $self["@asyncTimeout"]=nil;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["errorIfNotAsync:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "isAsync",
- protocol: "testing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self["@asyncTimeout"])._notNil();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isAsync\x0a\x09^ asyncTimeout notNil",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["notNil"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "performTest",
- protocol: "running",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self["@asyncTimeout"]=nil;
- $self._perform_($self._selector());
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["perform:", "selector"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "runCase",
- protocol: "running",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($recv($globals.TestContext)._testCase_(self))._start();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
- referencedClasses: ["TestContext"],
- //>>excludeEnd("ide");
- messageSends: ["start", "testCase:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@testSelector"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "selector\x0a\x09^ testSelector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "setTestSelector:",
- protocol: "accessing",
- fn: function (aSelector){
- var self=this,$self=this;
- $self["@testSelector"]=aSelector;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aSelector"],
- source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "setUp",
- protocol: "running",
- fn: function (){
- var self=this,$self=this;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "setUp",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "should:",
- protocol: "testing",
- fn: function (aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._assert_($recv(aBlock)._value());
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "should: aBlock\x0a\x09self assert: aBlock value",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["assert:", "value"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "should:raise:",
- protocol: "testing",
- fn: function (aBlock,anExceptionClass){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._assert_($recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $recv(aBlock)._value();
- return false;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._on_do_(anExceptionClass,(function(ex){
- return true;
- })));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock", "anExceptionClass"],
- source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["assert:", "on:do:", "value"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "shouldnt:raise:",
- protocol: "testing",
- fn: function (aBlock,anExceptionClass){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._assert_($recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $recv(aBlock)._value();
- return true;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._on_do_(anExceptionClass,(function(ex){
- return false;
- })));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock", "anExceptionClass"],
- source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["assert:", "on:do:", "value"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "signalFailure:",
- protocol: "private",
- fn: function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$recv($globals.TestFailure)._new();
- $recv($1)._messageText_(aString);
- $recv($1)._signal();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
- referencedClasses: ["TestFailure"],
- //>>excludeEnd("ide");
- messageSends: ["messageText:", "new", "signal"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "tearDown",
- protocol: "running",
- fn: function (){
- var self=this,$self=this;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "tearDown",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "timeout:",
- protocol: "async",
- fn: function (aNumber){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self["@asyncTimeout"];
- if(($receiver = $1) == null || $receiver.a$nil){
- $1;
- } else {
- $recv($self["@asyncTimeout"])._clearTimeout();
- }
- $self["@asyncTimeout"]=(0);
- $self["@asyncTimeout"]=$recv($self._async_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._assert_description_(false,"SUnit grace time exhausted");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- })))._valueWithTimeout_(aNumber);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNumber"],
- source: "timeout: aNumber\x0a\x09\x22Set a grace time timeout in milliseconds to run the test asynchronously\x22\x0a\x09\x0a\x09asyncTimeout ifNotNil: [ asyncTimeout clearTimeout ].\x0a\x09\x0a\x09\x22to allow #async: message send without throwing an error\x22\x0a\x09asyncTimeout := 0.\x0a\x09\x0a\x09asyncTimeout := (self async: [\x0a\x09\x09self assert: false description: 'SUnit grace time exhausted' ])\x0a\x09\x09\x09valueWithTimeout: aNumber",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
- }),
- $globals.TestCase);
- $core.addMethod(
- $core.method({
- selector: "allTestSelectors",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- var selectors;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- selectors=$self._testSelectors();
- $1=$self._shouldInheritSelectors();
- if($core.assert($1)){
- $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
- }
- return selectors;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
- }),
- $globals.TestCase.a$cls);
- $core.addMethod(
- $core.method({
- selector: "buildSuite",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._allTestSelectors())._collect_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._selector_(each);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["collect:", "allTestSelectors", "selector:"]
- }),
- $globals.TestCase.a$cls);
- $core.addMethod(
- $core.method({
- selector: "classTag",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return "test";
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'test'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestCase.a$cls);
- $core.addMethod(
- $core.method({
- selector: "isAbstract",
- protocol: "testing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._name()).__eq("TestCase");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isAbstract\x0a\x09^ self name = 'TestCase'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["=", "name"]
- }),
- $globals.TestCase.a$cls);
- $core.addMethod(
- $core.method({
- selector: "isTestClass",
- protocol: "testing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._isAbstract())._not();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isTestClass\x0a\x09^ self isAbstract not",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["not", "isAbstract"]
- }),
- $globals.TestCase.a$cls);
- $core.addMethod(
- $core.method({
- selector: "lookupHierarchyRoot",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $globals.TestCase;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "lookupHierarchyRoot\x0a\x09^ TestCase",
- referencedClasses: ["TestCase"],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestCase.a$cls);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: "accessing",
- fn: function (aSelector){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._new();
- $recv($1)._setTestSelector_(aSelector);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aSelector"],
- source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["setTestSelector:", "new", "yourself"]
- }),
- $globals.TestCase.a$cls);
- $core.addMethod(
- $core.method({
- selector: "shouldInheritSelectors",
- protocol: "testing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self.__tild_eq($self._lookupHierarchyRoot());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["~=", "lookupHierarchyRoot"]
- }),
- $globals.TestCase.a$cls);
- $core.addMethod(
- $core.method({
- selector: "testSelectors",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv(each)._match_("^test");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["select:", "keys", "methodDictionary", "match:"]
- }),
- $globals.TestCase.a$cls);
- $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.TestContext.comment="I govern running a particular test case.\x0a\x0aMy main added value is `#execute:` method which runs a block as a part of test case (restores context, nilling it afterwards, cleaning/calling `#tearDown` as appropriate for sync/async scenario).";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "execute:",
- protocol: "running",
- fn: function (aBlock){
- var self=this,$self=this;
- var failed;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2;
- $recv($self["@testCase"])._context_(self);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["context:"]=1;
- //>>excludeEnd("ctx");
- $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- failed=true;
- failed;
- $recv(aBlock)._value();
- failed=false;
- return failed;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._ensure_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $recv($self["@testCase"])._context_(nil);
- $1=$recv(failed)._and_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $recv($self["@testCase"])._isAsync();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx3.sendIdx["isAsync"]=1;
- //>>excludeEnd("ctx");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- //>>excludeEnd("ctx");
- }));
- if($core.assert($1)){
- $recv($self["@testCase"])._finished();
- }
- $2=$recv($self["@testCase"])._isAsync();
- if(!$core.assert($2)){
- return $recv($self["@testCase"])._tearDown();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "execute: aBlock\x0a\x09| failed |\x0a\x09\x0a\x09testCase context: self.\x0a\x09[\x0a\x09\x09failed := true.\x0a\x09\x09aBlock value.\x0a\x09\x09failed := false\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase context: nil.\x0a\x09\x09\x09\x0a\x09\x09\x09(failed and: [ testCase isAsync ]) ifTrue: [\x0a\x09\x09\x09\x09testCase finished ].\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09testCase tearDown ] ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
- }),
- $globals.TestContext);
- $core.addMethod(
- $core.method({
- selector: "start",
- protocol: "running",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._execute_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $recv($self["@testCase"])._setUp();
- return $recv($self["@testCase"])._performTest();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["execute:", "setUp", "performTest"]
- }),
- $globals.TestContext);
- $core.addMethod(
- $core.method({
- selector: "testCase:",
- protocol: "accessing",
- fn: function (aTestCase){
- var self=this,$self=this;
- $self["@testCase"]=aTestCase;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aTestCase"],
- source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestContext);
- $core.addMethod(
- $core.method({
- selector: "testCase:",
- protocol: "instance creation",
- fn: function (aTestCase){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._new();
- $recv($1)._testCase_(aTestCase);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aTestCase"],
- source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["testCase:", "new", "yourself"]
- }),
- $globals.TestContext.a$cls);
- $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.ReportingTestContext.comment="I add `TestResult` reporting to `TestContext`.\x0a\x0aErrors are caught and save into a `TestResult`,\x0aWhen test case is finished (which can be later for async tests), a callback block is executed; this is used by a `TestSuiteRunner`.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "execute:",
- protocol: "running",
- fn: function (aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._withErrorReporting_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return (
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx3.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx3.supercall = false;
- //>>excludeEnd("ctx");;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._ensure_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $1=$recv($self["@testCase"])._isAsync();
- if(!$core.assert($1)){
- $recv($self["@result"])._increaseRuns();
- return $recv($self["@finished"])._value();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- //>>excludeEnd("ctx");
- }));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "execute: aBlock\x0a\x09[\x0a\x09\x09self withErrorReporting: [ super execute: aBlock ]\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09result increaseRuns. finished value ] ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
- }),
- $globals.ReportingTestContext);
- $core.addMethod(
- $core.method({
- selector: "finished:",
- protocol: "accessing",
- fn: function (aBlock){
- var self=this,$self=this;
- $self["@finished"]=aBlock;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "finished: aBlock\x0a\x09finished := aBlock",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ReportingTestContext);
- $core.addMethod(
- $core.method({
- selector: "result:",
- protocol: "accessing",
- fn: function (aTestResult){
- var self=this,$self=this;
- $self["@result"]=aTestResult;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aTestResult"],
- source: "result: aTestResult\x0a\x09result := aTestResult",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ReportingTestContext);
- $core.addMethod(
- $core.method({
- selector: "withErrorReporting:",
- protocol: "private",
- fn: function (aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $recv($self["@result"])._addFailure_($self["@testCase"]);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._on_do_($globals.Error,(function(ex){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv($self["@result"])._addError_($self["@testCase"]);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["on:do:"]=1;
- //>>excludeEnd("ctx");
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "withErrorReporting: aBlock\x0a\x09[ aBlock\x0a\x09\x09on: TestFailure\x0a\x09\x09do: [ :ex | result addFailure: testCase ]\x0a\x09]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | result addError: testCase ]",
- referencedClasses: ["TestFailure", "Error"],
- //>>excludeEnd("ide");
- messageSends: ["on:do:", "addFailure:", "addError:"]
- }),
- $globals.ReportingTestContext);
- $core.addMethod(
- $core.method({
- selector: "testCase:result:finished:",
- protocol: "instance creation",
- fn: function (aTestCase,aTestResult,aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=(
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = false;
- //>>excludeEnd("ctx");;
- $recv($1)._result_(aTestResult);
- $recv($1)._finished_(aBlock);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aTestCase", "aTestResult", "aBlock"],
- source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["result:", "testCase:", "finished:", "yourself"]
- }),
- $globals.ReportingTestContext.a$cls);
- $core.addClass("TestFailure", $globals.Error, [], "SUnit");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.TestFailure.comment="I am raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.\x0a\x0aThe test framework distinguishes between failures and errors.\x0aA failure is an event whose possibiity is explicitly anticipated and checked for in an assertion,\x0awhereas an error is an unanticipated problem like a division by 0 or an index out of bounds.";
- //>>excludeEnd("ide");
- $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.TestResult.comment="I implement the collecting parameter pattern for running a bunch of tests.\x0a\x0aMy instances hold tests that have run, sorted into the result categories of passed, failures and errors.\x0a\x0a`TestResult` is an interesting object to subclass or substitute. `#runCase:` is the external protocol you need to reproduce";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "addError:",
- protocol: "accessing",
- fn: function (anError){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self._errors())._add_(anError);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anError"],
- source: "addError: anError\x0a\x09self errors add: anError",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["add:", "errors"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "addFailure:",
- protocol: "accessing",
- fn: function (aFailure){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self._failures())._add_(aFailure);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aFailure"],
- source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["add:", "failures"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "errors",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@errors"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "errors\x0a\x09^ errors",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "failures",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@failures"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "failures\x0a\x09^ failures",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "increaseRuns",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self["@runs"]=$recv($self["@runs"]).__plus((1));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "increaseRuns\x0a\x09runs := runs + 1",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["+"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: "initialization",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- (
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = false;
- //>>excludeEnd("ctx");;
- $self["@timestamp"]=$recv($globals.Date)._now();
- $self["@runs"]=(0);
- $self["@errors"]=$recv($globals.Array)._new();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["new"]=1;
- //>>excludeEnd("ctx");
- $self["@failures"]=$recv($globals.Array)._new();
- $self["@total"]=(0);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
- referencedClasses: ["Date", "Array"],
- //>>excludeEnd("ide");
- messageSends: ["initialize", "now", "new"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "nextRunDo:",
- protocol: "running",
- fn: function (aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $2,$1;
- $2=$self._runs();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["runs"]=1;
- //>>excludeEnd("ctx");
- $1=$recv($2).__eq_eq($self._total());
- if(!$core.assert($1)){
- return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "nextRunDo: aBlock\x0a\x09\x22Runs aBlock with index of next run or does nothing if no more runs\x22\x0a\x09^ self runs == self total\x0a\x09\x09ifFalse: [ aBlock value: self runs + 1 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "runCase:",
- protocol: "running",
- fn: function (aTestCase){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- $self._increaseRuns();
- return $recv(aTestCase)._runCase();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- //>>excludeEnd("ctx");
- }))._on_do_($globals.TestFailure,(function(ex){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $self._addFailure_(aTestCase);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._on_do_($globals.Error,(function(ex){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._addError_(aTestCase);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["on:do:"]=1;
- //>>excludeEnd("ctx");
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aTestCase"],
- source: "runCase: aTestCase\x0a\x09[ [ self increaseRuns.\x0a\x09\x09aTestCase runCase ]\x0a\x09on: TestFailure do: [ :ex | self addFailure: aTestCase ]]\x0a\x09on: Error do: [ :ex | self addError: aTestCase ]",
- referencedClasses: ["TestFailure", "Error"],
- //>>excludeEnd("ide");
- messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "runs",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@runs"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "runs\x0a\x09^ runs",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "status",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
- return "error";
- }),(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
- return "failure";
- }),(function(){
- return "success";
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
- //>>excludeEnd("ctx");
- return $1;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "timestamp",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@timestamp"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "timestamp\x0a\x09^ timestamp",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "total",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@total"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "total\x0a\x09^ total",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestResult);
- $core.addMethod(
- $core.method({
- selector: "total:",
- protocol: "accessing",
- fn: function (aNumber){
- var self=this,$self=this;
- $self["@total"]=aNumber;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNumber"],
- source: "total: aNumber\x0a\x09total := aNumber",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestResult);
- $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.TestSuiteRunner.comment="I am responsible for running a collection (`suite`) of tests.\x0a\x0a## API\x0a\x0aInstances should be created using the class-side `#on:` method, taking a collection of tests to run as parameter.\x0aTo run the test suite, use `#run`.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "announcer",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@announcer"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "announcer\x0a\x09^ announcer",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "contextOf:",
- protocol: "private",
- fn: function (anInteger){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._resume();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anInteger"],
- source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
- referencedClasses: ["ReportingTestContext"],
- //>>excludeEnd("ide");
- messageSends: ["testCase:result:finished:", "at:", "resume"]
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: "initialization",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- (
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = false;
- //>>excludeEnd("ctx");;
- $self["@announcer"]=$recv($globals.Announcer)._new();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["new"]=1;
- //>>excludeEnd("ctx");
- $self["@result"]=$recv($globals.TestResult)._new();
- $self["@runNextTest"]=(function(){
- var runs;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- runs=$recv($self["@result"])._runs();
- runs;
- $1=$recv(runs).__lt($recv($self["@result"])._total());
- if($core.assert($1)){
- return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
- //>>excludeEnd("ctx");
- });
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new.\x0a\x09result := TestResult new.\x0a\x09runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ] ].",
- referencedClasses: ["Announcer", "TestResult"],
- //>>excludeEnd("ide");
- messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "result",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@result"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "result\x0a\x09^ result",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "resume",
- protocol: "actions",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self["@runNextTest"])._fork();
- $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
- referencedClasses: ["ResultAnnouncement"],
- //>>excludeEnd("ide");
- messageSends: ["fork", "announce:", "result:", "new"]
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "run",
- protocol: "actions",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self["@result"])._total_($recv($self["@suite"])._size());
- $self._resume();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["total:", "size", "resume"]
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "suite:",
- protocol: "accessing",
- fn: function (aCollection){
- var self=this,$self=this;
- $self["@suite"]=aCollection;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aCollection"],
- source: "suite: aCollection\x0a\x09suite := aCollection",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TestSuiteRunner);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: "instance creation",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._shouldNotImplement();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "new\x0a\x09self shouldNotImplement",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["shouldNotImplement"]
- }),
- $globals.TestSuiteRunner.a$cls);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: "instance creation",
- fn: function (aCollection){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=(
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = false;
- //>>excludeEnd("ctx");;
- return $recv($1)._suite_(aCollection);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aCollection"],
- source: "on: aCollection\x0a\x09^ super new suite: aCollection",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["suite:", "new"]
- }),
- $globals.TestSuiteRunner.a$cls);
- $core.addMethod(
- $core.method({
- selector: "isTestPackage",
- protocol: "*SUnit",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._classes())._anySatisfy_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv(each)._isTestClass();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["anySatisfy:", "classes", "isTestClass"]
- }),
- $globals.Package);
- $core.addMethod(
- $core.method({
- selector: "isTestClass",
- protocol: "*SUnit",
- fn: function (){
- var self=this,$self=this;
- return false;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isTestClass\x0a\x09^ false",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.TBehaviorDefaults);
- });
|