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

Nested THEN/AND_THEN statements in a loop trigger assert. #579

Open
drew-diamantoukos opened this issue Jan 29, 2016 · 3 comments
Open

Nested THEN/AND_THEN statements in a loop trigger assert. #579

drew-diamantoukos opened this issue Jan 29, 2016 · 3 comments

Comments

@drew-diamantoukos
Copy link

The following code, and variations of it, breaks for me using Catch v1.3.3 on Visual Studio 2015:

for (int i = 0; i < 10; ++i) {
    WHEN("Foo") {
        THEN("Bar") {
            REQUIRE(true);
        }
        AND_THEN("Baz") {
            REQUIRE(true);
        }
    }
}

This is the failing assert in line 5450:
assert(m_parent);

@horenmar
Copy link
Member

This still happens with Catch 1.5.9 on VS 2015.

@onqtam
Copy link

onqtam commented Jan 12, 2017

I'm not sure SECTIONs (which is what the BDD style macros are) are intended to be used in loops.

@philsquared
Copy link
Collaborator

@onqtam they are not. However this case should be detected and a descriptive error raised.

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

No branches or pull requests

4 participants