You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/07/01 16:35:37 UTC

svn commit: r1498483 - in /subversion/trunk/subversion/tests: svn_test_fs.c svn_test_fs.h

Author: danielsh
Date: Mon Jul  1 14:35:37 2013
New Revision: 1498483

URL: http://svn.apache.org/r1498483
Log:
svn_test: Add a helper function.

* subversion/tests/svn_test_fs.h
  (svn_test__validate_tree): Declare.

* subversion/tests/svn_test_fs.c
  (svn_test__validate_tree): Implement.

Modified:
    subversion/trunk/subversion/tests/svn_test_fs.c
    subversion/trunk/subversion/tests/svn_test_fs.h

Modified: subversion/trunk/subversion/tests/svn_test_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_fs.c?rev=1498483&r1=1498482&r2=1498483&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_fs.c (original)
+++ subversion/trunk/subversion/tests/svn_test_fs.c Mon Jul  1 14:35:37 2013
@@ -518,6 +518,42 @@ svn_test__validate_tree(svn_fs_root_t *r
 
 
 svn_error_t *
+svn_test__validate_changes(svn_fs_root_t *root,
+                           apr_hash_t *expected,
+                           apr_pool_t *pool)
+{
+  apr_hash_t *actual;
+  apr_hash_index_t *hi;
+
+  SVN_ERR(svn_fs_paths_changed2(&actual, root, pool));
+
+#if 0
+  /* Print ACTUAL and EXPECTED. */
+  {
+    int i;
+    for (i=0, hi = apr_hash_first(pool, expected); hi; hi = apr_hash_next(hi))
+      SVN_DBG(("expected[%d] = '%s'\n", i++, svn__apr_hash_index_key(hi)));
+    for (i=0, hi = apr_hash_first(pool, actual); hi; hi = apr_hash_next(hi))
+      SVN_DBG(("actual[%d] = '%s'\n", i++, svn__apr_hash_index_key(hi)));
+  }
+#endif
+
+  for (hi = apr_hash_first(pool, expected); hi; hi = apr_hash_next(hi))
+    if (NULL == svn_hash_gets(actual, svn__apr_hash_index_key(hi)))
+      return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+                               "Path '%s' missing from actual changed-paths",
+                               svn__apr_hash_index_key(hi));
+
+  for (hi = apr_hash_first(pool, actual); hi; hi = apr_hash_next(hi))
+    if (NULL == svn_hash_gets(expected, svn__apr_hash_index_key(hi)))
+      return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+                               "Path '%s' missing from expected changed-paths",
+                               svn__apr_hash_index_key(hi));
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_test__txn_script_exec(svn_fs_root_t *txn_root,
                           svn_test__txn_script_command_t *script,
                           int num_edits,

Modified: subversion/trunk/subversion/tests/svn_test_fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_fs.h?rev=1498483&r1=1498482&r2=1498483&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_fs.h (original)
+++ subversion/trunk/subversion/tests/svn_test_fs.h Mon Jul  1 14:35:37 2013
@@ -112,6 +112,14 @@ svn_test__validate_tree(svn_fs_root_t *r
                         int num_entries,
                         apr_pool_t *pool);
 
+/* Verify that svn_fs_paths_changed2(ROOT) returns a hash with exactly
+   the same keys as EXPECTED_KEYS.  Values are not currently verified.
+ */
+svn_error_t *
+svn_test__validate_changes(svn_fs_root_t *root,
+                           apr_hash_t *expected_keys,
+                           apr_pool_t *pool);
+
 /* Structure for describing script-ish commands to perform on a
    transaction using svn_test__txn_script_exec().  */
 typedef struct svn_test__txn_script_command_t