|
@@ -15671,6 +15671,845 @@ $globals.PointTest);
|
|
|
|
|
|
|
|
|
|
|
|
+$core.addClass("PromiseTest", $globals.TestCase, "Kernel-Tests");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseExecutorAsyncNegativeDo",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseExecutorAsyncNegativeDo\x0a\x09self timeout: 40.\x0a\x09^ (Promise new: [ :m | [ m do: [ self error: 'Intentional' ] ] fork ])\x0a\x09\x09catch: [ :error | self assert: error messageText equals: 'Intentional' ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "catch:", "new:", "fork", "do:", "error:", "assert:equals:", "messageText"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((40));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(m)._do_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx4) {
|
|
|
+
|
|
|
+return $self._error_("Intentional");
|
|
|
+
|
|
|
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}))._fork();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._catch_((function(error){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_($recv(error)._messageText(),"Intentional");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,4)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseExecutorAsyncNegativeDo",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseExecutorAsyncNegativeTry",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseExecutorAsyncNegativeTry\x0a\x09self timeout: 40.\x0a\x09^ (Promise new: [ :m | [ m try: [ self error: 'Intentional' ] ] fork ])\x0a\x09\x09catch: [ :error | self assert: error messageText equals: 'Intentional' ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "catch:", "new:", "fork", "try:", "error:", "assert:equals:", "messageText"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((40));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(m)._try_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx4) {
|
|
|
+
|
|
|
+return $self._error_("Intentional");
|
|
|
+
|
|
|
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}))._fork();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._catch_((function(error){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_($recv(error)._messageText(),"Intentional");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,4)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseExecutorAsyncNegativeTry",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseExecutorAsyncPositiveDo",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseExecutorAsyncPositiveDo\x0a\x09self timeout: 40.\x0a\x09^ (Promise new: [ :m | [ m do: [ 3 ] ] fork ])\x0a\x09\x09then: [ :result | self assert: result equals: 3 ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:", "new:", "fork", "do:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((40));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(m)._do_((function(){
|
|
|
+return (3);
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}))._fork();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(result,(3));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,4)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseExecutorAsyncPositiveDo",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseExecutorAsyncPositiveTry",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseExecutorAsyncPositiveTry\x0a\x09self timeout: 200.\x0a\x09^ (Promise any: {\x0a\x09\x09(Promise new: [ :m | [ m try: [ 3 ] ] fork ])\x0a\x09\x09\x09then: [ :result | self assert: result equals: 3 ].\x0a\x09\x09Promise new: [ :m | [ m value: #timeout ] valueWithTimeout: 20 ]\x0a\x09}) then: [ :result | self assert: result equals: #timeout ].",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:", "any:", "new:", "fork", "try:", "assert:equals:", "valueWithTimeout:", "value:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((200));
|
|
|
+return [$recv($recv($globals.Promise)._any_([$recv([$recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(m)._try_((function(){
|
|
|
+return (3);
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}))._fork();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+}))
|
|
|
+
|
|
|
+,$ctx1.sendIdx["new:"]=1
|
|
|
+
|
|
|
+][0])._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return [$self._assert_equals_(result,(3))
|
|
|
+
|
|
|
+,$ctx2.sendIdx["assert:equals:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,4)});
|
|
|
+
|
|
|
+})),$recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(m)._value_("timeout");
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
|
|
|
+
|
|
|
+}))._valueWithTimeout_((20));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,5)});
|
|
|
+
|
|
|
+}))]))._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(result,"timeout");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,7)});
|
|
|
+
|
|
|
+}))
|
|
|
+
|
|
|
+,$ctx1.sendIdx["then:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseExecutorAsyncPositiveTry",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseExecutorNegativeDo",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseExecutorNegativeDo\x0a\x09self timeout: 40.\x0a\x09^ (Promise new: [ :m | [ m do: [ self error: 'Intentional' ] ] fork ])\x0a\x09\x09catch: [ :error | self assert: error messageText equals: 'Intentional' ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "catch:", "new:", "fork", "do:", "error:", "assert:equals:", "messageText"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((40));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(m)._do_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx4) {
|
|
|
+
|
|
|
+return $self._error_("Intentional");
|
|
|
+
|
|
|
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}))._fork();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._catch_((function(error){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_($recv(error)._messageText(),"Intentional");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,4)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseExecutorNegativeDo",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseExecutorNegativeTry",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseExecutorNegativeTry\x0a\x09self timeout: 20.\x0a\x09^ (Promise new: [ :m | m try: [ self error: 'Intentional' ] ])\x0a\x09\x09catch: [ :error | self assert: error messageText equals: 'Intentional' ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "catch:", "new:", "try:", "error:", "assert:equals:", "messageText"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((20));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(m)._try_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $self._error_("Intentional");
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._catch_((function(error){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_($recv(error)._messageText(),"Intentional");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseExecutorNegativeTry",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseExecutorPositiveDo",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseExecutorPositiveDo\x0a\x09self timeout: 20.\x0a\x09^ (Promise new: [ :m | m do: [ 3 ] ])\x0a\x09\x09then: [ :result | self assert: result equals: 3 ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:", "new:", "do:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((20));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(m)._do_((function(){
|
|
|
+return (3);
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(result,(3));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseExecutorPositiveDo",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseExecutorPositiveTry",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseExecutorPositiveTry\x0a\x09self timeout: 200.\x0a\x09^ (Promise any: {\x0a\x09\x09(Promise new: [ :m | m try: [ 3 ] ])\x0a\x09\x09\x09then: [ :result | self assert: result equals: 3 ].\x0a\x09\x09Promise new: [ :m | [ m value: #timeout ] valueWithTimeout: 20 ]\x0a\x09}) then: [ :result | self assert: result equals: #timeout ].",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:", "any:", "new:", "try:", "assert:equals:", "valueWithTimeout:", "value:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((200));
|
|
|
+return [$recv($recv($globals.Promise)._any_([$recv([$recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(m)._try_((function(){
|
|
|
+return (3);
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+}))
|
|
|
+
|
|
|
+,$ctx1.sendIdx["new:"]=1
|
|
|
+
|
|
|
+][0])._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return [$self._assert_equals_(result,(3))
|
|
|
+
|
|
|
+,$ctx2.sendIdx["assert:equals:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,3)});
|
|
|
+
|
|
|
+})),$recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(m)._value_("timeout");
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
|
|
|
+
|
|
|
+}))._valueWithTimeout_((20));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,4)});
|
|
|
+
|
|
|
+}))]))._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(result,"timeout");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,6)});
|
|
|
+
|
|
|
+}))
|
|
|
+
|
|
|
+,$ctx1.sendIdx["then:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseExecutorPositiveTry",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseNew",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseNew\x0a\x09self timeout: 20.\x0a\x09^ Promise new\x0a\x09\x09then: [ :result | self assert: result equals: nil ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:", "new", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((20));
|
|
|
+return $recv($recv($globals.Promise)._new())._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(result,nil);
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseNew",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseWithAsyncPassingRejectingExecutor",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseWithAsyncPassingRejectingExecutor\x0a\x09self timeout: 60.\x0a\x09^ (Promise new: [ :m | [\x0a\x09\x09| passPromise |\x0a\x09\x09passPromise := Promise new: [ :m2 | [ m2 signal: 4 ] fork ].\x0a\x09\x09m value: passPromise\x0a\x09] fork ]) catch: [ :err | self assert: err equals: 4 ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "catch:", "new:", "fork", "signal:", "value:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((60));
|
|
|
+return $recv([$recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return [$recv((function(){
|
|
|
+var passPromise;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+passPromise=$recv($globals.Promise)._new_((function(m2){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx4) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx5) {
|
|
|
+
|
|
|
+return $recv(m2)._signal_((4));
|
|
|
+
|
|
|
+}, function($ctx5) {$ctx5.fillBlock({},$ctx4,4)});
|
|
|
+
|
|
|
+}))._fork();
|
|
|
+
|
|
|
+}, function($ctx4) {$ctx4.fillBlock({m2:m2},$ctx3,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+return $recv(m)._value_(passPromise);
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({passPromise:passPromise},$ctx2,2)});
|
|
|
+
|
|
|
+}))._fork()
|
|
|
+
|
|
|
+,$ctx2.sendIdx["fork"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+}))
|
|
|
+
|
|
|
+,$ctx1.sendIdx["new:"]=1
|
|
|
+
|
|
|
+][0])._catch_((function(err){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(err,(4));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,5)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseWithAsyncPassingRejectingExecutor",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseWithAsyncPassingResolvingExecutor",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseWithAsyncPassingResolvingExecutor\x0a\x09self timeout: 60.\x0a\x09^ (Promise new: [ :m | [\x0a\x09\x09| passPromise |\x0a\x09\x09passPromise := Promise new: [ :m2 | [ m2 value: 3 ] fork ].\x0a\x09\x09m value: passPromise\x0a\x09] fork ]) then: [ :result | self assert: result equals: 3 ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:", "new:", "fork", "value:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((60));
|
|
|
+return $recv([$recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return [$recv((function(){
|
|
|
+var passPromise;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+passPromise=$recv($globals.Promise)._new_((function(m2){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx4) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx5) {
|
|
|
+
|
|
|
+return [$recv(m2)._value_((3))
|
|
|
+
|
|
|
+,$ctx5.sendIdx["value:"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx5) {$ctx5.fillBlock({},$ctx4,4)});
|
|
|
+
|
|
|
+}))._fork();
|
|
|
+
|
|
|
+}, function($ctx4) {$ctx4.fillBlock({m2:m2},$ctx3,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+return $recv(m)._value_(passPromise);
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({passPromise:passPromise},$ctx2,2)});
|
|
|
+
|
|
|
+}))._fork()
|
|
|
+
|
|
|
+,$ctx2.sendIdx["fork"]=1
|
|
|
+
|
|
|
+][0];
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+}))
|
|
|
+
|
|
|
+,$ctx1.sendIdx["new:"]=1
|
|
|
+
|
|
|
+][0])._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(result,(3));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,5)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseWithAsyncPassingResolvingExecutor",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseWithAsyncRejectingExecutor",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseWithAsyncRejectingExecutor\x0a\x09self timeout: 40.\x0a\x09^ (Promise new: [ :m | [ m signal: 4 ] fork ])\x0a\x09\x09catch: [ :err | self assert: err equals: 4 ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "catch:", "new:", "fork", "signal:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((40));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(m)._signal_((4));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}))._fork();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._catch_((function(err){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(err,(4));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseWithAsyncRejectingExecutor",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseWithAsyncResolvingExecutor",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseWithAsyncResolvingExecutor\x0a\x09self timeout: 40.\x0a\x09^ (Promise new: [ :m | [ m value: 3 ] fork ])\x0a\x09\x09then: [ :result | self assert: result equals: 3 ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:", "new:", "fork", "value:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((40));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(m)._value_((3));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}))._fork();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(result,(3));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseWithAsyncResolvingExecutor",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseWithRejectingExecutor",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseWithRejectingExecutor\x0a\x09self timeout: 20.\x0a\x09^ (Promise new: [ :m | m signal: 4 ])\x0a\x09\x09catch: [ :err | self assert: err equals: 4 ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "catch:", "new:", "signal:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((20));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(m)._signal_((4));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._catch_((function(err){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(err,(4));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseWithRejectingExecutor",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "testPromiseWithResolvingExecutor",
|
|
|
+protocol: " tests",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "testPromiseWithResolvingExecutor\x0a\x09self timeout: 20.\x0a\x09^ (Promise new: [ :m | m value: 3 ])\x0a\x09\x09then: [ :result | self assert: result equals: 3 ]",
|
|
|
+referencedClasses: ["Promise"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["timeout:", "then:", "new:", "value:", "assert:equals:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$self._timeout_((20));
|
|
|
+return $recv($recv($globals.Promise)._new_((function(m){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(m)._value_((3));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
|
|
|
+
|
|
|
+})))._then_((function(result){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._assert_equals_(result,(3));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({result:result},$ctx1,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testPromiseWithResolvingExecutor",{})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.PromiseTest);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$core.addClass("QueueTest", $globals.TestCase, "Kernel-Tests");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|