-
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
Unity: Add macros for test skipping. #7448
Conversation
OK this fix slightly subverts the way Utest/Unity are supposed to work. You may want to read the Utest readme, in particular:
From what I can make out your new Unity macro just does an immediate 'return' to skip executing the rest of a test case, however if the test case has been designed to return with one of the above custom control_t types then have you investigated what the knock on effect would be ? ie would it just break Utest? |
*-------------------------------------------------------*/ | ||
|
||
#define UNITY_TEST_SKIP(line, message) { UnitySkipPrint( (message), (UNITY_LINE_TYPE)(line)); return; } | ||
#define UNITY_TEST_SKIP_UNLESS(condition, line, message) if ((condition)) {} else UNITY_TEST_SKIP(line, message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this just -
if (!(condition) {UNITY_TEST_SKIP((line), (message))} ?
Note also other brackets around parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right on both. Will change. Regarding the condition, it was just a copy/paste from the UNITY_TEST_ASSERT macro, but that's not an excuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed a fix now.
The vast majority of the tests return nothing. Only tests that return the if (!normal_state) {
printf(__LINE__)
printf(message);
return;
} Just call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
8a0aadb
to
e728da1
Compare
The TEST_SKIP and TEST_SKIP_UNLESS macros (w/ and w/o messages) allow the test to skip the test case execution from the point the macro was called (without failing the test).
e728da1
to
2b7d836
Compare
/morph build |
Build : SUCCESSBuild number : 2601 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 2245 |
Test : SUCCESSBuild number : 2354 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might come in handy. 👍
Unity: Add macros for test skipping.
Description
The
TEST_SKIP
andTEST_SKIP_UNLESS
macros (w/ and w/o messages) allow the test to skip the test case execution from the point the macro was called (without failing the test).This is useful in case the conditions (such as missing H/W, memory limitations etc.) don't allow the test to run properly.
Pull request type