Skip to content

Commit 4f75848

Browse files
Yuval Peressnashif
authored andcommitted
ztest: fix grammar for errors in bad test phases
Addresses the comments in zephyrproject-rtos#48846 regarding the error messages Signed-off-by: Yuval Peress <[email protected]>
1 parent dbd63e8 commit 4f75848

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

subsys/testsuite/ztest/src/ztest_new.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ void ztest_test_fail(void)
334334
case TEST_PHASE_AFTER:
335335
case TEST_PHASE_TEARDOWN:
336336
case TEST_PHASE_FRAMEWORK:
337-
PRINT(" ERROR: cannot fail in test '%s()', bailing\n",
337+
PRINT(" ERROR: cannot fail in test phase '%s()', bailing\n",
338338
get_friendly_phase_name(phase));
339339
longjmp(stack_fail, 1);
340340
}
@@ -345,7 +345,8 @@ void ztest_test_pass(void)
345345
if (phase == TEST_PHASE_TEST) {
346346
longjmp(test_pass, 1);
347347
}
348-
PRINT(" ERROR: cannot pass in test '%s()', bailing\n", get_friendly_phase_name(phase));
348+
PRINT(" ERROR: cannot pass in test phase '%s()', bailing\n",
349+
get_friendly_phase_name(phase));
349350
longjmp(stack_fail, 1);
350351
}
351352

@@ -357,7 +358,7 @@ void ztest_test_skip(void)
357358
case TEST_PHASE_TEST:
358359
longjmp(test_skip, 1);
359360
default:
360-
PRINT(" ERROR: cannot skip in test '%s()', bailing\n",
361+
PRINT(" ERROR: cannot skip in test phase '%s()', bailing\n",
361362
get_friendly_phase_name(phase));
362363
longjmp(stack_fail, 1);
363364
}
@@ -448,7 +449,7 @@ void ztest_test_fail(void)
448449
test_finalize();
449450
break;
450451
default:
451-
PRINT(" ERROR: cannot fail in test '%s()', bailing\n",
452+
PRINT(" ERROR: cannot fail in test phase '%s()', bailing\n",
452453
get_friendly_phase_name(phase));
453454
test_status = ZTEST_STATUS_CRITICAL_ERROR;
454455
break;
@@ -463,7 +464,7 @@ void ztest_test_pass(void)
463464
test_finalize();
464465
break;
465466
default:
466-
PRINT(" ERROR: cannot pass in test '%s()', bailing\n",
467+
PRINT(" ERROR: cannot pass in test phase '%s()', bailing\n",
467468
get_friendly_phase_name(phase));
468469
test_status = ZTEST_STATUS_CRITICAL_ERROR;
469470
if (phase == TEST_PHASE_BEFORE) {
@@ -484,7 +485,7 @@ void ztest_test_skip(void)
484485
test_finalize();
485486
break;
486487
default:
487-
PRINT(" ERROR: cannot skip in test '%s()', bailing\n",
488+
PRINT(" ERROR: cannot skip in test phase '%s()', bailing\n",
488489
get_friendly_phase_name(phase));
489490
test_status = ZTEST_STATUS_CRITICAL_ERROR;
490491
break;

tests/ztest/fail/Kconfig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ endchoice
2929

3030
config TEST_ERROR_STRING
3131
string
32-
default "ERROR: cannot fail in test 'after()', bailing" if ZTEST_FAIL_TEST_ASSERT_AFTER
33-
default "ERROR: cannot fail in test 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSERT_TEARDOWN
34-
default "ERROR: cannot skip in test 'after()', bailing" if ZTEST_FAIL_TEST_ASSUME_AFTER
35-
default "ERROR: cannot skip in test 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSUME_TEARDOWN
36-
default "ERROR: cannot pass in test 'after()', bailing" if ZTEST_FAIL_TEST_PASS_AFTER
37-
default "ERROR: cannot pass in test 'teardown()', bailing" if ZTEST_FAIL_TEST_PASS_TEARDOWN
32+
default "ERROR: cannot fail in test phase 'after()', bailing" if ZTEST_FAIL_TEST_ASSERT_AFTER
33+
default "ERROR: cannot fail in test phase 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSERT_TEARDOWN
34+
default "ERROR: cannot skip in test phase 'after()', bailing" if ZTEST_FAIL_TEST_ASSUME_AFTER
35+
default "ERROR: cannot skip in test phase 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSUME_TEARDOWN
36+
default "ERROR: cannot pass in test phase 'after()', bailing" if ZTEST_FAIL_TEST_PASS_AFTER
37+
default "ERROR: cannot pass in test phase 'teardown()', bailing" if ZTEST_FAIL_TEST_PASS_TEARDOWN
3838
default "Assumption failed at " if ZTEST_FAIL_TEST_UNEXPECTED_ASSUME
3939

4040
source "Kconfig.zephyr"

0 commit comments

Comments
 (0)