2 * Regression tests for logic in the libsvn_client library.
4 * ====================================================================
5 * Copyright (c) 2007 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
20 #include "svn_mergeinfo.h"
21 #include "../../libsvn_client/mergeinfo.h"
22 #include "svn_pools.h"
24 #include "../svn_test.h"
28 const char *unparsed_mergeinfo
;
29 svn_boolean_t remains
;
30 } mergeinfo_catalog_item
;
34 static mergeinfo_catalog_item elide_testcases
[][MAX_ITEMS
] = {
35 { {"/foo", "/bar: 1-4", TRUE
},
36 {"/foo/beep/baz", "/bar/beep/baz: 1-4", FALSE
},
38 { {"/foo", "/bar: 1-4", TRUE
},
39 {"/foo/beep/baz", "/blaa/beep/baz: 1-4", TRUE
},
41 { {"/", "/gah: 1-4", TRUE
},
42 {"/foo/beep/baz", "/gah/foo/beep/baz: 1-4", FALSE
},
47 test_elide_mergeinfo_catalog(const char **msg
,
48 svn_boolean_t msg_only
,
49 svn_test_opts_t
*opts
,
55 *msg
= "test svn_client__elide_mergeinfo_catalog";
59 iterpool
= svn_pool_create(pool
);
62 i
< sizeof(elide_testcases
) / sizeof(elide_testcases
[0]);
66 mergeinfo_catalog_item
*item
;
68 svn_pool_clear(iterpool
);
70 catalog
= apr_hash_make(iterpool
);
71 for (item
= elide_testcases
[i
]; item
->path
; item
++)
73 apr_hash_t
*mergeinfo
;
75 SVN_ERR(svn_mergeinfo_parse(&mergeinfo
, item
->unparsed_mergeinfo
,
77 apr_hash_set(catalog
, item
->path
, APR_HASH_KEY_STRING
, mergeinfo
);
80 SVN_ERR(svn_client__elide_mergeinfo_catalog(catalog
, iterpool
));
82 for (item
= elide_testcases
[i
]; item
->path
; item
++)
84 apr_hash_t
*mergeinfo
= apr_hash_get(catalog
, item
->path
,
86 if (item
->remains
&& !mergeinfo
)
87 return svn_error_createf(SVN_ERR_TEST_FAILED
, NULL
,
88 "Elision for test case #%d incorrectly "
89 "elided '%s'", i
, item
->path
);
90 if (!item
->remains
&& mergeinfo
)
91 return svn_error_createf(SVN_ERR_TEST_FAILED
, NULL
,
92 "Elision for test case #%d failed to "
93 "elide '%s'", i
, item
->path
);
97 svn_pool_destroy(iterpool
);
101 /* ========================================================================== */
103 struct svn_test_descriptor_t test_funcs
[] =
106 SVN_TEST_PASS(test_elide_mergeinfo_catalog
),