Author: stefan2
Date: Sun Apr  8 15:39:52 2012
New Revision: 1311028

URL: http://svn.apache.org/viewvc?rev=1311028&view=rev
Log:
On the reprop-cache branch: Improve usability of SVN_TEST_ASSERT_ERROR
by automatically clearing error objects.

* subversion/tests/svn_test.h
  (SVN_TEST_ASSERT_ERROR): clear error result
* subversion/tests/libsvn_repos/repos-test.c
  (authz, test_path_authz): adapt callers

Modified:
    subversion/branches/revprop-cache/subversion/tests/libsvn_repos/repos-test.c
    subversion/branches/revprop-cache/subversion/tests/svn_test.h

Modified: 
subversion/branches/revprop-cache/subversion/tests/libsvn_repos/repos-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/tests/libsvn_repos/repos-test.c?rev=1311028&r1=1311027&r2=1311028&view=diff
==============================================================================
--- 
subversion/branches/revprop-cache/subversion/tests/libsvn_repos/repos-test.c 
(original)
+++ 
subversion/branches/revprop-cache/subversion/tests/libsvn_repos/repos-test.c 
Sun Apr  8 15:39:52 2012
@@ -1318,9 +1318,8 @@ authz(apr_pool_t *pool)
   contents =
     "[greek:/dir2//secret]"                                                  NL
     "* ="                                                                    
NL;
-  err = authz_get_handle(&authz_cfg, contents, subpool);
-  SVN_TEST_ASSERT_ERROR(err, SVN_ERR_AUTHZ_INVALID_CONFIG);
-  svn_error_clear(err);
+  SVN_TEST_ASSERT_ERROR(authz_get_handle(&authz_cfg, contents, subpool),
+                        SVN_ERR_AUTHZ_INVALID_CONFIG);
 
   /* That's a wrap! */
   svn_pool_destroy(subpool);
@@ -1480,10 +1479,7 @@ test_path_authz(svn_repos_t *repos,
 
   /* Check for potential errors. */
   if (path_action->authz_error_expected)
-    {
-      SVN_TEST_ASSERT_ERROR(err, SVN_ERR_AUTHZ_UNWRITABLE);
-      svn_error_clear(err);
-    }
+    SVN_TEST_ASSERT_ERROR(err, SVN_ERR_AUTHZ_UNWRITABLE);
   else
     SVN_ERR(err);
 

Modified: subversion/branches/revprop-cache/subversion/tests/svn_test.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/revprop-cache/subversion/tests/svn_test.h?rev=1311028&r1=1311027&r2=1311028&view=diff
==============================================================================
--- subversion/branches/revprop-cache/subversion/tests/svn_test.h (original)
+++ subversion/branches/revprop-cache/subversion/tests/svn_test.h Sun Apr  8 
15:39:52 2012
@@ -54,7 +54,9 @@ extern "C" {
   } while (0)
 
 /** Handy macro for testing an expected svn_error_t return value.
- * EXPECTED must be a real error (neither SVN_NO_ERROR nor APR_SUCCESS). */
+ * EXPECTED must be a real error (neither SVN_NO_ERROR nor APR_SUCCESS).
+ * The error returned by EXPR will be cleared.
+ */
 #define SVN_TEST_ASSERT_ERROR(expr, expected)                             \
   do {                                                                    \
     svn_error_t *err__ = (expr);                                          \
@@ -68,6 +70,7 @@ extern "C" {
                                         "Expected error %d but got %s",   \
                                         (expected),                       \
                                         "SVN_NO_ERROR");                  \
+    svn_error_clear(err__);                                               \
   } while (0)
 
 /** Handy macro for testing string equality.


Reply via email to