Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Unified Diff: test/mjsunit/es6/promises.js

Issue 1362773002: [es6] Align Promise.resolve with the spec (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove corresponding entry from patch262.status (that scenario is now passing) Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/promise.js ('k') | test/test262/test262.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/promises.js
diff --git a/test/mjsunit/es6/promises.js b/test/mjsunit/es6/promises.js
index 405da02b53999493215658c07cc2025ff586ac5c..341242f8d9df11c3def63ac6f393f0747bca818a 100644
--- a/test/mjsunit/es6/promises.js
+++ b/test/mjsunit/es6/promises.js
@@ -1011,9 +1011,9 @@ function assertAsyncDone(iteration) {
log = ""
var p4 = MyPromise.resolve(4)
var p5 = MyPromise.reject(5)
- assertTrue(p4 instanceof Promise, "subclass/instance4")
+ assertTrue(p4 instanceof MyPromise, "subclass/instance4")
assertTrue(p4 instanceof MyPromise, "subclass/instance-my4")
- assertTrue(p5 instanceof Promise, "subclass/instance5")
+ assertTrue(p5 instanceof MyPromise, "subclass/instance5")
assertTrue(p5 instanceof MyPromise, "subclass/instance-my5")
d3.resolve(3)
assertTrue(log === "nx4nr5x3", "subclass/resolve")
@@ -1028,12 +1028,35 @@ function assertAsyncDone(iteration) {
log = ""
Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16])
- assertTrue(log === "nx14n", "subclass/all/arg")
+
+ assertTrue(log === "nx14", "subclass/all/arg")
log = ""
MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26])
- assertTrue(log === "nx24nnx21nnx23nnnx25nnx26n", "subclass/all/self")
+ assertTrue(log === "nx24nnx21nnnnx23nnnx25nnx26n", "subclass/all/self")
})();
+(function() {
+ 'use strict';
+
+ class Pact extends Promise { }
+ class Vow extends Pact { }
+ class Oath extends Vow { }
+
+ Oath.constructor = Vow;
+
+ assertTrue(Pact.resolve(Pact.resolve()).constructor === Pact,
+ "subclass/resolve/own");
+
+ assertTrue(Pact.resolve(Promise.resolve()).constructor === Pact,
+ "subclass/resolve/ancestor");
+
+ assertTrue(Pact.resolve(Vow.resolve()).constructor === Pact,
+ "subclass/resolve/descendant"); var vow = Vow.resolve();
+
+ vow.constructor = Oath;
+ assertTrue(Oath.resolve(vow) === vow,
+ "subclass/resolve/descendant with transplanted own constructor");
+}());
assertAsyncDone()
« no previous file with comments | « src/promise.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698