Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix generator test #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions test/generators.js
Expand Up @@ -14,27 +14,27 @@ function *work() {
}

describe('co(*)', function(){
describe('with a generator function', function(){
describe('with a generator', function(){
it('should wrap with co()', function(){
return co(function *(){
var a = yield work;
var b = yield work;
var c = yield work;
var a = yield work();
var b = yield work();
var c = yield work();

assert('yay' == a);
assert('yay' == b);
assert('yay' == c);

var res = yield [work, work, work];
var res = yield [work(), work(), work()];
assert.deepEqual(['yay', 'yay', 'yay'], res);
});
})

it('should catch errors', function(){
return co(function *(){
yield function *(){
yield (function *(){
throw new Error('boom');
};
})();
}).then(function () {
throw new Error('wtf')
}, function (err) {
Expand Down