-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
[support] identical names for test suites? #40
Comments
Hmm... After further investigation, it seems like my errors were caused by something else. I'm running into some trouble implementing doctest in my large project, and of course I am unable to reproduce the problems in a minimal example. EDIT: I was using TEST_SUITE instead of TEST_CASE, and it seems like this caused some problems. It seems like tests inside suites are not running by default..? |
Weird. The strings passed to both Test cases can have the same name - it's up to the user. Also if a test is written in a header (which the framework supports) - it is bound to end up in multiple source files - but it will be registered only once - not because of it's name but because of where it was written (based on Test cases in multiple source files may be in the same test suite by using // a.cpp
TEST_SUITE("math");
TEST_CASE("") { /* some math stuff */ } // b.cpp
TEST_SUITE("math");
TEST_CASE("") { /* some math stuff */ } As far as the linker error - so weird - that's the last thing I expected to fail. To force the If you have tried to add a function body after the test suite macro - I would imagine that would lead to errors - like this: TEST_SUITE("the ts") { // <<<< THIS IS BAD - not intended for such use - might lead to errors
// asserts...
} This might lead to linker errors if the same thing is done in multiple source files - or if done only in one place - might lead to asserts that are never called - since this is not a real test case. The thing is that when you "declare" a test suite with Does this explain the problem you are having? What part of the documentation would you recommend to be improved? Perhaps I should stop generating this dummy forward declaration and instead make a dummy typedef - so when a function body is appended instead of a semicolon - a proper compile time error is printed. |
Seems like I didn't read the documentation properly, sorry for the confusion. I definitely expected I would suggest perhaps adding EDIT: I'm closing this issue, and making a new one with the suggestions above. |
I recently ran into a problem while compiling, and it turned out it was caused by having multiple TEST_SUITEs with the same name. I kept getting compilation errors like this:
I now know that TEST_SUITEs need to be uniquely defined by design, but I had to investigate the documentation to realize this.So the biggest issue is that the compilation errors aren't really helpful for figuring out the cause of the errors. Would it be possible to add some functionality that warns against multiply defined TEST_SUITEs?The text was updated successfully, but these errors were encountered: