selftest: show values when ASSERT_STREQ fails
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 13 Jun 2016 20:58:08 +0000 (20:58 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Mon, 13 Jun 2016 20:58:08 +0000 (20:58 +0000)
commit755fa6662d06f5ab2f32043bab4728bbf654d29d
treea014daaa092f85dfc9fc4901e27b06537f61aa15
parenta73786e39ff86e8e1d186baaf802b99f8675bbeb
selftest: show values when ASSERT_STREQ fails

Rework ASSERT_STREQ so that it prints the actual and expected values
to stderr when it fails (by moving it to a helper function).

gcc/ChangeLog:
* selftest.c (selftest::fail_formatted): New function.
(selftest::assert_streq): New function.
* selftest.h (selftests::fail_formatted): New decl.
(selftest::assert_streq): New decl.
(ASSERT_STREQ): Reimplement in terms of selftest::assert_streq.

From-SVN: r237404
gcc/ChangeLog
gcc/selftest.c
gcc/selftest.h