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

TEST_CASE should evaluate as a statement (no trailing semicolon) #29

Closed
gdamore opened this issue Dec 28, 2019 · 0 comments · Fixed by #30
Closed

TEST_CASE should evaluate as a statement (no trailing semicolon) #29

gdamore opened this issue Dec 28, 2019 · 0 comments · Fixed by #30

Comments

@gdamore
Copy link
Contributor

gdamore commented Dec 28, 2019

Clang-Tidy found this.

TEST_CASE(name) ends with a semicolon, which means that if you use it like this:

TEST_CASE(x == 1);

The compiler complains about an empty statement (caused by the redundant semicolon). This can also lead to surprises if this is used in contexts without enclosing braces, so it's not recommended.

Simple solution is just to elide the trailing semicolon.

PR with this is on the way.

gdamore added a commit to gdamore/acutest that referenced this issue Dec 28, 2019
fixes mity#28 Timing calculations are wrong
fixes mity#29 TEST_CASE should evaluate as a statement (no trailing semicolon)
@mity mity closed this as completed in #30 Dec 28, 2019
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

Successfully merging a pull request may close this issue.

1 participant