>Anyway, this does not matter, this patch is not meant to be
>committed right now because it has no general way of creating
>a test working copy.
Although it will not be committed, I have modified the mistake
I made. Sorry for what have happened:(
New patch:
Index: build.conf
===================================================================
--- build.conf (revision 38192)
+++ build.conf (working copy)
@@ -868,6 +868,14 @@
install = test
libs = libsvn_test libsvn_wc libsvn_subr apriconv apr
+[find-wc-root-test]
+description = Test function svn_wc__find_wc_root()
+type = exe
+path = subversion/tests/libsvn_wc
+sources = find-wc-root-test.c
+install = test
+libs = libsvn_test libsvn_wc libsvn_subr apriconv apr
+
# ----------------------------------------------------------------------------
# These are not unit tests at all, they are small programs that exercise
# parts of the libsvn_delta API from the command line. They are stuck here
Index: subversion/tests/libsvn_wc/find-wc-root-test.c
===================================================================
--- subversion/tests/libsvn_wc/find-wc-root-test.c (revision 0)
+++ subversion/tests/libsvn_wc/find-wc-root-test.c (revision 0)
@@ -0,0 +1,93 @@
+/*
+ * find-wc-root-test.c -- test svn_wc__find_wc_root()
+ */
+
+#include <stdio.h>
+
+#include "svn_pools.h"
+#include "private/svn_wc_private.h"
+#include "../svn_test.h"
+
+/* A quick way to create error messages. */
+static svn_error_t *
+fail(apr_pool_t *pool, const char *fmt, ...)
+{
+ va_list ap;
+ char *msg;
+
+ va_start(ap, fmt);
+ msg = apr_pvsprintf(pool, fmt, ap);
+ va_end(ap);
+
+ return svn_error_create(SVN_ERR_TEST_FAILED, 0, msg);
+}
+
+/* These paths are not included in subversion, so if you want to run this
+ * test, you need to change these paths to the real path on your machine. */
+static const char* path[] = {
+ "E:/subversion/Release/subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/C",
+ /* Windows style path */
+ "E:\\subversion\\Release\\subversion\\tests\\cmdline\\svn-test-work"
+ "\\working_copies\\commit_tests-1\\A\\C",
+ /* The path is a file */
+ "E:/subversion/Release/subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/mu",
+ /* Nested wc path */
+ "E:/subversion/Release/subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/wc2/A/B",
+ /* Relative path */
+ "subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/C",
+ NULL
+};
+
+/* These are wc root paths corresponding to above paths */
+static const char *wc_root[] = {
+ "E:/subversion/Release/subversion/tests/cmdline/"
+ "svn-test-work/working_copies/commit_tests-1",
+ "E:/subversion/Release/subversion/tests/cmdline/"
+ "svn-test-work/working_copies/commit_tests-1",
+ "E:/subversion/Release/subversion/tests/cmdline/"
+ "svn-test-work/working_copies/commit_tests-1",
+ "E:/subversion/Release/subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/wc2",
+ "E:/subversion/Release/subversion/tests/cmdline/"
+ "svn-test-work/working_copies/commit_tests-1",
+ NULL
+};
+
+static svn_error_t *
+test_find_wc_root(apr_pool_t *pool)
+{
+ const char *root_path;
+ apr_pool_t *scratch_pool;
+ int i;
+
+ scratch_pool = svn_pool_create(pool);
+ svn_pool_clear(scratch_pool);
+
+ for (i = 0; path[i] != NULL; i++)
+ {
+ SVN_ERR(svn_wc__find_wc_root(&root_path, path[i], pool, scratch_pool));
+
+ if (svn_path_compare_paths(root_path, wc_root[i]) != 0)
+ return fail(pool, "%d: %s is not wc root", i, root_path);
+ }
+
+ svn_pool_destroy(scratch_pool);
+
+ return SVN_NO_ERROR;
+}
+
+
+/* The test table. */
+
+struct svn_test_descriptor_t test_funcs[] =
+ {
+ SVN_TEST_NULL,
+ SVN_TEST_PASS2(test_find_wc_root,
+ "find wc root of a given path"),
+ SVN_TEST_NULL
+ };
+
------------------
yellow.flying
2009-06-26
__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2365551
Received on 2009-06-26 02:55:40 CEST