Commit d4b747c1cb72119d783154f88640920d3a3fdb3d

Russell Belfer 2013-02-21T16:44:44

Add diff rename tests with partial similarity This adds some new tests that actually exercise the similarity metric between files to detect renames, copies, and split modified files that are too heavily modified. There is still more testing to do - these tests are just partially covering the cases. There is also one bug fix in this where a change set with only MODIFY being broken into ADD/DELETE (due to low self-similarity) without any additional RENAMED entries would end up not processing the split requests (because the num_rewrites counter got reset).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 379f469..ca34843 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -390,6 +390,9 @@ typedef enum {
 	/** split large rewrites into delete/add pairs (`--break-rewrites=/M`) */
 	GIT_DIFF_FIND_AND_BREAK_REWRITES = (1 << 4),
 
+	/** turn on all finding features */
+	GIT_DIFF_FIND_ALL = (0x1f),
+
 	/** measure similarity ignoring leading whitespace (default) */
 	GIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE = 0,
 	/** measure similarity ignoring all whitespace */
diff --git a/src/diff_tform.c b/src/diff_tform.c
index 48332d3..ae0fd36 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -561,8 +561,6 @@ int git_diff_find_similar(
 
 	/* next rewrite the diffs with renames / copies */
 
-	num_rewrites = 0;
-
 	git_vector_foreach(&diff->deltas, j, to) {
 		if (!matches[j]) {
 			assert(to->similarity == 0);
diff --git a/tests-clar/diff/rename.c b/tests-clar/diff/rename.c
index 2995b4e..ec99e4d 100644
--- a/tests-clar/diff/rename.c
+++ b/tests-clar/diff/rename.c
@@ -23,8 +23,16 @@ void test_diff_rename__cleanup(void)
  *   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
+ * commit 1c068dee5790ef1580cfc4cd670915b48d790084
+ *   songofseven.txt -> songofseven.txt (major rewrite, <20% match - split)
+ *   sixserving.txt  -> sixserving.txt  (indentation change)
+ *   sixserving.txt  -> ikeepsix.txt    (copy, add title, >80% match)
+ *   sevencities.txt                    (no change)
+ * commit 19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13
+ *   songofseven.txt -> untimely.txt    (rename, convert to crlf)
+ *   ikeepsix.txt    -> ikeepsix.txt    (reorder sections in file)
+ *   sixserving.txt  -> sixserving.txt  (whitespace change - not just indent)
+ *   sevencities.txt -> songof7cities.txt (rename, small text changes)
  */
 
 void test_diff_rename__match_oid(void)
@@ -133,3 +141,108 @@ void test_diff_rename__checks_options_version(void)
 	git_tree_free(old_tree);
 	git_tree_free(new_tree);
 }
+
+void test_diff_rename__not_exact_match(void)
+{
+	const char *sha0 = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
+	const char *sha1 = "1c068dee5790ef1580cfc4cd670915b48d790084";
+	const char *sha2 = "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13";
+	git_tree *old_tree, *new_tree;
+	git_diff_list *diff;
+	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
+	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
+	diff_expects exp;
+
+	/* Changes:
+	 *   songofseven.txt -> songofseven.txt (major rewrite, <20% match - split)
+	 *   sixserving.txt  -> sixserving.txt  (indentation change)
+	 *   sixserving.txt  -> ikeepsix.txt    (copy, add title, >80% match)
+	 *   sevencities.txt                    (no change)
+	 */
+
+	old_tree = resolve_commit_oid_to_tree(g_repo, sha0);
+	new_tree = resolve_commit_oid_to_tree(g_repo, sha1);
+
+	/* Must pass GIT_DIFF_INCLUDE_UNMODIFIED if you expect to emulate
+	 * --find-copies-harder during rename transformion...
+	 */
+	diffopts.flags |= GIT_DIFF_INCLUDE_UNMODIFIED;
+
+	cl_git_pass(git_diff_tree_to_tree(
+		&diff, g_repo, old_tree, new_tree, &diffopts));
+
+	/* git diff --no-renames \
+	 *          2bc7f351d20b53f1c72c16c4b036e491c478c49a \
+	 *          1c068dee5790ef1580cfc4cd670915b48d790084
+	 */
+	memset(&exp, 0, sizeof(exp));
+	cl_git_pass(git_diff_foreach(
+		diff, diff_file_cb, diff_hunk_cb, diff_line_cb, &exp));
+
+	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_MODIFIED]);
+	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]);
+
+	/* 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, diff_file_cb, diff_hunk_cb, diff_line_cb, &exp));
+
+	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_MODIFIED]);
+	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_COPIED]);
+
+	git_diff_list_free(diff);
+
+	cl_git_pass(git_diff_tree_to_tree(
+		&diff, g_repo, old_tree, new_tree, &diffopts));
+
+	/* git diff --find-copies-harder --break-rewrites \
+	 *          2bc7f351d20b53f1c72c16c4b036e491c478c49a \
+	 *          1c068dee5790ef1580cfc4cd670915b48d790084
+	 */
+	opts.flags = GIT_DIFF_FIND_ALL;
+	cl_git_pass(git_diff_find_similar(diff, &opts));
+
+	memset(&exp, 0, sizeof(exp));
+	cl_git_pass(git_diff_foreach(
+		diff, diff_file_cb, diff_hunk_cb, diff_line_cb, &exp));
+
+	cl_assert_equal_i(5, exp.files);
+	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNMODIFIED]);
+	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
+	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
+	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]);
+	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_COPIED]);
+
+	git_diff_list_free(diff);
+
+	/* Changes:
+	 *   songofseven.txt -> untimely.txt    (rename, convert to crlf)
+	 *   ikeepsix.txt    -> ikeepsix.txt    (reorder sections in file)
+	 *   sixserving.txt  -> sixserving.txt  (whitespace - not just indent)
+	 *   sevencities.txt -> songof7cities.txt (rename, small text changes)
+	 */
+
+	git_tree_free(old_tree);
+	old_tree = new_tree;
+	new_tree = resolve_commit_oid_to_tree(g_repo, sha2);
+
+	/* moar tests needed */
+
+	git_tree_free(old_tree);
+	git_tree_free(new_tree);
+}
+
+void test_diff_rename__working_directory_changes(void)
+{
+	/* let's rewrite some files in the working directory on demand */
+
+	/* and with / without CRLF changes */
+}
diff --git a/tests-clar/resources/renames/.gitted/index b/tests-clar/resources/renames/.gitted/index
index 1fc69fc..72363c0 100644
Binary files a/tests-clar/resources/renames/.gitted/index and b/tests-clar/resources/renames/.gitted/index differ
diff --git a/tests-clar/resources/renames/.gitted/logs/HEAD b/tests-clar/resources/renames/.gitted/logs/HEAD
index 34222ed..e697922 100644
--- a/tests-clar/resources/renames/.gitted/logs/HEAD
+++ b/tests-clar/resources/renames/.gitted/logs/HEAD
@@ -1,2 +1,4 @@
 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
