Browse Source

Added failing test: promise.wait() after promise.emitXXX()

v0.7.4-release
Jonas Pfenniger 15 years ago
committed by Ryan Dahl
parent
commit
80ace36e4c
  1. 15
      test/mjsunit/test-promise-wait.js

15
test/mjsunit/test-promise-wait.js

@ -45,6 +45,9 @@ p5.addCallback(function () {
}, 100); }, 100);
}); });
var p6 = new events.Promise();
var p7 = new events.Promise();
p7.addErrback(function() {});
p2.emitSuccess(); p2.emitSuccess();
@ -74,6 +77,18 @@ assert.deepEqual(["a","b","c"], ret4);
assert.equal(true, p4_done); 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 () { process.addListener("exit", function () {
assert.equal(true, p1_done); assert.equal(true, p1_done);
assert.equal(true, p2_done); assert.equal(true, p2_done);

Loading…
Cancel
Save