]> www.infradead.org Git - users/dwmw2/linux.git/commit
kunit: make KUNIT_EXPECT_STREQ() quote values, don't print literals
authorDaniel Latypov <dlatypov@google.com>
Fri, 2 Apr 2021 19:33:57 +0000 (12:33 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 2 Apr 2021 20:14:16 +0000 (14:14 -0600)
commitacd976253c0ce98e92c766bd720bb00e4c2facb6
treec97d398a80aa9f84c50616617b59b8f2782d9404
parent2f9f21cdcd71d0c523676f551ea5c4f78d8e6f61
kunit: make KUNIT_EXPECT_STREQ() quote values, don't print literals

Before:
>  Expected str == "world", but
>      str == hello
>      "world" == world

After:
>  Expected str == "world", but
>      str == "hello"
<we don't need to tell the user that "world" == "world">

Note: like the literal ellision for integers, this doesn't handle the
case of
  KUNIT_EXPECT_STREQ(test, "hello", "world")
since we don't expect it to realistically happen in checked in tests.
(If you really wanted a test to fail, KUNIT_FAIL("msg") exists)

In that case, you'd get:
>  Expected "hello" == "world", but
<output for next failure>

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/assert.c