+2bc7f351d20b53f1c72c16c4b036e491c478c49a 1c068dee5790ef1580cfc4cd670915b48d790084 Russell Belfer <rb@github.com> 1361485758 -0800	commit: rewrites, copies with changes, etc.
+1c068dee5790ef1580cfc4cd670915b48d790084 19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13 Russell Belfer <rb@github.com> 1361486360 -0800	commit: more renames and smallish modifications
diff --git a/tests-clar/resources/renames/.gitted/logs/refs/heads/master b/tests-clar/resources/renames/.gitted/logs/refs/heads/master
index 34222ed..e697922 100644
--- a/tests-clar/resources/renames/.gitted/logs/refs/heads/master
+++ b/tests-clar/resources/renames/.gitted/logs/refs/heads/master
@@ -1,2 +1,4 @@
 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
+2bc7f351d20b53f1c72c16c4b036e491c478c49a 1c068dee5790ef1580cfc4cd670915b48d790084 Russell Belfer <rb@github.com> 1361485758 -0800	commit: rewrites, copies with changes, etc.
+1c068dee5790ef1580cfc4cd670915b48d790084 19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13 Russell Belfer <rb@github.com> 1361486360 -0800	commit: more renames and smallish modifications
diff --git a/tests-clar/resources/renames/.gitted/objects/19/dd32dfb1520a64e5bbaae8dce6ef423dfa2f13 b/tests-clar/resources/renames/.gitted/objects/19/dd32dfb1520a64e5bbaae8dce6ef423dfa2f13
new file mode 100644
index 0000000..4be4c69
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/objects/19/dd32dfb1520a64e5bbaae8dce6ef423dfa2f13
@@ -0,0 +1 @@
+xM!Ei@3ސc,\XK{Nrbo,xzYC<h[&?=fcvyCW<Z#:J"vs%9PQ|ZKj#|u-pڐ;+[Z;L+l\k'J.WT;O
diff --git a/tests-clar/resources/renames/.gitted/objects/1c/068dee5790ef1580cfc4cd670915b48d790084 b/tests-clar/resources/renames/.gitted/objects/1c/068dee5790ef1580cfc4cd670915b48d790084
new file mode 100644
index 0000000..d65ab0a
Binary files /dev/null and b/tests-clar/resources/renames/.gitted/objects/1c/068dee5790ef1580cfc4cd670915b48d790084 differ
diff --git a/tests-clar/resources/renames/.gitted/objects/36/020db6cdacaa93497f31edcd8f242ff9bc366d b/tests-clar/resources/renames/.gitted/objects/36/020db6cdacaa93497f31edcd8f242ff9bc366d
new file mode 100644
index 0000000..f4f9303
Binary files /dev/null and b/tests-clar/resources/renames/.gitted/objects/36/020db6cdacaa93497f31edcd8f242ff9bc366d differ
diff --git a/tests-clar/resources/renames/.gitted/objects/3c/04741dd4b96c4ae4b00ec0f6e10c816a30aad2 b/tests-clar/resources/renames/.gitted/objects/3c/04741dd4b96c4ae4b00ec0f6e10c816a30aad2
new file mode 100644
index 0000000..c236022
Binary files /dev/null and b/tests-clar/resources/renames/.gitted/objects/3c/04741dd4b96c4ae4b00ec0f6e10c816a30aad2 differ
diff --git a/tests-clar/resources/renames/.gitted/objects/42/10ffd5c390b21dd5483375e75288dea9ede512 b/tests-clar/resources/renames/.gitted/objects/42/10ffd5c390b21dd5483375e75288dea9ede512
new file mode 100644
index 0000000..d351a6d
Binary files /dev/null and b/tests-clar/resources/renames/.gitted/objects/42/10ffd5c390b21dd5483375e75288dea9ede512 differ
diff --git a/tests-clar/resources/renames/.gitted/objects/4e/4cae3e7dd56ed74bff39526d0469e554432953 b/tests-clar/resources/renames/.gitted/objects/4e/4cae3e7dd56ed74bff39526d0469e554432953
new file mode 100644
index 0000000..5e6ebd5
Binary files /dev/null and b/tests-clar/resources/renames/.gitted/objects/4e/4cae3e7dd56ed74bff39526d0469e554432953 differ
diff --git a/tests-clar/resources/renames/.gitted/objects/5e/26abc56a5a84d89790f45416648899cbe13109 b/tests-clar/resources/renames/.gitted/objects/5e/26abc56a5a84d89790f45416648899cbe13109
new file mode 100644
index 0000000..2acd3d5
Binary files /dev/null and b/tests-clar/resources/renames/.gitted/objects/5e/26abc56a5a84d89790f45416648899cbe13109 differ
diff --git a/tests-clar/resources/renames/.gitted/objects/9a/69d960ae94b060f56c2a8702545e2bb1abb935 b/tests-clar/resources/renames/.gitted/objects/9a/69d960ae94b060f56c2a8702545e2bb1abb935
new file mode 100644
index 0000000..f75178c
Binary files /dev/null and b/tests-clar/resources/renames/.gitted/objects/9a/69d960ae94b060f56c2a8702545e2bb1abb935 differ
diff --git a/tests-clar/resources/renames/.gitted/objects/d7/9b202de198fa61b02424b9e25e840dc75e1323 b/tests-clar/resources/renames/.gitted/objects/d7/9b202de198fa61b02424b9e25e840dc75e1323
new file mode 100644
index 0000000..daa2b39
Binary files /dev/null and b/tests-clar/resources/renames/.gitted/objects/d7/9b202de198fa61b02424b9e25e840dc75e1323 differ
diff --git a/tests-clar/resources/renames/.gitted/objects/ea/f4a3e3bfe68585e90cada20736ace491cd100b b/tests-clar/resources/renames/.gitted/objects/ea/f4a3e3bfe68585e90cada20736ace491cd100b
new file mode 100644
index 0000000..f72df8d
--- /dev/null
+++ b/tests-clar/resources/renames/.gitted/objects/ea/f4a3e3bfe68585e90cada20736ace491cd100b
@@ -0,0 +1,5 @@
+x}R@<_QT.A[
+{t2Cez%L'!aj!x{'+;$)Ξ#yǘ#q#hc
QDXmR|aD*O+^ZI~i>3a!,R!-EaI>yo*4戁Rf	m&eIA*!;dݬ
+Ho
+OUDyTVHpwqH7Ʒ.ts6{Z+X\)C5Q9
+%t*&&v;|'4Du[7he!NK*"C-=`#؎$Ee2T|@NBsslW|/0¬aȥJNv)-ڡiۤ3bbO:uWMNX7T
\ No newline at end of file
diff --git a/tests-clar/resources/renames/.gitted/objects/f9/0d4fc20ecddf21eebe6a37e9225d244339d2b5 b/tests-clar/resources/renames/.gitted/objects/f9/0d4fc20ecddf21eebe6a37e9225d244339d2b5
new file mode 100644
index 0000000..f6d933b
Binary files /dev/null and b/tests-clar/resources/renames/.gitted/objects/f9/0d4fc20ecddf21eebe6a37e9225d244339d2b5 differ
diff --git a/tests-clar/resources/renames/.gitted/refs/heads/master b/tests-clar/resources/renames/.gitted/refs/heads/master
index 049b1f5..642c319 100644
--- a/tests-clar/resources/renames/.gitted/refs/heads/master
+++ b/tests-clar/resources/renames/.gitted/refs/heads/master
@@ -1 +1 @@
-2bc7f351d20b53f1c72c16c4b036e491c478c49a
+19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13
diff --git a/tests-clar/resources/renames/ikeepsix.txt b/tests-clar/resources/renames/ikeepsix.txt
new file mode 100644
index 0000000..eaf4a3e
--- /dev/null
+++ b/tests-clar/resources/renames/ikeepsix.txt
@@ -0,0 +1,27 @@
+I Keep Six Honest Serving-Men
+=============================
+
+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!
+
+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!
+
+  -- Rudyard Kipling
+
+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.
diff --git a/tests-clar/resources/renames/sevencities.txt b/tests-clar/resources/renames/sevencities.txt
deleted file mode 100644
index 66311f5..0000000
--- a/tests-clar/resources/renames/sevencities.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-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
index ad0a8e5..f90d4fc 100644
--- a/tests-clar/resources/renames/sixserving.txt
+++ b/tests-clar/resources/renames/sixserving.txt
@@ -1,24 +1,25 @@
-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  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!
+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!
+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
 
-                -- Rudyard Kipling
diff --git a/tests-clar/resources/renames/songof7cities.txt b/tests-clar/resources/renames/songof7cities.txt
new file mode 100644
index 0000000..4210ffd
--- /dev/null
+++ b/tests-clar/resources/renames/songof7cities.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/songofseven.txt b/tests-clar/resources/renames/songofseven.txt
deleted file mode 100644
index 66311f5..0000000
--- a/tests-clar/resources/renames/songofseven.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-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/untimely.txt b/tests-clar/resources/renames/untimely.txt
new file mode 100644
index 0000000..9a69d96
--- /dev/null
+++ b/tests-clar/resources/renames/untimely.txt
@@ -0,0 +1,24 @@
+Untimely
+========
+
+Nothing in life has been made by man for man's using
+But it was shown long since to man in ages
+Lost as the name of the maker of it,
+Who received oppression and shame for his wages--
+Hate, avoidance, and scorn in his daily dealings--
+Until he perished, wholly confounded
+
+More to be pitied than he are the wise
+Souls which foresaw the evil of loosing
+Knowledge or Art before time, and aborted
+Noble devices and deep-wrought healings,
+Lest offense should arise.
+
+Heaven delivers on earth the Hour that cannot be
+  thwarted,
+Neither advanced, at the price of a world nor a soul,
+  and its Prophet
+Comes through the blood of the vanguards who
+  dreamed--too soon--it had sounded.
+
+                -- Rudyard Kipling