subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1163169 - /subversion/trunk/subversion/tests/svn_test.h
Date Tue, 30 Aug 2011 10:52:56 GMT
Author: danielsh
Date: Tue Aug 30 10:52:56 2011
New Revision: 1163169

URL: http://svn.apache.org/viewvc?rev=1163169&view=rev
Log:
In the C tests, add a utility error-checking macro.

* subversion/test/svn_test.h
  (SVN_TEST_ASSERT_ERROR): New macro.

Modified:
    subversion/trunk/subversion/tests/svn_test.h

Modified: subversion/trunk/subversion/tests/svn_test.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test.h?rev=1163169&r1=1163168&r2=1163169&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test.h (original)
+++ subversion/trunk/subversion/tests/svn_test.h Tue Aug 30 10:52:56 2011
@@ -53,6 +53,20 @@ extern "C" {
                                #expr, __FILE__, __LINE__);        \
   } while (0)
 
+/** Handy macro for testing an expected svn_error_t return value. */
+#define SVN_TEST_ASSERT_ERROR(expr, expected)                             \
+  do {                                                                    \
+    if ((expr) == SVN_NO_ERROR || (expr)->apr_err != (expected))          \
+      return (expr) ? svn_error_createf(SVN_ERR_TEST_FAILED, (expr),      \
+                                        "Expected error %d but got %d",   \
+                                        (expected),                       \
+                                        (expr)->apr_err)                  \
+                    : svn_error_createf(SVN_ERR_TEST_FAILED, (expr),      \
+                                        "Expected error %d but got %s",   \
+                                        (expected),                       \
+                                        "SVN_NO_ERROR");                  \
+  } while (0)
+
 /** Handy macro for testing string equality.
  */
 #define SVN_TEST_STRING_ASSERT(expr, expected_expr)                 \



Mime
View raw message