Index: test/mjsunit/es6/promises.js |
diff --git a/test/mjsunit/es6/promises.js b/test/mjsunit/es6/promises.js |
index f1b191c2c6420c4f379e884ff1ff7813be160cc7..48b96f626f2ef2d9be3de9263d89885fd3dd3bb8 100644 |
--- a/test/mjsunit/es6/promises.js |
+++ b/test/mjsunit/es6/promises.js |
@@ -25,7 +25,7 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --harmony-promises --harmony-observation --allow-natives-syntax |
+// Flags: --harmony-promises --allow-natives-syntax |
var asyncAssertsExpected = 0; |
@@ -82,8 +82,8 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- Promise.resolve(5); |
- Promise.resolve(5).chain(undefined, assertUnreachable).chain( |
+ Promise.accept(5); |
+ Promise.accept(5).chain(undefined, assertUnreachable).chain( |
function(x) { assertAsync(x === 5, "resolved/chain-nohandler") }, |
assertUnreachable |
) |
@@ -99,12 +99,12 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- Promise.resolve(5).then(undefined, assertUnreachable).chain( |
+ Promise.accept(5).then(undefined, assertUnreachable).chain( |
function(x) { assertAsync(x === 5, "resolved/then-nohandler-undefined") }, |
assertUnreachable |
) |
assertAsyncRan() |
- Promise.resolve(6).then(null, assertUnreachable).chain( |
+ Promise.accept(6).then(null, assertUnreachable).chain( |
function(x) { assertAsync(x === 6, "resolved/then-nohandler-null") }, |
assertUnreachable |
) |
@@ -125,9 +125,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain( |
function(x) { assertAsync(x === p2, "resolved/chain") }, |
assertUnreachable |
@@ -136,9 +136,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.then( |
function(x) { assertAsync(x === 5, "resolved/then") }, |
assertUnreachable |
@@ -148,8 +148,8 @@ function assertAsyncDone(iteration) { |
(function() { |
var p1 = Promise.reject(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain( |
function(x) { assertAsync(x === p2, "rejected/chain") }, |
assertUnreachable |
@@ -159,8 +159,8 @@ function assertAsyncDone(iteration) { |
(function() { |
var p1 = Promise.reject(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.then( |
assertUnreachable, |
function(x) { assertAsync(x === 5, "rejected/then") } |
@@ -169,9 +169,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain(function(x) { return x }, assertUnreachable).chain( |
function(x) { assertAsync(x === p1, "resolved/chain/chain") }, |
assertUnreachable |
@@ -180,9 +180,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain(function(x) { return x }, assertUnreachable).then( |
function(x) { assertAsync(x === 5, "resolved/chain/then") }, |
assertUnreachable |
@@ -191,9 +191,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain(function(x) { return 6 }, assertUnreachable).chain( |
function(x) { assertAsync(x === 6, "resolved/chain/chain2") }, |
assertUnreachable |
@@ -202,9 +202,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain(function(x) { return 6 }, assertUnreachable).then( |
function(x) { assertAsync(x === 6, "resolved/chain/then2") }, |
assertUnreachable |
@@ -213,9 +213,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.then(function(x) { return x + 1 }, assertUnreachable).chain( |
function(x) { assertAsync(x === 6, "resolved/then/chain") }, |
assertUnreachable |
@@ -224,9 +224,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.then(function(x) { return x + 1 }, assertUnreachable).then( |
function(x) { assertAsync(x === 6, "resolved/then/then") }, |
assertUnreachable |
@@ -235,10 +235,10 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
- p3.then(function(x){ return Promise.resolve(x+1) }, assertUnreachable).chain( |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
+ p3.then(function(x){ return Promise.accept(x+1) }, assertUnreachable).chain( |
function(x) { assertAsync(x === 6, "resolved/then/chain2") }, |
assertUnreachable |
) |
@@ -246,10 +246,10 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
- p3.then(function(x) { return Promise.resolve(x+1) }, assertUnreachable).then( |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
+ p3.then(function(x) { return Promise.accept(x+1) }, assertUnreachable).then( |
function(x) { assertAsync(x === 6, "resolved/then/then2") }, |
assertUnreachable |
) |
@@ -257,9 +257,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain(function(x) { throw 6 }, assertUnreachable).chain( |
assertUnreachable, |
function(x) { assertAsync(x === 6, "resolved/chain-throw/chain") } |
@@ -268,9 +268,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain(function(x) { throw 6 }, assertUnreachable).then( |
assertUnreachable, |
function(x) { assertAsync(x === 6, "resolved/chain-throw/then") } |
@@ -279,9 +279,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.then(function(x) { throw 6 }, assertUnreachable).chain( |
assertUnreachable, |
function(x) { assertAsync(x === 6, "resolved/then-throw/chain") } |
@@ -290,9 +290,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.then(function(x) { throw 6 }, assertUnreachable).then( |
assertUnreachable, |
function(x) { assertAsync(x === 6, "resolved/then-throw/then") } |
@@ -301,9 +301,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
+ var p1 = Promise.accept(5) |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
- var p3 = Promise.resolve(p2) |
+ var p3 = Promise.accept(p2) |
p3.chain( |
function(x) { assertAsync(x === p2, "resolved/thenable/chain") }, |
assertUnreachable |
@@ -312,9 +312,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
+ var p1 = Promise.accept(5) |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
- var p3 = Promise.resolve(p2) |
+ var p3 = Promise.accept(p2) |
p3.then( |
function(x) { assertAsync(x === 5, "resolved/thenable/then") }, |
assertUnreachable |
@@ -325,7 +325,7 @@ function assertAsyncDone(iteration) { |
(function() { |
var p1 = Promise.reject(5) |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
- var p3 = Promise.resolve(p2) |
+ var p3 = Promise.accept(p2) |
p3.chain( |
function(x) { assertAsync(x === p2, "rejected/thenable/chain") }, |
assertUnreachable |
@@ -336,7 +336,7 @@ function assertAsyncDone(iteration) { |
(function() { |
var p1 = Promise.reject(5) |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
- var p3 = Promise.resolve(p2) |
+ var p3 = Promise.accept(p2) |
p3.then( |
assertUnreachable, |
function(x) { assertAsync(x === 5, "rejected/thenable/then") } |
@@ -347,8 +347,8 @@ function assertAsyncDone(iteration) { |
(function() { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain( |
function(x) { assertAsync(x === p2, "chain/resolve") }, |
assertUnreachable |
@@ -360,8 +360,8 @@ function assertAsyncDone(iteration) { |
(function() { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.then( |
function(x) { assertAsync(x === 5, "then/resolve") }, |
assertUnreachable |
@@ -373,8 +373,8 @@ function assertAsyncDone(iteration) { |
(function() { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.chain( |
function(x) { assertAsync(x === p2, "chain/reject") }, |
assertUnreachable |
@@ -386,8 +386,8 @@ function assertAsyncDone(iteration) { |
(function() { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
- var p2 = Promise.resolve(p1) |
- var p3 = Promise.resolve(p2) |
+ var p2 = Promise.accept(p1) |
+ var p3 = Promise.accept(p2) |
p3.then( |
assertUnreachable, |
function(x) { assertAsync(x === 5, "then/reject") } |
@@ -400,7 +400,7 @@ function assertAsyncDone(iteration) { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
- var p3 = Promise.resolve(p2) |
+ var p3 = Promise.accept(p2) |
p3.chain( |
function(x) { assertAsync(x === p2, "chain/resolve/thenable") }, |
assertUnreachable |
@@ -413,7 +413,7 @@ function assertAsyncDone(iteration) { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
- var p3 = Promise.resolve(p2) |
+ var p3 = Promise.accept(p2) |
p3.then( |
function(x) { assertAsync(x === 5, "then/resolve/thenable") }, |
assertUnreachable |
@@ -426,7 +426,7 @@ function assertAsyncDone(iteration) { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
- var p3 = Promise.resolve(p2) |
+ var p3 = Promise.accept(p2) |
p3.chain( |
function(x) { assertAsync(x === p2, "chain/reject/thenable") }, |
assertUnreachable |
@@ -439,7 +439,7 @@ function assertAsyncDone(iteration) { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
- var p3 = Promise.resolve(p2) |
+ var p3 = Promise.accept(p2) |
p3.then( |
assertUnreachable, |
function(x) { assertAsync(x === 5, "then/reject/thenable") } |
@@ -449,8 +449,8 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
var deferred = Promise.defer() |
var p3 = deferred.promise |
p3.chain( |
@@ -462,8 +462,8 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
var deferred = Promise.defer() |
var p3 = deferred.promise |
p3.then( |
@@ -475,8 +475,8 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
var deferred = Promise.defer() |
var p3 = deferred.promise |
p3.chain( |
@@ -488,8 +488,8 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
- var p2 = Promise.resolve(p1) |
+ var p1 = Promise.accept(5) |
+ var p2 = Promise.accept(p1) |
var deferred = Promise.defer() |
var p3 = deferred.promise |
p3.then( |
@@ -501,7 +501,7 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
+ var p1 = Promise.accept(5) |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
var deferred = Promise.defer() |
var p3 = deferred.promise |
@@ -514,7 +514,7 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(5) |
+ var p1 = Promise.accept(5) |
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }} |
var deferred = Promise.defer() |
var p3 = deferred.promise |
@@ -527,7 +527,7 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(0) |
+ var p1 = Promise.accept(0) |
var p2 = p1.chain(function(x) { return p2 }, assertUnreachable) |
p2.chain( |
assertUnreachable, |
@@ -537,7 +537,7 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(0) |
+ var p1 = Promise.accept(0) |
var p2 = p1.then(function(x) { return p2 }, assertUnreachable) |
p2.chain( |
assertUnreachable, |
@@ -612,7 +612,7 @@ function assertAsyncDone(iteration) { |
(function() { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
- var p2 = Promise.resolve(2) |
+ var p2 = Promise.accept(2) |
var p3 = Promise.defer().promise |
Promise.all([p1, p2, p3]).chain( |
assertUnreachable, |
@@ -646,9 +646,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(1) |
- var p2 = Promise.resolve(2) |
- var p3 = Promise.resolve(3) |
+ var p1 = Promise.accept(1) |
+ var p2 = Promise.accept(2) |
+ var p3 = Promise.accept(3) |
Promise.race([p1, p2, p3]).chain( |
function(x) { assertAsync(x === 1, "resolved/one") }, |
assertUnreachable |
@@ -657,9 +657,9 @@ function assertAsyncDone(iteration) { |
})(); |
(function() { |
- var p1 = Promise.resolve(1) |
- var p2 = Promise.resolve(2) |
- var p3 = Promise.resolve(3) |
+ var p1 = Promise.accept(1) |
+ var p2 = Promise.accept(2) |
+ var p3 = Promise.accept(3) |
Promise.race([0, p1, p2, p3]).chain( |
function(x) { assertAsync(x === 0, "resolved-const/one") }, |
assertUnreachable |
@@ -694,7 +694,7 @@ function assertAsyncDone(iteration) { |
(function() { |
var deferred = Promise.defer() |
var p1 = deferred.promise |
- var p2 = Promise.resolve(2) |
+ var p2 = Promise.accept(2) |
var p3 = Promise.defer().promise |
Promise.race([p1, p2, p3]).chain( |
function(x) { assertAsync(x === 2, "resolved/one") }, |
@@ -789,11 +789,11 @@ function assertAsyncDone(iteration) { |
assertTrue(log === "dncncnx6", "subclass/chain") |
log = "" |
- Promise.all([11, Promise.resolve(12), 13, MyPromise.resolve(14), 15, 16]) |
+ Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16]) |
assertTrue(log === "nx14cn", "subclass/all/arg") |
log = "" |
- MyPromise.all([21, Promise.resolve(22), 23, MyPromise.resolve(24), 25, 26]) |
+ MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26]) |
assertTrue(log === "nx24nnx21cnnx23cncnnx25cnnx26cn", "subclass/all/self") |
})(); |