On Wed, Aug 19, 2020 at 12:39 PM Vitor Massaru Iha vitor@massaru.org wrote:
In some cases, to maintain the consistency of the Expected messages with the original runtime test, it is necessary to customize the Expected messages on KUnit.
As an example test_overflow conversion to KUnit (I added 1, p->s_of+1, just to fail the test).
Using KUNIT_EXPECT_EQ:
Expected _of == p->s_of+1, but _of == 0 p->s_of+1 == 1 not ok 1 - overflow_calculation_test ok 2 - overflow_shift_test
Using KUNIT_EXPECT_EQ_CUSTOM_MSG:
Expected 0 + 0 to not overflow (type u8) not ok 1 - overflow_calculation_test
Which is more similar to the error message of the original test.
Signed-off-by: Vitor Massaru Iha vitor@massaru.org
All in all this looks pretty reasonable to me; however, is there any chance you could provide an example of its usage?