Skip to content

Instantly share code, notes, and snippets.

@zimbatm
Created February 15, 2010 22:39
Show Gist options
  • Save zimbatm/305064 to your computer and use it in GitHub Desktop.
Save zimbatm/305064 to your computer and use it in GitHub Desktop.
From f037d3f6bfeef8520a640364643e8a9d9909880d Mon Sep 17 00:00:00 2001
From: Jonas Pfenniger <jonas@pfenniger.name>
Date: Mon, 15 Feb 2010 23:46:06 +0100
Subject: [PATCH] Added promise.wait() after promise.emitXXX() tests
---
test/mjsunit/test-promise-wait.js | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/test/mjsunit/test-promise-wait.js b/test/mjsunit/test-promise-wait.js
index ef32ebf..9f33d08 100644
--- a/test/mjsunit/test-promise-wait.js
+++ b/test/mjsunit/test-promise-wait.js
@@ -45,6 +45,9 @@ p5.addCallback(function () {
}, 100);
});
+var p6 = new events.Promise();
+var p7 = new events.Promise();
+p7.addErrback(function() {});
p2.emitSuccess();
@@ -74,6 +77,18 @@ assert.deepEqual(["a","b","c"], ret4);
assert.equal(true, p4_done);
+
+p6.emitSuccess("something");
+assert.equal("something", p6.wait());
+p7.emitError("argh!");
+var goterr;
+try {
+ p7.wait();
+} catch(err) {
+ goterr = err;
+}
+assert.equal("argh!", goterr.toString());
+
process.addListener("exit", function () {
assert.equal(true, p1_done);
assert.equal(true, p2_done);
--
1.7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment