summaryrefslogtreecommitdiff
path: root/tests-clar
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/diff/blob.c76
-rw-r--r--tests-clar/diff/diff_helpers.c17
-rw-r--r--tests-clar/diff/diff_helpers.h9
-rw-r--r--tests-clar/diff/index.c12
-rw-r--r--tests-clar/diff/rename.c105
-rw-r--r--tests-clar/diff/tree.c50
-rw-r--r--tests-clar/diff/workdir.c134
-rw-r--r--tests-clar/resources/renames/.gitted/HEAD1
-rw-r--r--tests-clar/resources/renames/.gitted/config7
-rw-r--r--tests-clar/resources/renames/.gitted/description1
-rw-r--r--tests-clar/resources/renames/.gitted/indexbin0 -> 272 bytes
-rw-r--r--tests-clar/resources/renames/.gitted/info/exclude6
-rw-r--r--tests-clar/resources/renames/.gitted/logs/HEAD2
-rw-r--r--tests-clar/resources/renames/.gitted/logs/refs/heads/master2
-rw-r--r--tests-clar/resources/renames/.gitted/objects/03/da7ad872536bd448da8d88eb7165338bf923a7bin0 -> 90 bytes
-rw-r--r--tests-clar/resources/renames/.gitted/objects/2b/c7f351d20b53f1c72c16c4b036e491c478c49abin0 -> 173 bytes
-rw-r--r--tests-clar/resources/renames/.gitted/objects/31/e47d8c1fa36d7f8d537b96158e3f024de0a9f2bin0 -> 131 bytes
-rw-r--r--tests-clar/resources/renames/.gitted/objects/61/8c6f2f8740bd6049b2fb9eb93fc15726462745bin0 -> 106 bytes
-rw-r--r--tests-clar/resources/renames/.gitted/objects/66/311f5cfbe7836c27510a3ba2f43e282e2c8bbabin0 -> 1155 bytes
-rw-r--r--tests-clar/resources/renames/.gitted/objects/ad/0a8e55a104ac54a8a29ed4b84b49e76837a113bin0 -> 415 bytes
-rw-r--r--tests-clar/resources/renames/.gitted/refs/heads/master1
-rw-r--r--tests-clar/resources/renames/sevencities.txt49
-rw-r--r--tests-clar/resources/renames/sixserving.txt24
-rw-r--r--tests-clar/resources/renames/songofseven.txt49
24 files changed, 388 insertions, 157 deletions
diff --git a/tests-clar/diff/blob.c b/tests-clar/diff/blob.c
index d5cf41e99..0a37e829d 100644
--- a/tests-clar/diff/blob.c
+++ b/tests-clar/diff/blob.c
@@ -59,8 +59,8 @@ void test_diff_blob__can_compare_text_blobs(void)
a, b, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_mods);
- cl_assert(expected.at_least_one_of_them_is_binary == false);
+ cl_assert_equal_i(1, expected.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(0, expected.files_binary);
cl_assert_equal_i(1, expected.hunks);
cl_assert_equal_i(6, expected.lines);
@@ -74,8 +74,8 @@ void test_diff_blob__can_compare_text_blobs(void)
b, c, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_mods);
- cl_assert(expected.at_least_one_of_them_is_binary == false);
+ cl_assert_equal_i(1, expected.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(0, expected.files_binary);
cl_assert_equal_i(1, expected.hunks);
cl_assert_equal_i(15, expected.lines);
@@ -89,8 +89,8 @@ void test_diff_blob__can_compare_text_blobs(void)
a, c, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_mods);
- cl_assert(expected.at_least_one_of_them_is_binary == false);
+ cl_assert_equal_i(1, expected.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(0, expected.files_binary);
cl_assert_equal_i(1, expected.hunks);
cl_assert_equal_i(13, expected.lines);
@@ -103,8 +103,8 @@ void test_diff_blob__can_compare_text_blobs(void)
c, d, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_mods);
- cl_assert(expected.at_least_one_of_them_is_binary == false);
+ cl_assert_equal_i(1, expected.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(0, expected.files_binary);
cl_assert_equal_i(2, expected.hunks);
cl_assert_equal_i(14, expected.lines);
@@ -125,8 +125,8 @@ void test_diff_blob__can_compare_against_null_blobs(void)
d, e, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_dels);
- cl_assert(expected.at_least_one_of_them_is_binary == false);
+ cl_assert_equal_i(1, expected.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(0, expected.files_binary);
cl_assert_equal_i(1, expected.hunks);
cl_assert_equal_i(14, expected.hunk_old_lines);
@@ -140,8 +140,8 @@ void test_diff_blob__can_compare_against_null_blobs(void)
d, e, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_adds);
- cl_assert(expected.at_least_one_of_them_is_binary == false);
+ cl_assert_equal_i(1, expected.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, expected.files_binary);
cl_assert_equal_i(1, expected.hunks);
cl_assert_equal_i(14, expected.hunk_new_lines);
@@ -154,10 +154,9 @@ void test_diff_blob__can_compare_against_null_blobs(void)
cl_git_pass(git_diff_blobs(
alien, NULL, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
- cl_assert(expected.at_least_one_of_them_is_binary == true);
-
cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_dels);
+ cl_assert_equal_i(1, expected.files_binary);
+ cl_assert_equal_i(1, expected.file_status[GIT_DELTA_DELETED]);
cl_assert_equal_i(0, expected.hunks);
cl_assert_equal_i(0, expected.lines);
@@ -166,20 +165,19 @@ void test_diff_blob__can_compare_against_null_blobs(void)
cl_git_pass(git_diff_blobs(
NULL, alien, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
- cl_assert(expected.at_least_one_of_them_is_binary == true);
-
cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_adds);
+ cl_assert_equal_i(1, expected.files_binary);
+ cl_assert_equal_i(1, expected.file_status[GIT_DELTA_ADDED]);
cl_assert_equal_i(0, expected.hunks);
cl_assert_equal_i(0, expected.lines);
}
-static void assert_identical_blobs_comparison(diff_expects expected)
+static void assert_identical_blobs_comparison(diff_expects *expected)
{
- cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_unmodified);
- cl_assert_equal_i(0, expected.hunks);
- cl_assert_equal_i(0, expected.lines);
+ cl_assert_equal_i(1, expected->files);
+ cl_assert_equal_i(1, expected->file_status[GIT_DELTA_UNMODIFIED]);
+ cl_assert_equal_i(0, expected->hunks);
+ cl_assert_equal_i(0, expected->lines);
}
void test_diff_blob__can_compare_identical_blobs(void)
@@ -187,32 +185,32 @@ void test_diff_blob__can_compare_identical_blobs(void)
cl_git_pass(git_diff_blobs(
d, d, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
- cl_assert(expected.at_least_one_of_them_is_binary == false);
- assert_identical_blobs_comparison(expected);
+ cl_assert_equal_i(0, expected.files_binary);
+ assert_identical_blobs_comparison(&expected);
memset(&expected, 0, sizeof(expected));
cl_git_pass(git_diff_blobs(
NULL, NULL, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
- cl_assert(expected.at_least_one_of_them_is_binary == false);
- assert_identical_blobs_comparison(expected);
+ cl_assert_equal_i(0, expected.files_binary);
+ assert_identical_blobs_comparison(&expected);
memset(&expected, 0, sizeof(expected));
cl_git_pass(git_diff_blobs(
alien, alien, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
- cl_assert(expected.at_least_one_of_them_is_binary == true);
- assert_identical_blobs_comparison(expected);
+ cl_assert(expected.files_binary > 0);
+ assert_identical_blobs_comparison(&expected);
}
-static void assert_binary_blobs_comparison(diff_expects expected)
+static void assert_binary_blobs_comparison(diff_expects *expected)
{
- cl_assert(expected.at_least_one_of_them_is_binary == true);
+ cl_assert(expected->files_binary > 0);
- cl_assert_equal_i(1, expected.files);
- cl_assert_equal_i(1, expected.file_mods);
- cl_assert_equal_i(0, expected.hunks);
- cl_assert_equal_i(0, expected.lines);
+ cl_assert_equal_i(1, expected->files);
+ cl_assert_equal_i(1, expected->file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(0, expected->hunks);
+ cl_assert_equal_i(0, expected->lines);
}
void test_diff_blob__can_compare_two_binary_blobs(void)
@@ -227,14 +225,14 @@ void test_diff_blob__can_compare_two_binary_blobs(void)
cl_git_pass(git_diff_blobs(
alien, heart, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
- assert_binary_blobs_comparison(expected);
+ assert_binary_blobs_comparison(&expected);
memset(&expected, 0, sizeof(expected));
cl_git_pass(git_diff_blobs(
heart, alien, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
- assert_binary_blobs_comparison(expected);
+ assert_binary_blobs_comparison(&expected);
git_blob_free(heart);
}
@@ -244,14 +242,14 @@ void test_diff_blob__can_compare_a_binary_blob_and_a_text_blob(void)
cl_git_pass(git_diff_blobs(
alien, d, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
- assert_binary_blobs_comparison(expected);
+ assert_binary_blobs_comparison(&expected);
memset(&expected, 0, sizeof(expected));
cl_git_pass(git_diff_blobs(
d, alien, &opts, &expected, diff_file_fn, diff_hunk_fn, diff_line_fn));
- assert_binary_blobs_comparison(expected);
+ assert_binary_blobs_comparison(&expected);
}
/*
diff --git a/tests-clar/diff/diff_helpers.c b/tests-clar/diff/diff_helpers.c
index de0e7e074..992c87d4c 100644
--- a/tests-clar/diff/diff_helpers.c
+++ b/tests-clar/diff/diff_helpers.c
@@ -32,20 +32,13 @@ int diff_file_fn(
e->files++;
- if (delta->binary) {
- e->at_least_one_of_them_is_binary = true;
+ if (delta->binary)
e->files_binary++;
- }
- switch (delta->status) {
- case GIT_DELTA_ADDED: e->file_adds++; break;
- case GIT_DELTA_DELETED: e->file_dels++; break;
- case GIT_DELTA_MODIFIED: e->file_mods++; break;
- case GIT_DELTA_IGNORED: e->file_ignored++; break;
- case GIT_DELTA_UNTRACKED: e->file_untracked++; break;
- case GIT_DELTA_UNMODIFIED: e->file_unmodified++; break;
- default: break;
- }
+ cl_assert(delta->status <= GIT_DELTA_TYPECHANGE);
+
+ e->file_status[delta->status] += 1;
+
return 0;
}
diff --git a/tests-clar/diff/diff_helpers.h b/tests-clar/diff/diff_helpers.h
index 629130934..6ff493d49 100644
--- a/tests-clar/diff/diff_helpers.h
+++ b/tests-clar/diff/diff_helpers.h
@@ -8,12 +8,7 @@ typedef struct {
int files;
int files_binary;
- int file_adds;
- int file_dels;
- int file_mods;
- int file_ignored;
- int file_untracked;
- int file_unmodified;
+ int file_status[10]; /* indexed by git_delta_t value */
int hunks;
int hunk_new_lines;
@@ -23,8 +18,6 @@ typedef struct {
int line_ctxt;
int line_adds;
int line_dels;
-
- bool at_least_one_of_them_is_binary;
} diff_expects;
extern int diff_file_fn(
diff --git a/tests-clar/diff/index.c b/tests-clar/diff/index.c
index 7c4bddb90..eda8f066a 100644
--- a/tests-clar/diff/index.c
+++ b/tests-clar/diff/index.c
@@ -45,9 +45,9 @@ void test_diff_index__0(void)
* - mv .git .gitted
*/
cl_assert_equal_i(8, exp.files);
- cl_assert_equal_i(3, exp.file_adds);
- cl_assert_equal_i(2, exp.file_dels);
- cl_assert_equal_i(3, exp.file_mods);
+ cl_assert_equal_i(3, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(3, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(8, exp.hunks);
@@ -73,9 +73,9 @@ void test_diff_index__0(void)
* - mv .git .gitted
*/
cl_assert_equal_i(12, exp.files);
- cl_assert_equal_i(7, exp.file_adds);
- cl_assert_equal_i(2, exp.file_dels);
- cl_assert_equal_i(3, exp.file_mods);
+ cl_assert_equal_i(7, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(3, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(12, exp.hunks);
diff --git a/tests-clar/diff/rename.c b/tests-clar/diff/rename.c
new file mode 100644
index 000000000..0ee1db842
--- /dev/null
+++ b/tests-clar/diff/rename.c
@@ -0,0 +1,105 @@
+#include "clar_libgit2.h"
+#include "diff_helpers.h"
+
+static git_repository *g_repo = NULL;
+
+void test_diff_rename__initialize(void)
+{
+ g_repo = cl_git_sandbox_init("renames");
+}
+
+void test_diff_rename__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+/*
+ * Renames repo has:
+ *
+ * commit 31e47d8c1fa36d7f8d537b96158e3f024de0a9f2 -
+ * serving.txt (25 lines)
+ * sevencities.txt (50 lines)
+ * commit 2bc7f351d20b53f1c72c16c4b036e491c478c49a -
+ * serving.txt -> sixserving.txt (rename, no change, 100% match)
+ * sevencities.txt -> sevencities.txt (no change)
+ * sevencities.txt -> songofseven.txt (copy, no change, 100% match)
+ *
+ * TODO: add commits with various % changes of copy / rename
+ */
+
+void test_diff_rename__match_oid(void)
+{
+ const char *old_sha = "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2";
+ const char *new_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
+ git_tree *old_tree, *new_tree;
+ git_diff_list *diff;
+ git_diff_options diffopts = {0};
+ git_diff_find_options opts;
+ diff_expects exp;
+
+ old_tree = resolve_commit_oid_to_tree(g_repo, old_sha);
+ new_tree = resolve_commit_oid_to_tree(g_repo, new_sha);
+
+ /* Must pass GIT_DIFF_INCLUDE_UNMODIFIED if you expect to emulate
+ * --find-copies-harder during rename transformion...
+ */
+ memset(&diffopts, 0, sizeof(diffopts));
+ diffopts.flags |= GIT_DIFF_INCLUDE_UNMODIFIED;
+
+ cl_git_pass(git_diff_tree_to_tree(
+ g_repo, &diffopts, old_tree, new_tree, &diff));
+
+ /* git diff --no-renames \
+ * 31e47d8c1fa36d7f8d537b96158e3f024de0a9f2 \
+ * 2bc7f351d20b53f1c72c16c4b036e491c478c49a
+ */
+ memset(&exp, 0, sizeof(exp));
+ cl_git_pass(git_diff_foreach(
+ diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
+
+ cl_assert_equal_i(4, exp.files);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNMODIFIED]);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
+
+ /* git diff 31e47d8c1fa36d7f8d537b96158e3f024de0a9f2 \
+ * 2bc7f351d20b53f1c72c16c4b036e491c478c49a
+ */
+ cl_git_pass(git_diff_find_similar(diff, NULL));
+
+ memset(&exp, 0, sizeof(exp));
+ cl_git_pass(git_diff_foreach(
+ diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
+
+ cl_assert_equal_i(3, exp.files);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNMODIFIED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
+
+ git_diff_list_free(diff);
+
+ cl_git_pass(git_diff_tree_to_tree(
+ g_repo, &diffopts, old_tree, new_tree, &diff));
+
+ /* git diff --find-copies-harder \
+ * 31e47d8c1fa36d7f8d537b96158e3f024de0a9f2 \
+ * 2bc7f351d20b53f1c72c16c4b036e491c478c49a
+ */
+ memset(&opts, 0, sizeof(opts));
+ opts.flags = GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED;
+ cl_git_pass(git_diff_find_similar(diff, &opts));
+
+ memset(&exp, 0, sizeof(exp));
+ cl_git_pass(git_diff_foreach(
+ diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
+
+ cl_assert_equal_i(3, exp.files);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNMODIFIED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_COPIED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
+
+ git_diff_list_free(diff);
+
+ git_tree_free(old_tree);
+ git_tree_free(new_tree);
+}
diff --git a/tests-clar/diff/tree.c b/tests-clar/diff/tree.c
index c5a0e626e..f8b9a71a5 100644
--- a/tests-clar/diff/tree.c
+++ b/tests-clar/diff/tree.c
@@ -40,9 +40,9 @@ void test_diff_tree__0(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(5, exp.files);
- cl_assert_equal_i(2, exp.file_adds);
- cl_assert_equal_i(1, exp.file_dels);
- cl_assert_equal_i(2, exp.file_mods);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(5, exp.hunks);
@@ -62,9 +62,9 @@ void test_diff_tree__0(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(2, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(2, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(2, exp.hunks);
@@ -111,22 +111,23 @@ void test_diff_tree__options(void)
* - git diff [options] 6bab5c79cd5140d0 605812ab7fe421fdd
* - mv .git .gitted
*/
+#define EXPECT_STATUS_ADM(ADDS,DELS,MODS) { 0, ADDS, DELS, MODS, 0, 0, 0, 0, 0 }
diff_expects test_expects[] = {
/* a vs b tests */
- { 5, 0, 3, 0, 2, 0, 0, 0, 4, 0, 0, 51, 2, 46, 3 },
- { 5, 0, 3, 0, 2, 0, 0, 0, 4, 0, 0, 53, 4, 46, 3 },
- { 5, 0, 0, 3, 2, 0, 0, 0, 4, 0, 0, 52, 3, 3, 46 },
- { 5, 0, 3, 0, 2, 0, 0, 0, 5, 0, 0, 54, 3, 47, 4 },
+ { 5, 0, EXPECT_STATUS_ADM(3, 0, 2), 4, 0, 0, 51, 2, 46, 3 },
+ { 5, 0, EXPECT_STATUS_ADM(3, 0, 2), 4, 0, 0, 53, 4, 46, 3 },
+ { 5, 0, EXPECT_STATUS_ADM(0, 3, 2), 4, 0, 0, 52, 3, 3, 46 },
+ { 5, 0, EXPECT_STATUS_ADM(3, 0, 2), 5, 0, 0, 54, 3, 47, 4 },
/* c vs d tests */
- { 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 22, 9, 10, 3 },
- { 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 19, 12, 7, 0 },
- { 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 20, 11, 8, 1 },
- { 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 20, 11, 8, 1 },
- { 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 18, 11, 0, 7 },
+ { 1, 0, EXPECT_STATUS_ADM(0, 0, 1), 1, 0, 0, 22, 9, 10, 3 },
+ { 1, 0, EXPECT_STATUS_ADM(0, 0, 1), 1, 0, 0, 19, 12, 7, 0 },
+ { 1, 0, EXPECT_STATUS_ADM(0, 0, 1), 1, 0, 0, 20, 11, 8, 1 },
+ { 1, 0, EXPECT_STATUS_ADM(0, 0, 1), 1, 0, 0, 20, 11, 8, 1 },
+ { 1, 0, EXPECT_STATUS_ADM(0, 0, 1), 1, 0, 0, 18, 11, 0, 7 },
{ 0 },
};
diff_expects *expected;
- int i;
+ int i, j;
g_repo = cl_git_sandbox_init("attr");
@@ -149,9 +150,8 @@ void test_diff_tree__options(void)
expected = &test_expects[i];
cl_assert_equal_i(actual.files, expected->files);
- cl_assert_equal_i(actual.file_adds, expected->file_adds);
- cl_assert_equal_i(actual.file_dels, expected->file_dels);
- cl_assert_equal_i(actual.file_mods, expected->file_mods);
+ for (j = GIT_DELTA_UNMODIFIED; j <= GIT_DELTA_TYPECHANGE; ++j)
+ cl_assert_equal_i(expected->file_status[j], actual.file_status[j]);
cl_assert_equal_i(actual.hunks, expected->hunks);
cl_assert_equal_i(actual.lines, expected->lines);
cl_assert_equal_i(actual.line_ctxt, expected->line_ctxt);
@@ -193,9 +193,9 @@ void test_diff_tree__bare(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(3, exp.files);
- cl_assert_equal_i(2, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(1, exp.file_mods);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(3, exp.hunks);
@@ -243,9 +243,9 @@ void test_diff_tree__merge(void)
diff1, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(6, exp.files);
- cl_assert_equal_i(2, exp.file_adds);
- cl_assert_equal_i(1, exp.file_dels);
- cl_assert_equal_i(3, exp.file_mods);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(3, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(6, exp.hunks);
diff --git a/tests-clar/diff/workdir.c b/tests-clar/diff/workdir.c
index 3e388ea70..e617560f7 100644
--- a/tests-clar/diff/workdir.c
+++ b/tests-clar/diff/workdir.c
@@ -46,11 +46,11 @@ void test_diff_workdir__to_index(void)
* - mv .git .gitted
*/
cl_assert_equal_i(13, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(4, exp.file_dels);
- cl_assert_equal_i(4, exp.file_mods);
- cl_assert_equal_i(1, exp.file_ignored);
- cl_assert_equal_i(4, exp.file_untracked);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_UNTRACKED]);
cl_assert_equal_i(8, exp.hunks);
@@ -107,11 +107,11 @@ void test_diff_workdir__to_tree(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(14, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(4, exp.file_dels);
- cl_assert_equal_i(4, exp.file_mods);
- cl_assert_equal_i(1, exp.file_ignored);
- cl_assert_equal_i(5, exp.file_untracked);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
+ cl_assert_equal_i(5, exp.file_status[GIT_DELTA_UNTRACKED]);
}
/* Since there is no git diff equivalent, let's just assume that the
@@ -143,11 +143,11 @@ void test_diff_workdir__to_tree(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(15, exp.files);
- cl_assert_equal_i(2, exp.file_adds);
- cl_assert_equal_i(5, exp.file_dels);
- cl_assert_equal_i(4, exp.file_mods);
- cl_assert_equal_i(1, exp.file_ignored);
- cl_assert_equal_i(3, exp.file_untracked);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(5, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
+ cl_assert_equal_i(3, exp.file_status[GIT_DELTA_UNTRACKED]);
cl_assert_equal_i(11, exp.hunks);
@@ -180,11 +180,11 @@ void test_diff_workdir__to_tree(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(16, exp.files);
- cl_assert_equal_i(5, exp.file_adds);
- cl_assert_equal_i(4, exp.file_dels);
- cl_assert_equal_i(3, exp.file_mods);
- cl_assert_equal_i(1, exp.file_ignored);
- cl_assert_equal_i(3, exp.file_untracked);
+ cl_assert_equal_i(5, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(3, exp.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
+ cl_assert_equal_i(3, exp.file_status[GIT_DELTA_UNTRACKED]);
cl_assert_equal_i(12, exp.hunks);
@@ -228,11 +228,11 @@ void test_diff_workdir__to_index_with_pathspec(void)
cl_git_pass(git_diff_foreach(diff, &exp, diff_file_fn, NULL, NULL));
cl_assert_equal_i(13, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(4, exp.file_dels);
- cl_assert_equal_i(4, exp.file_mods);
- cl_assert_equal_i(1, exp.file_ignored);
- cl_assert_equal_i(4, exp.file_untracked);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
+ cl_assert_equal_i(4, exp.file_status[GIT_DELTA_UNTRACKED]);
}
git_diff_list_free(diff);
@@ -251,11 +251,11 @@ void test_diff_workdir__to_index_with_pathspec(void)
cl_git_pass(git_diff_foreach(diff, &exp, diff_file_fn, NULL, NULL));
cl_assert_equal_i(1, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(1, exp.file_mods);
- cl_assert_equal_i(0, exp.file_ignored);
- cl_assert_equal_i(0, exp.file_untracked);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_UNTRACKED]);
}
git_diff_list_free(diff);
@@ -274,11 +274,11 @@ void test_diff_workdir__to_index_with_pathspec(void)
cl_git_pass(git_diff_foreach(diff, &exp, diff_file_fn, NULL, NULL));
cl_assert_equal_i(3, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(1, exp.file_dels);
- cl_assert_equal_i(1, exp.file_mods);
- cl_assert_equal_i(0, exp.file_ignored);
- cl_assert_equal_i(1, exp.file_untracked);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
}
git_diff_list_free(diff);
@@ -297,11 +297,11 @@ void test_diff_workdir__to_index_with_pathspec(void)
cl_git_pass(git_diff_foreach(diff, &exp, diff_file_fn, NULL, NULL));
cl_assert_equal_i(2, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(2, exp.file_dels);
- cl_assert_equal_i(0, exp.file_mods);
- cl_assert_equal_i(0, exp.file_ignored);
- cl_assert_equal_i(0, exp.file_untracked);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_UNTRACKED]);
}
git_diff_list_free(diff);
@@ -337,7 +337,7 @@ void test_diff_workdir__filemode_changes(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(0, exp.files);
- cl_assert_equal_i(0, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(0, exp.hunks);
}
@@ -360,7 +360,7 @@ void test_diff_workdir__filemode_changes(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, exp.files);
- cl_assert_equal_i(1, exp.file_mods);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(0, exp.hunks);
}
@@ -393,7 +393,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(0, exp.files);
- cl_assert_equal_i(0, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(0, exp.hunks);
git_diff_list_free(diff);
@@ -409,7 +409,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(0, exp.files);
- cl_assert_equal_i(0, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(0, exp.hunks);
git_diff_list_free(diff);
@@ -456,9 +456,9 @@ void test_diff_workdir__head_index_and_workdir_all_differ(void)
diff_i2t, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(1, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(1, exp.hunks);
cl_assert_equal_i(2, exp.lines);
cl_assert_equal_i(1, exp.line_ctxt);
@@ -477,9 +477,9 @@ void test_diff_workdir__head_index_and_workdir_all_differ(void)
diff_w2i, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(1, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(1, exp.hunks);
cl_assert_equal_i(3, exp.lines);
cl_assert_equal_i(2, exp.line_ctxt);
@@ -500,9 +500,9 @@ void test_diff_workdir__head_index_and_workdir_all_differ(void)
diff_i2t, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(1, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(1, exp.hunks);
cl_assert_equal_i(3, exp.lines);
cl_assert_equal_i(1, exp.line_ctxt);
@@ -542,9 +542,9 @@ void test_diff_workdir__eof_newline_changes(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(0, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(0, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(0, exp.hunks);
cl_assert_equal_i(0, exp.lines);
cl_assert_equal_i(0, exp.line_ctxt);
@@ -569,9 +569,9 @@ void test_diff_workdir__eof_newline_changes(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(1, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(1, exp.hunks);
cl_assert_equal_i(2, exp.lines);
cl_assert_equal_i(1, exp.line_ctxt);
@@ -596,9 +596,9 @@ void test_diff_workdir__eof_newline_changes(void)
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
cl_assert_equal_i(1, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(1, exp.file_mods);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(1, exp.hunks);
cl_assert_equal_i(3, exp.lines);
cl_assert_equal_i(0, exp.line_ctxt);
@@ -801,11 +801,11 @@ void test_diff_workdir__submodules(void)
cl_assert_equal_i(10, exp.files);
- cl_assert_equal_i(0, exp.file_adds);
- cl_assert_equal_i(0, exp.file_dels);
- cl_assert_equal_i(1, exp.file_mods);
- cl_assert_equal_i(0, exp.file_ignored);
- cl_assert_equal_i(9, exp.file_untracked);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
+ cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
+ cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
+ cl_assert_equal_i(9, exp.file_status[GIT_DELTA_UNTRACKED]);
/* the following numbers match "git diff 873585" exactly */
diff --git a/tests-clar/resources/renames/.gitted/HEAD b/tests-clar/resources/renames/.gitted/HEAD
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests-clar/resources/renames/.gitted/config b/tests-clar/resources/renames/.gitted/config
new file mode 100644
index 000000000..bb4d11c1f
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/config
@@ -0,0 +1,7 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
+ ignorecase = true
+ precomposeunicode = false
diff --git a/tests-clar/resources/renames/.gitted/description b/tests-clar/resources/renames/.gitted/description
new file mode 100644
index 000000000..498b267a8
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests-clar/resources/renames/.gitted/index b/tests-clar/resources/renames/.gitted/index
new file mode 100644
index 000000000..1fc69fcbe
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/index
Binary files differ
diff --git a/tests-clar/resources/renames/.gitted/info/exclude b/tests-clar/resources/renames/.gitted/info/exclude
new file mode 100644
index 000000000..a5196d1be
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/tests-clar/resources/renames/.gitted/logs/HEAD b/tests-clar/resources/renames/.gitted/logs/HEAD
new file mode 100644
index 000000000..34222ed7d
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/logs/HEAD
@@ -0,0 +1,2 @@
+0000000000000000000000000000000000000000 31e47d8c1fa36d7f8d537b96158e3f024de0a9f2 Russell Belfer <rb@github.com> 1351024687 -0700 commit (initial): Initial commit
+31e47d8c1fa36d7f8d537b96158e3f024de0a9f2 2bc7f351d20b53f1c72c16c4b036e491c478c49a Russell Belfer <rb@github.com> 1351024817 -0700 commit: copy and rename with no change
diff --git a/tests-clar/resources/renames/.gitted/logs/refs/heads/master b/tests-clar/resources/renames/.gitted/logs/refs/heads/master
new file mode 100644
index 000000000..34222ed7d
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/logs/refs/heads/master
@@ -0,0 +1,2 @@
+0000000000000000000000000000000000000000 31e47d8c1fa36d7f8d537b96158e3f024de0a9f2 Russell Belfer <rb@github.com> 1351024687 -0700 commit (initial): Initial commit
+31e47d8c1fa36d7f8d537b96158e3f024de0a9f2 2bc7f351d20b53f1c72c16c4b036e491c478c49a Russell Belfer <rb@github.com> 1351024817 -0700 commit: copy and rename with no change
diff --git a/tests-clar/resources/renames/.gitted/objects/03/da7ad872536bd448da8d88eb7165338bf923a7 b/tests-clar/resources/renames/.gitted/objects/03/da7ad872536bd448da8d88eb7165338bf923a7
new file mode 100644
index 000000000..2ee86444d
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/objects/03/da7ad872536bd448da8d88eb7165338bf923a7
Binary files differ
diff --git a/tests-clar/resources/renames/.gitted/objects/2b/c7f351d20b53f1c72c16c4b036e491c478c49a b/tests-clar/resources/renames/.gitted/objects/2b/c7f351d20b53f1c72c16c4b036e491c478c49a
new file mode 100644
index 000000000..93f1ccb3f
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/objects/2b/c7f351d20b53f1c72c16c4b036e491c478c49a
Binary files differ
diff --git a/tests-clar/resources/renames/.gitted/objects/31/e47d8c1fa36d7f8d537b96158e3f024de0a9f2 b/tests-clar/resources/renames/.gitted/objects/31/e47d8c1fa36d7f8d537b96158e3f024de0a9f2
new file mode 100644
index 000000000..00ce53212
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/objects/31/e47d8c1fa36d7f8d537b96158e3f024de0a9f2
Binary files differ
diff --git a/tests-clar/resources/renames/.gitted/objects/61/8c6f2f8740bd6049b2fb9eb93fc15726462745 b/tests-clar/resources/renames/.gitted/objects/61/8c6f2f8740bd6049b2fb9eb93fc15726462745
new file mode 100644
index 000000000..24eac54c5
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/objects/61/8c6f2f8740bd6049b2fb9eb93fc15726462745
Binary files differ
diff --git a/tests-clar/resources/renames/.gitted/objects/66/311f5cfbe7836c27510a3ba2f43e282e2c8bba b/tests-clar/resources/renames/.gitted/objects/66/311f5cfbe7836c27510a3ba2f43e282e2c8bba
new file mode 100644
index 000000000..5ee28a76a
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/objects/66/311f5cfbe7836c27510a3ba2f43e282e2c8bba
Binary files differ
diff --git a/tests-clar/resources/renames/.gitted/objects/ad/0a8e55a104ac54a8a29ed4b84b49e76837a113 b/tests-clar/resources/renames/.gitted/objects/ad/0a8e55a104ac54a8a29ed4b84b49e76837a113
new file mode 100644
index 000000000..440b7bec3
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/objects/ad/0a8e55a104ac54a8a29ed4b84b49e76837a113
Binary files differ
diff --git a/tests-clar/resources/renames/.gitted/refs/heads/master b/tests-clar/resources/renames/.gitted/refs/heads/master
new file mode 100644
index 000000000..049b1f5ad
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/refs/heads/master
@@ -0,0 +1 @@
+2bc7f351d20b53f1c72c16c4b036e491c478c49a
diff --git a/tests-clar/resources/renames/sevencities.txt b/tests-clar/resources/renames/sevencities.txt
new file mode 100644
index 000000000..66311f5cf
--- /dev/null
+++ b/tests-clar/resources/renames/sevencities.txt
@@ -0,0 +1,49 @@
+The Song of Seven Cities
+========================
+
+I WAS Lord of Cities very sumptuously builded.
+Seven roaring Cities paid me tribute from afar.
+Ivory their outposts were—the guardrooms of them gilded,
+And garrisoned with Amazons invincible in war.
+
+All the world went softly when it walked before my Cities—
+Neither King nor Army vexed my peoples at their toil,
+Never horse nor chariot irked or overbore my Cities,
+Never Mob nor Ruler questioned whence they drew their spoil.
+
+Banded, mailed and arrogant from sunrise unto sunset;
+Singing while they sacked it, they possessed the land at large.
+Yet when men would rob them, they resisted, they made onset
+And pierced the smoke of battle with a thousand-sabred charge.
+
+So they warred and trafficked only yesterday, my Cities.
+To-day there is no mark or mound of where my Cities stood.
+For the River rose at midnight and it washed away my Cities.
+They are evened with Atlantis and the towns before the Flood.
+
+Rain on rain-gorged channels raised the water-levels round them,
+Freshet backed on freshet swelled and swept their world from sight,
+Till the emboldened floods linked arms and, flashing forward, drowned them—
+Drowned my Seven Cities and their peoples in one night!
+
+Low among the alders lie their derelict foundations,
+The beams wherein they trusted and the plinths whereon they built—
+My rulers and their treasure and their unborn populations,
+Dead, destroyed, aborted, and defiled with mud and silt!
+
+The Daughters of the Palace whom they cherished in my Cities,
+My silver-tongued Princesses, and the promise of their May—
+Their bridegrooms of the June-tide—all have perished in my Cities,
+With the harsh envenomed virgins that can neither love nor play.
+
+I was Lord of Cities—I will build anew my Cities,
+Seven, set on rocks, above the wrath of any flood.
+Nor will I rest from search till I have filled anew my Cities
+With peoples undefeated of the dark, enduring blood.
+
+To the sound of trumpets shall their seed restore my Cities
+Wealthy and well-weaponed, that once more may I behold
+All the world go softly when it walks before my Cities,
+And the horses and the chariots fleeing from them as of old!
+
+ -- Rudyard Kipling
diff --git a/tests-clar/resources/renames/sixserving.txt b/tests-clar/resources/renames/sixserving.txt
new file mode 100644
index 000000000..ad0a8e55a
--- /dev/null
+++ b/tests-clar/resources/renames/sixserving.txt
@@ -0,0 +1,24 @@
+I KEEP six honest serving-men
+ (They taught me all I knew);
+Their names are What and Why and When
+ And How and Where and Who.
+I send them over land and sea,
+ I send them east and west;
+But after they have worked for me,
+ I give them all a rest.
+
+I let them rest from nine till five,
+ For I am busy then,
+As well as breakfast, lunch, and tea,
+ For they are hungry men.
+But different folk have different views;
+I know a person small—
+She keeps ten million serving-men,
+Who get no rest at all!
+
+She sends'em abroad on her own affairs,
+ From the second she opens her eyes—
+One million Hows, two million Wheres,
+And seven million Whys!
+
+ -- Rudyard Kipling
diff --git a/tests-clar/resources/renames/songofseven.txt b/tests-clar/resources/renames/songofseven.txt
new file mode 100644
index 000000000..66311f5cf
--- /dev/null
+++ b/tests-clar/resources/renames/songofseven.txt
@@ -0,0 +1,49 @@
+The Song of Seven Cities
+========================
+
+I WAS Lord of Cities very sumptuously builded.
+Seven roaring Cities paid me tribute from afar.
+Ivory their outposts were—the guardrooms of them gilded,
+And garrisoned with Amazons invincible in war.
+
+All the world went softly when it walked before my Cities—
+Neither King nor Army vexed my peoples at their toil,
+Never horse nor chariot irked or overbore my Cities,
+Never Mob nor Ruler questioned whence they drew their spoil.
+
+Banded, mailed and arrogant from sunrise unto sunset;
+Singing while they sacked it, they possessed the land at large.
+Yet when men would rob them, they resisted, they made onset
+And pierced the smoke of battle with a thousand-sabred charge.
+
+So they warred and trafficked only yesterday, my Cities.
+To-day there is no mark or mound of where my Cities stood.
+For the River rose at midnight and it washed away my Cities.
+They are evened with Atlantis and the towns before the Flood.
+
+Rain on rain-gorged channels raised the water-levels round them,
+Freshet backed on freshet swelled and swept their world from sight,
+Till the emboldened floods linked arms and, flashing forward, drowned them—
+Drowned my Seven Cities and their peoples in one night!
+
+Low among the alders lie their derelict foundations,
+The beams wherein they trusted and the plinths whereon they built—
+My rulers and their treasure and their unborn populations,
+Dead, destroyed, aborted, and defiled with mud and silt!
+
+The Daughters of the Palace whom they cherished in my Cities,
+My silver-tongued Princesses, and the promise of their May—
+Their bridegrooms of the June-tide—all have perished in my Cities,
+With the harsh envenomed virgins that can neither love nor play.
+
+I was Lord of Cities—I will build anew my Cities,
+Seven, set on rocks, above the wrath of any flood.
+Nor will I rest from search till I have filled anew my Cities
+With peoples undefeated of the dark, enduring blood.
+
+To the sound of trumpets shall their seed restore my Cities
+Wealthy and well-weaponed, that once more may I behold
+All the world go softly when it walks before my Cities,
+And the horses and the chariots fleeing from them as of old!
+
+ -- Rudyard Kipling