-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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 sections are not run #9
Comments
Yikes! I see the problem - and know how I broke it. |
Hi Phil. I was wondering if you can provide an indication when you'll have a fix for this? |
Hi wichert. |
I've checked in an initial improvement. It's not a complete fix but it might get you out of trouble for now. |
Sorry - I should have said what this fixes. It should work if there is a single subsection |
I checked in a more complete fix now. It passes the skimpy tests I have in there but I need to add more before I can really say this is done. Would appreciate your feedback if you give it a try, though. |
I will do some more testing in the next few days. I should be able to provide feedback before Monday. |
Cool, thanks |
One thing I noticed is that nested sections are not shown running the tests with -s. With the above example the output looks like this: Running: MyClass [Start section: 'defaults'] .. [End of section: 'defaults' ..] Notice how the MyClass::MyClass level is skipped in the output. |
So far everything is looking correct: tests in nested sections are run correctly, and the XML report shows them as well. I'll leave closing this until you have decided if the nested sections should be shown in the -s output, which they are not at the moment. |
Found a possible problem. I have a test which looks like this: TEST_CASE("MyClass", "MyClass basic tests") { SECTION("MyClass::MyClass", "MyClass constructor tests") { MyFixture fixture; SECTION("defaults", "Default values for member varirables") { // ... } SECTION("other", "Other tests") { // ... } } } MyFixture is a simple class which prepares a test environment in its constructor and rests everything in its destructor. The test segfault in a way which suggests that the fixture is torn down before the "other" section is run. Is there another way to setup test fixture? I couldn't find anything in the tests, and this pattern felt quite natural. |
I found an error in my test fixture which caused the segfault. As far as I can see nested sections work correctly now. |
Cool - glad you found the issue. I couldn't see any way that the scoping wouldn't have worked. As for the -s reporting issue - thanks for pointing that out. It only occurred if a parent test had no assertions of its own (which would commonly be the case, but none of my meta tests were written that way! :-s ). Anyway, I've reproduced in the meta-tests and it's now all fixed. Would appreciate your verification, though. |
Looks fine, thanks! |
I have a test which looks like this:
The test compiles correctly, but no tests are run. If I remove the inner SECTION and move the code up to the outer SECTION block they are run correctly.
The text was updated successfully, but these errors were encountered: