|
@@ -301,21 +301,20 @@ $core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "performTest",
|
|
|
protocol: "running",
|
|
|
-fn: function (){
|
|
|
+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;
|
|
|
+return $self._perform_($self._selector());
|
|
|
//>>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",
|
|
|
+source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09^ self perform: self selector",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
messageSends: ["perform:", "selector"]
|
|
@@ -815,13 +814,13 @@ $core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "execute:",
|
|
|
protocol: "running",
|
|
|
-fn: function (aBlock){
|
|
|
+fn: function(aBlock){
|
|
|
var self=this,$self=this;
|
|
|
-var failed;
|
|
|
+var failed,returned;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-var $1,$2;
|
|
|
+var $1,$2,$3,$4,$5;
|
|
|
$recv($self["@testCase"])._context_(self);
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
$ctx1.sendIdx["context:"]=1;
|
|
@@ -832,9 +831,58 @@ return $core.withContext(function($ctx2) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
failed=true;
|
|
|
failed;
|
|
|
-$recv(aBlock)._value();
|
|
|
+returned=$recv(aBlock)._value();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx2.sendIdx["value"]=1;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+returned;
|
|
|
failed=false;
|
|
|
-return failed;
|
|
|
+failed;
|
|
|
+$1=$recv(returned)._isKindOf_($globals.Promise);
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx2.sendIdx["isKindOf:"]=1;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv($globals.Transcript)._show_($1);
|
|
|
+$recv($globals.Transcript)._cr();
|
|
|
+$2=$recv(returned)._isKindOf_($globals.Promise);
|
|
|
+if($core.assert($2)){
|
|
|
+$3=$recv($self["@testCase"])._isAsync();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx2.sendIdx["isAsync"]=1;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+if(!$core.assert($3)){
|
|
|
+$recv($self["@testCase"])._timeout_((2000));
|
|
|
+}
|
|
|
+return $recv(returned)._then_catch_((function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv($self["@testCase"])._finished();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx3.sendIdx["finished"]=1;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}),(function(e){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv(e)._inspect();
|
|
|
+return $recv($recv($self["@testCase"])._async_((function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx4) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv(e)._resignal();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+})))._value();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+}
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
//>>excludeEnd("ctx");
|
|
@@ -843,40 +891,40 @@ return failed;
|
|
|
return $core.withContext(function($ctx2) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
$recv($self["@testCase"])._context_(nil);
|
|
|
-$1=$recv(failed)._and_((function(){
|
|
|
+$4=$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;
|
|
|
+$ctx3.sendIdx["isAsync"]=2;
|
|
|
//>>excludeEnd("ctx");
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,8)});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}));
|
|
|
-if($core.assert($1)){
|
|
|
+if($core.assert($4)){
|
|
|
$recv($self["@testCase"])._finished();
|
|
|
}
|
|
|
-$2=$recv($self["@testCase"])._isAsync();
|
|
|
-if(!$core.assert($2)){
|
|
|
+$5=$recv($self["@testCase"])._isAsync();
|
|
|
+if(!$core.assert($5)){
|
|
|
return $recv($self["@testCase"])._tearDown();
|
|
|
}
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}));
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed,returned:returned},$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: [],
|
|
|
+source: "execute: aBlock\x0a\x09| failed returned |\x0a\x09\x0a\x09testCase context: self.\x0a\x09[\x0a\x09\x09failed := true.\x0a\x09\x09returned := aBlock value.\x0a\x09\x09failed := false.\x0a\x09\x09Transcript show: (returned isKindOf: Promise); cr.\x0a\x09\x09(returned isKindOf: Promise) ifTrue: [\x0a\x09\x09\x09testCase isAsync ifFalse: [ testCase timeout: 2000 ]. \x22Set a default timeout if there wasn't one already.\x22\x0a\x09\x09\x09returned then: [ testCase finished ] catch: [ :e | e inspect. (testCase async: [ e resignal ]) value ] ].\x0a\x09\x09\x09\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase context: nil.\x0a\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: ["Transcript", "Promise"],
|
|
|
//>>excludeEnd("ide");
|
|
|
-messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
|
|
|
+messageSends: ["context:", "ensure:", "value", "show:", "isKindOf:", "cr", "ifTrue:", "ifFalse:", "isAsync", "timeout:", "then:catch:", "finished", "inspect", "async:", "resignal", "and:", "tearDown"]
|
|
|
}),
|
|
|
$globals.TestContext);
|
|
|
|