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

Fail to populate Vec inside nested before_each #34

Closed
alex-dukhno opened this issue Dec 1, 2015 · 1 comment
Closed

Fail to populate Vec inside nested before_each #34

alex-dukhno opened this issue Dec 1, 2015 · 1 comment

Comments

@alex-dukhno
Copy link
Contributor

Hi

I have tried populate Vec with data in nested before_each section, and it failed

describe! outer {

    before_each {
        let mut v = vec![1, 2, 3];
    }

    describe! inner {

        before_each {
            for i in 0..10 {
                v.push(i);
            }
            //if uncommented line below it would pass
            //let b = true;
        }

        it "vector size should be 13" {
            assert_eq!(v.len(), 13);
        }
    }
}
@utkarshkukreti
Copy link
Contributor

FYI It should work if you put a ; after the closing } of the for. The bug is that the generator silently ignores the expr field of ast::Block of the before and after hooks.

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

No branches or pull requests

2 participants