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

do ... while is broken in callbacks mode #189

Closed
bjouhier opened this issue Dec 26, 2013 · 1 comment
Closed

do ... while is broken in callbacks mode #189

bjouhier opened this issue Dec 26, 2013 · 1 comment

Comments

@bjouhier
Copy link
Member

Following test fails because s is "134" instead of "1234" at end of loop:

asyncTest("do while", 1, function(_) {
    var i = 0;
    function read(_) {
        return delay(_, ++i); 
    }
    var s = "";
    var v = read(_);
    do {
        s += v;
    } while ((v = read(_)) < 5);
    strictEqual(s, "1234");
    start();
});
@bjouhier
Copy link
Member Author

I hit this one while testing the CSV transform of the ez-streams module. I'm surprised that nobody ran into it before.

do ... while ... loops must be seldom used!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant