On the reprop-cache branch: Improve usability of SVN_TEST_ASSERT_ERROR
authorStefan Fuhrmann <[email protected]>
Sun, 8 Apr 2012 15:39:52 +0000 (8 15:39 +0000)
committerStefan Fuhrmann <[email protected]>
Sun, 8 Apr 2012 15:39:52 +0000 (8 15:39 +0000)
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

git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/revprop-cache@1311028 13f79535-47bb-0310-9956-ffa450edef68

subversion/tests/libsvn_repos/repos-test.c
subversion/tests/svn_test.h

index c2305a6..2378c83 100644 (file)
@@ -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);
 
index 5019dd5..201f4be 100644 (file)
@@ -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.