Commit 027b8edac7e91480623815193ed994db808064f6

Russell Belfer 2014-01-24T15:45:49

Move userdiff tests to be data driven This moves the expected and actual test data along with the source data for the userdiff tests into the tests/resources/userdiff test repo and updates the test to use that.

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
diff --git a/tests/diff/drivers.c b/tests/diff/drivers.c
index 1191321..1cbf9e2 100644
--- a/tests/diff/drivers.c
+++ b/tests/diff/drivers.c
@@ -176,70 +176,73 @@ void test_diff_drivers__long_lines(void)
 
 void test_diff_drivers__builtins(void)
 {
-	git_index *idx;
 	git_diff *diff;
 	git_patch *patch;
-	git_buf actual = GIT_BUF_INIT;
+	git_buf file = GIT_BUF_INIT, actual = GIT_BUF_INIT, expected = GIT_BUF_INIT;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	const char *base =
-		"<html>\n<body>\n"
-		"  <h1 id=\"first section\">\n  <ol>\n    <li>item 1.1</li>\n    <li>item 1.2</li>\n    <li>item 1.3</li>\n    <li>item 1.4</li>\n    <li>item 1.5</li>\n    <li>item 1.6</li>\n    <li>item 1.7</li>\n    <li>item 1.8</li>\n    <li>item 1.9</li>\n  </ol>\n  </h1>\n"
-		"  <h1 id=\"second section\">\n  <ol>\n    <li>item 2.1</li>\n    <li>item 2.2</li>\n    <li>item 2.3</li>\n    <li>item 2.4</li>\n    <li>item 2.5</li>\n    <li>item 2.6</li>\n    <li>item 2.7</li>\n    <li>item 2.8</li>\n  </ol>\n  </h1>\n"
-		"  <h1 id=\"third section\">\n  <ol>\n    <li>item 3.1</li>\n    <li>item 3.2</li>\n    <li>item 3.3</li>\n    <li>item 3.4</li>\n    <li>item 3.5</li>\n    <li>item 3.6</li>\n    <li>item 3.7</li>\n    <li>item 3.8</li>\n  </ol>\n  </h1>\n"
-		"</body></html>\n";
-	const char *modified =
-		"<html>\n<body>\n"
-		"  <h1 id=\"first section\">\n  <ol>\n    <li>item 1.1</li>\n    <li>item 1.2 changed</li>\n    <li>item 1.3 changed</li>\n    <li>item 1.4</li>\n    <li>item 1.5</li>\n    <li>item 1.6</li>\n    <li>item 1.7</li>\n    <li>item 1.8</li>\n    <li>item 1.9</li>\n  <li>item 1.10 added</li>\n  </ol>\n  </h1>\n"
-		"  <h1 id=\"second section\">\n  <ol>\n    <li>item 2.1</li>\n    <li>item 2.2</li>\n    <li>item 2.3</li>\n    <li>item 2.4</li>\n    <li>item 2.5</li>\n    <li>item 2.6</li>\n    <li>item 2.7 changed</li>\n    <li>item 2.7.1 added</li>\n    <li>item 2.8</li>\n  </ol>\n  </h1>\n"
-		"  <h1 id=\"third section\">\n  <ol>\n    <li>item 3.1</li>\n    <li>item 3.2</li>\n    <li>item 3.3</li>\n    <li>item 3.4</li>\n    <li>item 3.5</li>\n    <li>item 3.6</li>\n  </ol>\n  </h1>\n"
-		"</body></html>\n";
-	const char *expected_nodriver =
-		"diff --git a/file.html b/file.html\nindex 97b34db..c7dbed3 100644\n--- a/file.html\n+++ b/file.html\n@@ -5,4 +5,4 @@\n     <li>item 1.1</li>\n-    <li>item 1.2</li>\n-    <li>item 1.3</li>\n+    <li>item 1.2 changed</li>\n+    <li>item 1.3 changed</li>\n     <li>item 1.4</li>\n@@ -13,2 +13,3 @@\n     <li>item 1.9</li>\n+  <li>item 1.10 added</li>\n   </ol>\n@@ -23,3 +24,4 @@\n     <li>item 2.6</li>\n-    <li>item 2.7</li>\n+    <li>item 2.7 changed</li>\n+    <li>item 2.7.1 added</li>\n     <li>item 2.8</li>\n@@ -35,4 +37,2 @@\n     <li>item 3.6</li>\n-    <li>item 3.7</li>\n-    <li>item 3.8</li>\n   </ol>\n";
-	const char *expected_driver =
-		"diff --git a/file.html b/file.html\nindex 97b34db..c7dbed3 100644\n--- a/file.html\n+++ b/file.html\n@@ -5,4 +5,4 @@ <h1 id=\"first section\">\n     <li>item 1.1</li>\n-    <li>item 1.2</li>\n-    <li>item 1.3</li>\n+    <li>item 1.2 changed</li>\n+    <li>item 1.3 changed</li>\n     <li>item 1.4</li>\n@@ -13,2 +13,3 @@ <h1 id=\"first section\">\n     <li>item 1.9</li>\n+  <li>item 1.10 added</li>\n   </ol>\n@@ -23,3 +24,4 @@ <h1 id=\"second section\">\n     <li>item 2.6</li>\n-    <li>item 2.7</li>\n+    <li>item 2.7 changed</li>\n+    <li>item 2.7.1 added</li>\n     <li>item 2.8</li>\n@@ -35,4 +37,2 @@ <h1 id=\"third section\">\n     <li>item 3.6</li>\n-    <li>item 3.7</li>\n-    <li>item 3.8</li>\n   </ol>\n";
+	int i;
+	static const char *files[] = {
+		"html",
+		NULL
+	};
 
-	g_repo = cl_git_sandbox_init("empty_standard_repo");
+	g_repo = cl_git_sandbox_init("userdiff");
 
-	cl_git_mkfile("empty_standard_repo/file.html", base);
-	cl_git_pass(git_repository_index(&idx, g_repo));
-	cl_git_pass(git_index_add_bypath(idx, "file.html"));
-	cl_git_pass(git_index_write(idx));
-	git_index_free(idx);
+	opts.interhunk_lines = 1;
+	opts.context_lines = 1;
+	opts.pathspec.count = 1;
 
-	cl_git_rewritefile("empty_standard_repo/file.html", modified);
+	for (i = 0; files[i]; ++i) {
+		git_buf_sets(&file, "files/file.");
+		git_buf_puts(&file, files[i]);
+		opts.pathspec.strings = &file.ptr;
 
-	/* do diff with no special driver */
+		/* do diff with no special driver */
 
-	opts.interhunk_lines = 1;
-	opts.context_lines = 1;
+		cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
+		cl_assert_equal_sz(1, git_diff_num_deltas(diff));
+		cl_git_pass(git_patch_from_diff(&patch, diff, 0));
+		cl_git_pass(git_patch_to_buf(&actual, patch));
 
-	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
-	cl_assert_equal_sz(1, git_diff_num_deltas(diff));
-	cl_git_pass(git_patch_from_diff(&patch, diff, 0));
-	cl_git_pass(git_patch_to_buf(&actual, patch));
+		git_buf_sets(&expected, "userdiff/expected/nodriver/diff.");
+		git_buf_puts(&expected, files[i]);
+		cl_git_pass(git_futils_readbuffer(&expected, expected.ptr));
 
-	overwrite_filemode(expected_nodriver, &actual);
+		overwrite_filemode(expected.ptr, &actual);
 
-	cl_assert_equal_s(expected_nodriver, actual.ptr);
+		cl_assert_equal_s(expected.ptr, actual.ptr);
 
-	git_buf_free(&actual);
-	git_patch_free(patch);
-	git_diff_free(diff);
+		git_buf_clear(&actual);
+		git_patch_free(patch);
+		git_diff_free(diff);
 
-	/* do diff with HTML driver */
+		/* do diff with driver */
 
-	cl_git_mkfile("empty_standard_repo/.gitattributes", "*.html diff=html\n");
+		{
+			FILE *fp = fopen("userdiff/.gitattributes", "w");
+			fprintf(fp, "*.%s diff=%s\n", files[i], files[i]);
+			fclose(fp);
+		}
 
-	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
-	cl_assert_equal_sz(1, git_diff_num_deltas(diff));
-	cl_git_pass(git_patch_from_diff(&patch, diff, 0));
-	cl_git_pass(git_patch_to_buf(&actual, patch));
+		cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
+		cl_assert_equal_sz(1, git_diff_num_deltas(diff));
+		cl_git_pass(git_patch_from_diff(&patch, diff, 0));
+		cl_git_pass(git_patch_to_buf(&actual, patch));
+
+		git_buf_sets(&expected, "userdiff/expected/driver/diff.");
+		git_buf_puts(&expected, files[i]);
+		cl_git_pass(git_futils_readbuffer(&expected, expected.ptr));
+
+		overwrite_filemode(expected.ptr, &actual);
 
-	overwrite_filemode(expected_driver, &actual);
+		cl_assert_equal_s(expected.ptr, actual.ptr);
 
-	cl_assert_equal_s(expected_driver, actual.ptr);
+		git_buf_clear(&actual);
+		git_patch_free(patch);
+		git_diff_free(diff);
+	}
 
+	git_buf_free(&file);
 	git_buf_free(&actual);
-	git_patch_free(patch);
-	git_diff_free(diff);
+	git_buf_free(&expected);
 }
