Author: kotkov
Date: Wed Nov 22 15:14:25 2017
New Revision: 1816060

URL: http://svn.apache.org/viewvc?rev=1816060&view=rev
Log:
Following up on r1815799, rework the commit_locked_empty_relpath_test().

Within it, don't test an undocumented/invalid usage of the delta editor
API with using open_root() for a file URL as, apparently, that works by
a coincidence.

* subversion/tests/libsvn_ra/ra-test.c
  (commit_locked_empty_relpath_test): Rename to...
  (commit_locked_file): ...this.  Properly open the parent folder as
   the root of the edit and avoid using empty relpaths.
  (test_funcs): Track the test rename.

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=1816060&r1=1816059&r2=1816060&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_ra/ra-test.c Wed Nov 22 15:14:25 
2017
@@ -1683,8 +1683,7 @@ commit_empty_last_change(const svn_test_
 }
 
 static svn_error_t *
-commit_locked_empty_relpath_test(const svn_test_opts_t *opts,
-                                 apr_pool_t *pool)
+commit_locked_file(const svn_test_opts_t *opts, apr_pool_t *pool)
 {
   const char *url;
   svn_ra_callbacks2_t *cbtable;
@@ -1693,7 +1692,6 @@ commit_locked_empty_relpath_test(const s
   void *edit_baton;
   void *root_baton;
   void *file_baton;
-  const char *file_url;
   struct lock_result_t *lock_result;
   apr_hash_t *lock_tokens;
   svn_txdelta_window_handler_t handler;
@@ -1703,7 +1701,7 @@ commit_locked_empty_relpath_test(const s
   const svn_string_t *propval;
 
   SVN_ERR(svn_test__create_repos2(NULL, &url, NULL,
-                                  "test-repo-commit-locked-empty-relpath-test",
+                                  "test-repo-commit-locked-file-test",
                                   opts, pool, pool));
 
   SVN_ERR(svn_ra_initialize(pool));
@@ -1742,22 +1740,20 @@ commit_locked_empty_relpath_test(const s
     lock_result = svn_hash_gets(baton.results, "file");
   }
 
-  /* Open a new session using the file's URL (since now, we would be
-   * using "" as the file's relpath). */
-  file_url = svn_path_url_add_component2(url, "file", pool);
-  SVN_ERR(svn_ra_open4(&session, NULL, file_url, NULL, cbtable,
+  /* Open a new session using the file parent's URL. */
+  SVN_ERR(svn_ra_open4(&session, NULL, url, NULL, cbtable,
                        NULL, NULL, pool));
 
   /* Create a new commit editor supplying our lock token. */
   lock_tokens = apr_hash_make(pool);
-  svn_hash_sets(lock_tokens, "", lock_result->lock->token);
+  svn_hash_sets(lock_tokens, "file", lock_result->lock->token);
   SVN_ERR(svn_ra_get_commit_editor3(session, &editor, &edit_baton,
                                     apr_hash_make(pool), NULL, NULL,
                                     lock_tokens, TRUE, pool));
   /* Edit the locked file. */
   SVN_ERR(editor->open_root(edit_baton, SVN_INVALID_REVNUM,
                             pool, &root_baton));
-  SVN_ERR(editor->open_file("", root_baton, SVN_INVALID_REVNUM, pool,
+  SVN_ERR(editor->open_file("file", root_baton, SVN_INVALID_REVNUM, pool,
                             &file_baton));
   SVN_ERR(editor->apply_textdelta(file_baton, NULL, pool, &handler,
                                   &handler_baton));
@@ -1768,14 +1764,14 @@ commit_locked_empty_relpath_test(const s
   SVN_ERR(editor->close_edit(edit_baton, pool));
 
   /* Check the result. */
-  SVN_ERR(svn_ra_get_file(session, "", SVN_INVALID_REVNUM, NULL,
+  SVN_ERR(svn_ra_get_file(session, "file", SVN_INVALID_REVNUM, NULL,
                           &fetched_rev, NULL, pool));
   SVN_TEST_INT_ASSERT((int) fetched_rev, 2);
 
   /* Change property of the locked file. */
   SVN_ERR(editor->open_root(edit_baton, SVN_INVALID_REVNUM,
                             pool, &root_baton));
-  SVN_ERR(editor->open_file("", root_baton, SVN_INVALID_REVNUM, pool,
+  SVN_ERR(editor->open_file("file", root_baton, SVN_INVALID_REVNUM, pool,
                             &file_baton));
   SVN_ERR(editor->change_file_prop(file_baton, "propname",
                                    svn_string_create("propval", pool),
@@ -1785,7 +1781,7 @@ commit_locked_empty_relpath_test(const s
   SVN_ERR(editor->close_edit(edit_baton, pool));
 
   /* Check the result. */
-  SVN_ERR(svn_ra_get_file(session, "", SVN_INVALID_REVNUM, NULL,
+  SVN_ERR(svn_ra_get_file(session, "file", SVN_INVALID_REVNUM, NULL,
                           &fetched_rev, &fetched_props, pool));
   SVN_TEST_INT_ASSERT((int) fetched_rev, 3);
   propval = svn_hash_gets(fetched_props, "propname");
@@ -1829,8 +1825,8 @@ static struct svn_test_descriptor_t test
                        "verify checkout over a tunnel"),
     SVN_TEST_OPTS_PASS(commit_empty_last_change,
                        "check how last change applies to empty commit"),
-    SVN_TEST_OPTS_PASS(commit_locked_empty_relpath_test,
-                       "check commit editor with relpath='' and lock"),
+    SVN_TEST_OPTS_PASS(commit_locked_file,
+                       "check commit editor for a locked file"),
     SVN_TEST_NULL
   };
 


Reply via email to