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

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

Issue 180723011: PromiseThen should ignore non-function parameters. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 8 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/promises-aplus/promises-aplus.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 ba5a306f84a23ecee98f11ddb1b1991afd394f1e..8575ba15ea885c4f7f1bb58c87409d772d6ccb98 100644
--- a/test/mjsunit/es6/promises.js
+++ b/test/mjsunit/es6/promises.js
@@ -399,6 +399,30 @@ function assertAsyncDone(iteration) {
(function() {
var deferred = Promise.defer()
var p1 = deferred.promise
+ var p2 = p1.then(1, 2)
+ p2.then(
+ function(x) { assertAsync(x === 5, "then/resolve-non-function") },
+ assertUnreachable
+ )
+ deferred.resolve(5)
+ assertAsyncRan()
+})();
+
+(function() {
+ var deferred = Promise.defer()
+ var p1 = deferred.promise
+ var p2 = p1.then(1, 2)
+ p2.then(
+ assertUnreachable,
+ function(x) { assertAsync(x === 5, "then/reject-non-function") }
+ )
+ deferred.reject(5)
+ assertAsyncRan()
+})();
+
+(function() {
+ var deferred = Promise.defer()
+ var p1 = deferred.promise
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
p3.chain(
« no previous file with comments | « src/promise.js ('k') | test/promises-aplus/promises-aplus.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698