bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: improve diagnostic when an assertion fails


From: Paul Eggert
Subject: [PATCH] tests: improve diagnostic when an assertion fails
Date: Sun, 06 Oct 2013 14:12:27 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

* tests/macros.h (ASSERT): Report the assertion that failed.
---
 ChangeLog      | 5 +++++
 tests/macros.h | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9eb2479..99357ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-06  Paul Eggert  <address@hidden>
+
+       tests: improve diagnostic when an assertion fails
+       * tests/macros.h (ASSERT): Report the assertion that failed.
+
 2013-10-02  Paul Eggert  <address@hidden>
 
        verify: new macro 'assume'
diff --git a/tests/macros.h b/tests/macros.h
index 60ba894..1ceb815 100644
--- a/tests/macros.h
+++ b/tests/macros.h
@@ -48,8 +48,8 @@
     {                                                                        \
       if (!(expr))                                                           \
         {                                                                    \
-          fprintf (ASSERT_STREAM, "%s:%d: assertion failed\n",               \
-                   __FILE__, __LINE__);                                      \
+          fprintf (ASSERT_STREAM, "%s:%d: assertion '%s' failed\n",     \
+                   __FILE__, __LINE__, #expr);                          \
           fflush (ASSERT_STREAM);                                            \
           abort ();                                                          \
         }                                                                    \
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]