[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1075942 - in /subversion/trunk: notes/wc-ng/pristine-store subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_pristine.c subversion/tests/libsvn_wc/pristine-store-test.c

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Wed, 2 Mar 2011 06:08:11 +0200

Daniel Shahaf wrote on Wed, Mar 02, 2011 at 05:44:14 +0200:
> julianfoad_at_apache.org wrote on Tue, Mar 01, 2011 at 17:47:05 -0000:
> > + SVN_TEST_ASSERT(err != NULL);
> > + SVN_TEST_ASSERT(err->apr_err == SVN_ERR_WC_CORRUPT_TEXT_BASE);

Perhaps something along these lines?

[[[
Index: subversion/tests/svn_test.h
===================================================================
--- subversion/tests/svn_test.h (revision 1075469)
+++ subversion/tests/svn_test.h (working copy)
@@ -67,6 +67,19 @@ extern "C" {
           tst_str2, tst_str1); \
   } while(0)
 
+/** Handy macro for testing expected error codes.
+ */
+#define SVN_TEST_ERR_ASSERT(err, expected_apr_err) \
+ do { \
+ apr_status_t expected = (expected_apr_err); \
+ svn_error_t *svn_err__temp = (expr); \
+ apr_status_t *apr_err = (svn_err__temp ? svn_err__temp->apr_err \
+ : 0); \
+ if (apr_err != expected) \
+ return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, \
+ "Expected error E%06d, but got E%06d", \
+ expected, apr_err); \
+ }
 
 /* Baton for any arguments that need to be passed from main() to svn
  * test functions.
]]]

(it should learn to distinguish NULL from ->apr_err == 0 before
commit, though.)
Received on 2011-03-02 05:09:19 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.