diff --git a/tests/resources/userdiff/.gitted/HEAD b/tests/resources/userdiff/.gitted/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/tests/resources/userdiff/.gitted/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests/resources/userdiff/.gitted/config b/tests/resources/userdiff/.gitted/config
new file mode 100644
index 0000000..6c9406b
--- /dev/null
+++ b/tests/resources/userdiff/.gitted/config
@@ -0,0 +1,7 @@
+[core]
+	repositoryformatversion = 0
+	filemode = true
+	bare = false
+	logallrefupdates = true
+	ignorecase = true
+	precomposeunicode = true
diff --git a/tests/resources/userdiff/.gitted/description b/tests/resources/userdiff/.gitted/description
new file mode 100644
index 0000000..498b267
--- /dev/null
+++ b/tests/resources/userdiff/.gitted/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/tests/resources/userdiff/.gitted/index b/tests/resources/userdiff/.gitted/index
new file mode 100644
index 0000000..9372411
Binary files /dev/null and b/tests/resources/userdiff/.gitted/index differ
diff --git a/tests/resources/userdiff/.gitted/objects/05/d669073b39d36847315e3a5b4512cf4cba4546 b/tests/resources/userdiff/.gitted/objects/05/d669073b39d36847315e3a5b4512cf4cba4546
new file mode 100644
index 0000000..3a9d75c
Binary files /dev/null and b/tests/resources/userdiff/.gitted/objects/05/d669073b39d36847315e3a5b4512cf4cba4546 differ
diff --git a/tests/resources/userdiff/.gitted/objects/20/ab776b6ff3169fa0e5eff65df30d45187d22ba b/tests/resources/userdiff/.gitted/objects/20/ab776b6ff3169fa0e5eff65df30d45187d22ba
new file mode 100644
index 0000000..3d57061
Binary files /dev/null and b/tests/resources/userdiff/.gitted/objects/20/ab776b6ff3169fa0e5eff65df30d45187d22ba differ
diff --git a/tests/resources/userdiff/.gitted/objects/23/20e2f1e4d9e6201a8e15949a0c10a533fa51cd b/tests/resources/userdiff/.gitted/objects/23/20e2f1e4d9e6201a8e15949a0c10a533fa51cd
new file mode 100644
index 0000000..6dbcafe
Binary files /dev/null and b/tests/resources/userdiff/.gitted/objects/23/20e2f1e4d9e6201a8e15949a0c10a533fa51cd differ
diff --git a/tests/resources/userdiff/.gitted/objects/2e/a4b8a16d737c180dfdd2b119dec9501592326c b/tests/resources/userdiff/.gitted/objects/2e/a4b8a16d737c180dfdd2b119dec9501592326c
new file mode 100644
index 0000000..e7d2fba
Binary files /dev/null and b/tests/resources/userdiff/.gitted/objects/2e/a4b8a16d737c180dfdd2b119dec9501592326c differ
diff --git a/tests/resources/userdiff/.gitted/objects/49/c0ff897b2b07a2ea0ed073e62a9dcd02704ba0 b/tests/resources/userdiff/.gitted/objects/49/c0ff897b2b07a2ea0ed073e62a9dcd02704ba0
new file mode 100644
index 0000000..49d59c1
Binary files /dev/null and b/tests/resources/userdiff/.gitted/objects/49/c0ff897b2b07a2ea0ed073e62a9dcd02704ba0 differ
diff --git a/tests/resources/userdiff/.gitted/objects/50/346bde7428a29c9845470a14d87b1634293d48 b/tests/resources/userdiff/.gitted/objects/50/346bde7428a29c9845470a14d87b1634293d48
new file mode 100644
index 0000000..9de1b35
--- /dev/null
+++ b/tests/resources/userdiff/.gitted/objects/50/346bde7428a29c9845470a14d87b1634293d48
@@ -0,0 +1 @@
+x+)JMU06g040031QHI(ahוL7rYMJ;8
\ No newline at end of file
diff --git a/tests/resources/userdiff/.gitted/objects/5a/428e7dcffb41b65984517f1e6b8547babc8dff b/tests/resources/userdiff/.gitted/objects/5a/428e7dcffb41b65984517f1e6b8547babc8dff
new file mode 100644
index 0000000..143a1ce
Binary files /dev/null and b/tests/resources/userdiff/.gitted/objects/5a/428e7dcffb41b65984517f1e6b8547babc8dff differ
diff --git a/tests/resources/userdiff/.gitted/objects/87/2d19663f32459389597b52beec6457c1dc971f b/tests/resources/userdiff/.gitted/objects/87/2d19663f32459389597b52beec6457c1dc971f
new file mode 100644
index 0000000..415f40a
Binary files /dev/null and b/tests/resources/userdiff/.gitted/objects/87/2d19663f32459389597b52beec6457c1dc971f differ
diff --git a/tests/resources/userdiff/.gitted/objects/9d/b1d09ff9ad5190bcf12d72ea3c818ffca344c5 b/tests/resources/userdiff/.gitted/objects/9d/b1d09ff9ad5190bcf12d72ea3c818ffca344c5
new file mode 100644
index 0000000..c0a03a2
--- /dev/null
+++ b/tests/resources/userdiff/.gitted/objects/9d/b1d09ff9ad5190bcf12d72ea3c818ffca344c5
@@ -0,0 +1,2 @@
+xM F]sfJ+έ7g$P:_O{0,cN:VE
+gRҚJ(l6x㠜I9R[sO⭻lPf3b)^{d39
\ No newline at end of file
diff --git a/tests/resources/userdiff/.gitted/objects/d6/3c806de4f666369ed169495657bec24b558165 b/tests/resources/userdiff/.gitted/objects/d6/3c806de4f666369ed169495657bec24b558165
new file mode 100644
index 0000000..2c0fbcc
Binary files /dev/null and b/tests/resources/userdiff/.gitted/objects/d6/3c806de4f666369ed169495657bec24b558165 differ
diff --git a/tests/resources/userdiff/.gitted/objects/ef/1641511d6cb425c6b4f59ef1feffe7762e86e0 b/tests/resources/userdiff/.gitted/objects/ef/1641511d6cb425c6b4f59ef1feffe7762e86e0
new file mode 100644
index 0000000..223f3b3
--- /dev/null
+++ b/tests/resources/userdiff/.gitted/objects/ef/1641511d6cb425c6b4f59ef1feffe7762e86e0
@@ -0,0 +1 @@
+x+)JMU06g040031QHLK(ar=q[dK`\v=Mr
\ No newline at end of file
diff --git a/tests/resources/userdiff/.gitted/refs/heads/master b/tests/resources/userdiff/.gitted/refs/heads/master
new file mode 100644
index 0000000..2ec79ec
--- /dev/null
+++ b/tests/resources/userdiff/.gitted/refs/heads/master
@@ -0,0 +1 @@
+9db1d09ff9ad5190bcf12d72ea3c818ffca344c5
diff --git a/tests/resources/userdiff/after/file.html b/tests/resources/userdiff/after/file.html
new file mode 100644
index 0000000..2320e2f
--- /dev/null
+++ b/tests/resources/userdiff/after/file.html
@@ -0,0 +1,41 @@
+<html>
+<body>
+  <h1 id="first section">
+  <ol>
+    <li>item 1.1</li>
+    <li>item 1.2 changed</li>
+    <li>item 1.3 changed</li>
+    <li>item 1.4</li>
+    <li>item 1.5</li>
+    <li>item 1.6</li>
+    <li>item 1.7</li>
+    <li>item 1.8</li>
+    <li>item 1.9</li>
+  <li>item 1.10 added</li>
+  </ol>
+  </h1>
+  <h1 id="second section">
+  <ol>
+    <li>item 2.1</li>
+    <li>item 2.2</li>
+    <li>item 2.3</li>
+    <li>item 2.4</li>
+    <li>item 2.5</li>
+    <li>item 2.6</li>
+    <li>item 2.7 changed</li>
+    <li>item 2.7.1 added</li>
+    <li>item 2.8</li>
+  </ol>
+  </h1>
+  <h1 id="third section">
+  <ol>
+    <li>item 3.1</li>
+    <li>item 3.2</li>
+    <li>item 3.3</li>
+    <li>item 3.4</li>
+    <li>item 3.5</li>
+    <li>item 3.6</li>
+  </ol>
+  </h1>
+</body>
+</html>
diff --git a/tests/resources/userdiff/before/file.html b/tests/resources/userdiff/before/file.html
new file mode 100644
index 0000000..872d196
--- /dev/null
+++ b/tests/resources/userdiff/before/file.html
@@ -0,0 +1,41 @@
+<html>
+<body>
+  <h1 id="first section">
+  <ol>
+    <li>item 1.1</li>
+    <li>item 1.2</li>
+    <li>item 1.3</li>
+    <li>item 1.4</li>
+    <li>item 1.5</li>
+    <li>item 1.6</li>
+    <li>item 1.7</li>
+    <li>item 1.8</li>
+    <li>item 1.9</li>
+  </ol>
+  </h1>
+  <h1 id="second section">
+  <ol>
+    <li>item 2.1</li>
+    <li>item 2.2</li>
+    <li>item 2.3</li>
+    <li>item 2.4</li>
+    <li>item 2.5</li>
+    <li>item 2.6</li>
+    <li>item 2.7</li>
+    <li>item 2.8</li>
+  </ol>
+  </h1>
+  <h1 id="third section">
+  <ol>
+    <li>item 3.1</li>
+    <li>item 3.2</li>
+    <li>item 3.3</li>
+    <li>item 3.4</li>
+    <li>item 3.5</li>
+    <li>item 3.6</li>
+    <li>item 3.7</li>
+    <li>item 3.8</li>
+  </ol>
+  </h1>
+</body>
+</html>
diff --git a/tests/resources/userdiff/expected/driver/diff.html b/tests/resources/userdiff/expected/driver/diff.html
new file mode 100644
index 0000000..5a428e7
--- /dev/null
+++ b/tests/resources/userdiff/expected/driver/diff.html
@@ -0,0 +1,26 @@
+diff --git a/files/file.html b/files/file.html
+index 872d196..2320e2f 100644
+--- a/files/file.html
++++ b/files/file.html
+@@ -5,4 +5,4 @@ <h1 id="first section">
+     <li>item 1.1</li>
+-    <li>item 1.2</li>
+-    <li>item 1.3</li>
++    <li>item 1.2 changed</li>
++    <li>item 1.3 changed</li>
+     <li>item 1.4</li>
+@@ -13,2 +13,3 @@ <h1 id="first section">
+     <li>item 1.9</li>
++  <li>item 1.10 added</li>
+   </ol>
+@@ -23,3 +24,4 @@ <h1 id="second section">
+     <li>item 2.6</li>
+-    <li>item 2.7</li>
++    <li>item 2.7 changed</li>
++    <li>item 2.7.1 added</li>
+     <li>item 2.8</li>
+@@ -35,4 +37,2 @@ <h1 id="third section">
+     <li>item 3.6</li>
+-    <li>item 3.7</li>
+-    <li>item 3.8</li>
+   </ol>
diff --git a/tests/resources/userdiff/expected/nodriver/diff.html b/tests/resources/userdiff/expected/nodriver/diff.html
new file mode 100644
index 0000000..2ea4b8a
--- /dev/null
+++ b/tests/resources/userdiff/expected/nodriver/diff.html
@@ -0,0 +1,26 @@
+diff --git a/files/file.html b/files/file.html
+index 872d196..2320e2f 100644
+--- a/files/file.html
++++ b/files/file.html
+@@ -5,4 +5,4 @@
+     <li>item 1.1</li>
+-    <li>item 1.2</li>
+-    <li>item 1.3</li>
++    <li>item 1.2 changed</li>
++    <li>item 1.3 changed</li>
+     <li>item 1.4</li>
+@@ -13,2 +13,3 @@
+     <li>item 1.9</li>
++  <li>item 1.10 added</li>
+   </ol>
+@@ -23,3 +24,4 @@
+     <li>item 2.6</li>
+-    <li>item 2.7</li>
++    <li>item 2.7 changed</li>
++    <li>item 2.7.1 added</li>
+     <li>item 2.8</li>
+@@ -35,4 +37,2 @@
+     <li>item 3.6</li>
+-    <li>item 3.7</li>
+-    <li>item 3.8</li>
+   </ol>
diff --git a/tests/resources/userdiff/files/file.html b/tests/resources/userdiff/files/file.html
new file mode 100644
index 0000000..2320e2f
--- /dev/null
+++ b/tests/resources/userdiff/files/file.html
@@ -0,0 +1,41 @@
+<html>
+<body>
+  <h1 id="first section">
+  <ol>
+    <li>item 1.1</li>
+    <li>item 1.2 changed</li>
+    <li>item 1.3 changed</li>
+    <li>item 1.4</li>
+    <li>item 1.5</li>
+    <li>item 1.6</li>
+    <li>item 1.7</li>
+    <li>item 1.8</li>
+    <li>item 1.9</li>
+  <li>item 1.10 added</li>
+  </ol>
+  </h1>
+  <h1 id="second section">
+  <ol>
+    <li>item 2.1</li>
+    <li>item 2.2</li>
+    <li>item 2.3</li>
+    <li>item 2.4</li>
+    <li>item 2.5</li>
+    <li>item 2.6</li>
+    <li>item 2.7 changed</li>
+    <li>item 2.7.1 added</li>
+    <li>item 2.8</li>
+  </ol>
+  </h1>
+  <h1 id="third section">
+  <ol>
+    <li>item 3.1</li>
+    <li>item 3.2</li>
+    <li>item 3.3</li>
+    <li>item 3.4</li>
+    <li>item 3.5</li>
+    <li>item 3.6</li>
+  </ol>
+  </h1>
+</body>
+</html>