You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/03/09 19:36:03 UTC
svn commit: r1665319 - /subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
Author: rhuijben
Date: Mon Mar 9 18:36:03 2015
New Revision: 1665319
URL: http://svn.apache.org/r1665319
Log:
* subversion/tests/libsvn_ra/ra-test.c
(stub_file_rev_handler): New function.
(lock_stub_baton_t): New struct.
(store_lock_result): New function.
(ra_revision_errors): Extend tests to include the blame and lock apis.
Modified:
subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
Modified: subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_ra/ra-test.c?rev=1665319&r1=1665318&r2=1665319&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_ra/ra-test.c Mon Mar 9 18:36:03 2015
@@ -773,6 +773,42 @@ stub_segment_receiver(svn_location_segme
{
return SVN_NO_ERROR;
}
+/* Stub svn_file_rev_handler_t */
+static svn_error_t *
+stub_file_rev_handler(void *baton,
+ const char *path,
+ svn_revnum_t rev,
+ apr_hash_t *rev_props,
+ svn_boolean_t result_of_merge,
+ svn_txdelta_window_handler_t *delta_handler,
+ void **delta_baton,
+ apr_array_header_t *prop_diffs,
+ apr_pool_t *pool)
+{
+ if (delta_handler)
+ *delta_handler = svn_delta_noop_window_handler;
+
+ return SVN_NO_ERROR;
+}
+
+struct lock_stub_baton_t
+{
+ apr_status_t result_code;
+};
+
+static svn_error_t *
+store_lock_result(void *baton,
+ const char *path,
+ svn_boolean_t do_lock,
+ const svn_lock_t *lock,
+ svn_error_t *ra_err,
+ apr_pool_t *pool)
+{
+ struct lock_stub_baton_t *b = baton;
+
+ b->result_code = ra_err ? ra_err->apr_err : APR_SUCCESS;
+ return SVN_NO_ERROR;
+}
static svn_error_t *
ra_revision_errors(const svn_test_opts_t *opts,
@@ -1104,6 +1140,47 @@ ra_revision_errors(const svn_test_opts_t
NULL, pool));
}
+ {
+ SVN_TEST_ASSERT_ERROR(svn_ra_get_file_revs2(ra_session, "A/iota", 2, 0,
+ FALSE, stub_file_rev_handler,
+ NULL, pool),
+ SVN_ERR_FS_NO_SUCH_REVISION);
+
+ SVN_TEST_ASSERT_ERROR(svn_ra_get_file_revs2(ra_session, "A/iota", 0, 2,
+ FALSE, stub_file_rev_handler,
+ NULL, pool),
+ SVN_ERR_FS_NO_SUCH_REVISION);
+
+ SVN_TEST_ASSERT_ERROR(svn_ra_get_file_revs2(ra_session, "A", 1, 1,
+ FALSE, stub_file_rev_handler,
+ NULL, pool),
+ SVN_ERR_FS_NOT_FILE);
+ }
+
+ {
+ apr_hash_t *locks = apr_hash_make(pool);
+ svn_revnum_t rev = 2;
+ struct lock_stub_baton_t lr = {0};
+
+ svn_hash_sets(locks, "A/iota", &rev);
+
+ SVN_ERR(svn_ra_lock(ra_session, locks, "comment", FALSE,
+ store_lock_result, &lr, pool));
+ SVN_TEST_ASSERT(lr.result_code == SVN_ERR_FS_NO_SUCH_REVISION);
+
+ rev = 0;
+ SVN_ERR(svn_ra_lock(ra_session, locks, "comment", FALSE,
+ store_lock_result, &lr, pool));
+ SVN_TEST_ASSERT(lr.result_code == SVN_ERR_FS_OUT_OF_DATE);
+
+ svn_hash_sets(locks, "A/iota", NULL);
+ svn_hash_sets(locks, "A", &rev);
+ rev = SVN_INVALID_REVNUM;
+ SVN_ERR(svn_ra_lock(ra_session, locks, "comment", FALSE,
+ store_lock_result, &lr, pool));
+ SVN_TEST_ASSERT(lr.result_code == SVN_ERR_FS_NOT_FILE);
+ }
+
return SVN_NO_ERROR;
}