Skip to content

Test Framework documentation issue #14098

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

Closed
MarekPieta opened this issue Mar 6, 2019 · 1 comment · Fixed by #15244
Closed

Test Framework documentation issue #14098

MarekPieta opened this issue Mar 6, 2019 · 1 comment · Fixed by #15244
Assignees
Labels
area: Documentation area: Test Framework Issues related not to a particular test, but to the framework instead bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@MarekPieta
Copy link
Collaborator

ZTest documentation in my opinion contains errors in code examples, which may be misleading readers:

#include <ztest.h>

extern void test_sometest1(void);
extern void test_sometest2(void);
#ifndef CONFIG_WHATEVER              /* Conditionally skip test_sometest3 */
void test_sometest3(void)
{
     ztest_test_skip();
}
#else
extern void test_sometest3(void);
#endif
extern void test_sometest4(void);
...

void test_main(void)
{
     ztest_test_suite(common,
                         ztest_unit_test(test_sometest1),
                         ztest_unit_test(test_sometest2),
                         ztest_unit_test(test_sometest3),
                         ztest_unit_test(test_sometest4),
                );
     ztest_run_test_suite(common);
}

The last comma in z_test_test_suite call shuld be removed.

void test_main(void)
{
#ifdef TEST_feature1
        ztest_test_suite(feature1,
                         ztest_unit_test(test_1a),
                         ztest_unit_test(test_1b),
                         ztest_unit_test(test_1c),
        ztest_run_test_suite(feature1);
#endif

#ifdef TEST_feature2
        ztest_test_suite(feature2,
                         ztest_unit_test(test_2a),
                         ztest_unit_test(test_2b),
        ztest_run_test_suite(feature2);
#endif
}

For calling ztest_test_suite the brackets are not closed and there is comma at the end.

@MarekPieta MarekPieta added the bug The issue is a bug, or the PR is fixing a bug label Mar 6, 2019
@aescolar aescolar added area: Test Framework Issues related not to a particular test, but to the framework instead area: Documentation labels Mar 6, 2019
@nashif
Copy link
Member

nashif commented Mar 6, 2019

@MarekPieta can you submit a PR fixing those?

@nashif nashif added the priority: low Low impact/importance bug label Mar 6, 2019
@nashif nashif self-assigned this Apr 2, 2019
nashif added a commit to nashif/zephyr that referenced this issue Apr 7, 2019
Remove extra commas and close brackets in code samples.

Fixes zephyrproject-rtos#14098

Signed-off-by: Anas Nashif <[email protected]>
nashif added a commit that referenced this issue Apr 7, 2019
Remove extra commas and close brackets in code samples.

Fixes #14098

Signed-off-by: Anas Nashif <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Documentation area: Test Framework Issues related not to a particular test, but to the framework instead bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants