Skip to content

Commit

Permalink
test for invocant and args behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyan committed Jul 13, 2013
1 parent 84eb143 commit b46d496
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/coro.js
Expand Up @@ -5,7 +5,7 @@ var litmus = require('litmus'),
p = require('p-promise');

module.exports = new litmus.Test(module, function () {
this.plan(16);
this.plan(18);

var test = this;

Expand Down Expand Up @@ -114,6 +114,17 @@ module.exports = new litmus.Test(module, function () {

});

test.async('invocant and args', function (done) {
var invocant = {},
arg1 = {}, arg2 = {};

coro.run.call(invocant, function * (passedArg1, passedArg2) {
test.ok(invocant === this, 'invocant to run is invocant to generator function');
test.ok(arg1 === passedArg1 && arg2 === passedArg2, 'args are those passed to run');
done.resolve();
}, [ arg1, arg2 ]);
});

});

});
Expand Down

0 comments on commit b46d496

Please sign in to comment.