Navigation Menu

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

!!! BREAKING CHANGE !!! - Make TEST_SUITE work with blocks and add TEST_SUITE_BEGIN #41

Closed
FSund opened this issue Oct 5, 2016 · 6 comments

Comments

@FSund
Copy link

FSund commented Oct 5, 2016

I think making the following code valid would be a good idea

TEST_SUITE("math")
{
    TEST_CASE("") {} // part of the math test suite
}

and adding the macro/typedef TEST_SUITE_BEGIN, to match TEST_SUITE_END

TEST_SUITE_BEGIN("gui")

TEST_CASE("") {} // part of the gui test suite

TEST_SUITE_END();
@onqtam
Copy link
Member

onqtam commented Oct 9, 2016

having _BEGIN in the macro name would have been the right choice indeed... but this would be a breaking change.

For allowing test suites to have bodies and test cases inside them - not sure how that could be implemented - but one thing is for sure - the TEST_CASE macro won't be usable in that context - there will have to be a separate macro - like TEST_SUITE_CASE for cases inside a test suite block.

I'll have to think about these things...

@onqtam
Copy link
Member

onqtam commented Mar 14, 2017

Actually this is possible! - see UnitTest++

The only drawback is that it will be a breaking change but I don't think test suites are used that much given that the framework is not that known yet - will document it in the changelog as a breaking change.

@onqtam onqtam changed the title Make TEST_SUITE work with bodies, add TEST_SUITE_BEGIN [BREAKING CHANGE] Make TEST_SUITE work with bodies, add TEST_SUITE_BEGIN Mar 14, 2017
@onqtam onqtam changed the title [BREAKING CHANGE] Make TEST_SUITE work with bodies, add TEST_SUITE_BEGIN !!! BREAKING CHANGE !!! - Make TEST_SUITE work with bodies, add TEST_SUITE_BEGIN Mar 14, 2017
onqtam added a commit that referenced this issue Mar 14, 2017
@onqtam
Copy link
Member

onqtam commented Mar 14, 2017

This is how test suites are used now (in the dev branch - not yet released):

TEST_CASE("") {} // not part of any test suite

TEST_SUITE("math") {
    TEST_CASE("") {} // part of the math test suite
    TEST_CASE("") {} // part of the math test suite
}

TEST_SUITE_BEGIN("utils");

TEST_CASE("") {} // part of the utils test suite

TEST_SUITE_END();

TEST_CASE("") {} // not part of any test suite

@FSund
Copy link
Author

FSund commented Mar 14, 2017

I don't mind the breaking change (which makes sense given that I'm the one who suggested this in the first place), and I don't think the string literal issue affects me.

Actually I'm not even using TEST_SUITE at the moment, so perhaps I'm not the best judge on this matter.

I still think the change to having a unified way of calling TEST_SUITE and TEST_CASE would be good though.

Nevermind :)

@onqtam
Copy link
Member

onqtam commented Mar 14, 2017

I figured out how to circumvent the string literal issue - and even edited my comment from 2 hours ago.

This is already implemented in the dev branch! I too like the new unified way of calling TEST_SUITE and TEST_CASE - so thanks for the suggestion!

@FSund
Copy link
Author

FSund commented Mar 14, 2017

Sorry, I had the page open for a while before submitting my comment, so I didn't catch that.

Nice work!

@onqtam onqtam changed the title !!! BREAKING CHANGE !!! - Make TEST_SUITE work with bodies, add TEST_SUITE_BEGIN !!! BREAKING CHANGE !!! - Make TEST_SUITE work with blocks and add TEST_SUITE_BEGIN Mar 15, 2017
@onqtam onqtam closed this as completed in 658c870 May 15, 2017
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