Forked from masuidrive/0001-Fixed-promise-late-chain.patch
Created
February 13, 2010 14:43
-
-
Save felixge/303480 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 799ef6ec9ca295fbb0e63f182c8a9a3f93892ff4 Mon Sep 17 00:00:00 2001 | |
From: Yuichiro MASUI <[email protected]> | |
Date: Sat, 13 Feb 2010 03:27:01 -0800 | |
Subject: [PATCH] Fixed: promise late chain | |
MIME-Version: 1.0 | |
Content-Type: text/plain; charset=UTF-8 | |
Content-Transfer-Encoding: 8bit | |
Signed-off-by: Felix Geisendörfer <[email protected]> | |
--- | |
src/node.js | 2 +- | |
test/mjsunit/test-promise.js | 12 ++++++------ | |
2 files changed, 7 insertions(+), 7 deletions(-) | |
diff --git a/src/node.js b/src/node.js | |
index 052651d..e31e000 100644 | |
--- a/src/node.js | |
+++ b/src/node.js | |
@@ -264,7 +264,7 @@ var eventsModule = createInternalModule('events', function (exports) { | |
exports.Promise.prototype.addCallback = function (listener) { | |
if (this.hasFired === 'success') { | |
- return listener.apply(this, this._values); | |
+ listener.apply(this, this._values); | |
} | |
return this.addListener("success", listener); | |
diff --git a/test/mjsunit/test-promise.js b/test/mjsunit/test-promise.js | |
index 2992f93..149c07e 100644 | |
--- a/test/mjsunit/test-promise.js | |
+++ b/test/mjsunit/test-promise.js | |
@@ -24,13 +24,13 @@ a.addErrback(function(error) { | |
}); | |
a.emitSuccess(TEST_VALUE); | |
-a.addCallback(function(value) { | |
+assert.ok(a.addCallback(function(value) { | |
assert.equal(TEST_VALUE, value); | |
expectedCallbacks.a2--; | |
-}); | |
-a.addErrback(function(error) { | |
+})); | |
+assert.ok(a.addErrback(function(error) { | |
assert.notEqual(TEST_VALUE, error, 'late'); | |
-}); | |
+})); | |
// Test regular & late errback binding | |
var b = new Promise(); | |
@@ -48,10 +48,10 @@ b.addErrback(function(value) { | |
// Test late errback binding | |
var c = new Promise(); | |
c.emitError(TEST_VALUE); | |
-c.addErrback(function(value) { | |
+assert.ok(c.addErrback(function(value) { | |
assert.equal(TEST_VALUE, value); | |
expectedCallbacks.c1--; | |
-}); | |
+})); | |
// Test errback exceptions | |
var d = new Promise(); | |
-- | |
1.6.5.7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment