|
@@ -15672,6 +15672,58 @@ $globals.PointTest);
|
|
|
|
|
|
|
|
|
$core.addClass("PromiseTest", $globals.TestCase, "Kernel-Tests");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseCatchOnDoWithNonLocalReturn",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseCatchOnDoWithNonLocalReturn\x0a\x09self timeout: 20.\x0a\x09^ ((Promise signal: 4) catch: [ :err | ^ 'Caught ', err asString ])\x0a\x09\x09then: [ self assert: false description: 'Should not have been resolved' ]\x0a\x09\x09on: NonLifoReturn do: [ :nonlifo | self assert: nonlifo value equals: 'Caught 4' ]",
|
|
|
+referencedClasses: ["Promise", "NonLifoReturn"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:on:do:", "catch:", "signal:", ",", "asString", "assert:description:", "assert:equals:", "value"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $early={};
|
|
|
+try {
|
|
|
+$self._timeout_((20));
|
|
|
+return $recv($recv($recv($globals.Promise)._signal_((4)))._catch_((function(err){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+throw $early=["Caught ".__comma($recv(err)._asString())];
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
|
|
|
+
|
|
|
+})))._then_on_do_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_description_(false,"Should not have been resolved");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+
|
|
|
+}),$globals.NonLifoReturn,(function(nonlifo){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_($recv(nonlifo)._value(),"Caught 4");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({nonlifo:nonlifo},$ctx1,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+}
|
|
|
+catch(e) {if(e===$early)return e[0]; throw e}
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseCatchOnDoWithNonLocalReturn",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "testPromiseExecutorAsyncDoWithNonLocalReturn",
|
|
@@ -16448,6 +16500,105 @@ return $self._assert_equals_(result,nil);
|
|
|
}; }),
|
|
|
$globals.PromiseTest);
|
|
|
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseThenCatchWithNonLocalReturn",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseThenCatchWithNonLocalReturn\x0a\x09self timeout: 20.\x0a\x09^ (Promise new then: [ ^ 'Intentional' ])\x0a\x09\x09then: [ self assert: false description: 'Should not have been resolved' ]\x0a\x09\x09catch: [ :err |\x0a\x09\x09\x09self assert: (err isKindOf: NonLifoReturn) description: 'Expected a NonLifoReturn'.\x0a\x09\x09\x09self assert: err value equals: 'Intentional' ]",
|
|
|
+referencedClasses: ["Promise", "NonLifoReturn"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:catch:", "then:", "new", "assert:description:", "isKindOf:", "assert:equals:", "value"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $early={};
|
|
|
+try {
|
|
|
+$self._timeout_((20));
|
|
|
+return $recv($recv($recv($globals.Promise)._new())._then_((function(){
|
|
|
+throw $early=["Intentional"];
|
|
|
+
|
|
|
+})))._then_catch_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return [$self._assert_description_(false,"Should not have been resolved")
|
|
|
+
|
|
|
+,$ctx2.sendIdx["assert:description:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+
|
|
|
+}),(function(err){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+$self._assert_description_($recv(err)._isKindOf_($globals.NonLifoReturn),"Expected a NonLifoReturn");
|
|
|
+return $self._assert_equals_($recv(err)._value(),"Intentional");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+}
|
|
|
+catch(e) {if(e===$early)return e[0]; throw e}
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseThenCatchWithNonLocalReturn",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseThenOnDoWithNonLocalReturn",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseThenOnDoWithNonLocalReturn\x0a\x09self timeout: 20.\x0a\x09^ (Promise new then: [ ^ 'Intentional' ])\x0a\x09\x09then: [ self assert: false description: 'Should not have been resolved' ]\x0a\x09\x09on: NonLifoReturn do: [ :nonlifo | self assert: nonlifo value equals: 'Intentional' ]",
|
|
|
+referencedClasses: ["Promise", "NonLifoReturn"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:on:do:", "then:", "new", "assert:description:", "assert:equals:", "value"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $early={};
|
|
|
+try {
|
|
|
+$self._timeout_((20));
|
|
|
+return $recv($recv($recv($globals.Promise)._new())._then_((function(){
|
|
|
+throw $early=["Intentional"];
|
|
|
+
|
|
|
+})))._then_on_do_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_description_(false,"Should not have been resolved");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+
|
|
|
+}),$globals.NonLifoReturn,(function(nonlifo){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_($recv(nonlifo)._value(),"Intentional");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({nonlifo:nonlifo},$ctx1,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+}
|
|
|
+catch(e) {if(e===$early)return e[0]; throw e}
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseThenOnDoWithNonLocalReturn",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "testPromiseWithAsyncPassingRejectingExecutor",
|