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 2012/07/26 23:46:37 UTC
svn commit: r1366207 -
/subversion/trunk/subversion/tests/libsvn_client/client-test.c
Author: rhuijben
Date: Thu Jul 26 21:46:37 2012
New Revision: 1366207
URL: http://svn.apache.org/viewvc?rev=1366207&view=rev
Log:
Add a simple C test to verify some 'known' behavior reported on users@s.a.o.
* subversion/tests/libsvn_client/client-test.c
(includes): Add svn_wc_private.h
(test_externals_parse): New test function.
(test_funcs): Add new function.
Modified:
subversion/trunk/subversion/tests/libsvn_client/client-test.c
Modified: subversion/trunk/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/client-test.c?rev=1366207&r1=1366206&r2=1366207&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/client-test.c Thu Jul 26 21:46:37 2012
@@ -33,6 +33,7 @@
#include "svn_client.h"
#include "svn_repos.h"
#include "svn_subst.h"
+#include "private/svn_wc_private.h"
#include "../svn_test.h"
#include "../svn_test_fs.h"
@@ -720,6 +721,82 @@ test_youngest_common_ancestor(const svn_
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_externals_parse(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+ int i;
+ struct external_info
+ {
+ const char *line;
+ const char *url;
+ const char *local_path;
+ svn_revnum_t peg_rev;
+ svn_revnum_t rev;
+
+ } items[] = {
+ {
+ "dir http://server/svn/a",
+ "http://server/svn/a",
+ "dir"
+ },
+ {
+ "/svn/home dir",
+ "u://svr/svn/home",
+ "dir"
+ },
+ {
+ "//server/home dir",
+ "u://server/home",
+ "dir"
+ },
+ {
+ "^/../repB/tools/scripts scripts",
+ "u://svr/svn/cur/repB/tools/scripts",
+ "scripts"
+ },
+ {
+ "^/../repB/tools/README.txt scripts/README.txt",
+ "u://svr/svn/cur/repB/tools/README.txt",
+ "scripts/README.txt"
+ },
+ };
+
+
+ for (i = 0; i < sizeof(items) / sizeof(items[0]); i++)
+ {
+ apr_array_header_t *results;
+ svn_wc_external_item2_t *external_item;
+ const char *resolved_url;
+ SVN_ERR(svn_wc_parse_externals_description3(&results, "/my/current/dir",
+ items[i].line, FALSE, pool));
+
+ SVN_TEST_ASSERT(results && results->nelts == 1);
+
+ external_item = APR_ARRAY_IDX(results, 0, svn_wc_external_item2_t *);
+
+ SVN_ERR(svn_wc__resolve_relative_external_url(&resolved_url,
+ external_item,
+ "u://svr/svn/cur/dir",
+ "u://svr/svn/cur/dir/sd/fl",
+ pool, pool));
+
+ SVN_TEST_STRING_ASSERT(resolved_url, items[i].url);
+ SVN_TEST_STRING_ASSERT(external_item->target_dir, items[i].local_path);
+
+ if (items[i].peg_rev != 0)
+ SVN_TEST_ASSERT(external_item->peg_revision.value.number
+ == items[i].peg_rev);
+ if (items[i].rev != 0)
+ SVN_TEST_ASSERT(external_item->revision.value.number == items[i].rev);
+ }
+
+
+ return SVN_NO_ERROR;
+
+}
+
+
+
/* ========================================================================== */
@@ -737,5 +814,6 @@ struct svn_test_descriptor_t test_funcs[
SVN_TEST_OPTS_PASS(test_16k_add, "test adding 16k files"),
#endif
SVN_TEST_OPTS_PASS(test_youngest_common_ancestor, "test youngest_common_ancestor"),
+ SVN_TEST_OPTS_PASS(test_externals_parse, "test svn_wc_parse_externals_description3"),
SVN_TEST_NULL
};