From 73b9741c872e1a9c23f91e81eaa5d673b55d8653 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Sat, 25 Aug 2012 15:32:54 +0100 Subject: [PATCH] _PDCLIB_iotest.h: Print out the format string which caused the error (PDCLIB-6) --- testing/_PDCLIB_iotest.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/testing/_PDCLIB_iotest.h b/testing/_PDCLIB_iotest.h index 134a444..c3118dc 100644 --- a/testing/_PDCLIB_iotest.h +++ b/testing/_PDCLIB_iotest.h @@ -32,6 +32,7 @@ #define PREP_RESULT_BUFFER #endif +#define GETFMT( fmt, ... ) (fmt) #define PRINTF_TEST( expected_rc, expected_string, ... ) do { \ PREP_RESULT_BUFFER \ int actual_rc = testprintf( target, __VA_ARGS__ ); \ @@ -40,7 +41,13 @@ ( RESULT_MISMATCH( target, expected_string ) ) ) \ { \ ++TEST_RESULTS; \ - fprintf( stderr, "FAILED: " __FILE__ " (" _PDCLIB_FILEID "), line %d\n expected %2d, \"%s\"\n actual %2d, \"%s\"\n", __LINE__, expected_rc, expected_string, actual_rc, RESULT_STRING( target ) ); \ + fprintf( stderr, \ + "FAILED: " __FILE__ " (" _PDCLIB_FILEID "), line %d\n" \ + " format string \"%s\"\n" \ + " expected %2d, \"%s\"\n" \ + " actual %2d, \"%s\"\n", \ + __LINE__, GETFMT(__VA_ARGS__, 0), expected_rc, \ + expected_string, actual_rc, RESULT_STRING( target ) ); \ } \ } while ( 0 ) -- 2.40.0