Commit 3dccfed16382c64370dd0fd88668c9d9accae6ed

Vicent Marti 2011-03-03T18:19:05

Cleanup the testing toolkit Tests are now declared with detailed descriptions and a short test name: BEGIN_TEST(the_test0, "this is an example test that does something") ... END_TEST Modules are declared through a simple macro interface: BEGIN_MODULE(mod_name) ADD_TEST(the_test0); ... END_MODULE Error messages when tests fail have been greatly improved. Signed-off-by: Vicent Marti <tanoku@gmail.com>

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
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
diff --git a/tests/t00-core.c b/tests/t00-core.c
index ad1f34b..3c1b621 100644
--- a/tests/t00-core.c
+++ b/tests/t00-core.c
@@ -27,7 +27,7 @@
 #include "vector.h"
 #include "fileops.h"
 
-BEGIN_TEST("refcnt", init_inc2_dec2_free)
+BEGIN_TEST(refcnt0, "increment refcount twice, decrement twice")
 	git_refcnt p;
 
 	gitrc_init(&p, 0);
@@ -38,7 +38,7 @@ BEGIN_TEST("refcnt", init_inc2_dec2_free)
 	gitrc_free(&p);
 END_TEST
 
-BEGIN_TEST("strutil", prefix_comparison)
+BEGIN_TEST(string0, "compare prefixes")
 	must_be_true(git__prefixcmp("", "") == 0);
 	must_be_true(git__prefixcmp("a", "") == 0);
 	must_be_true(git__prefixcmp("", "a") < 0);
@@ -49,7 +49,7 @@ BEGIN_TEST("strutil", prefix_comparison)
 	must_be_true(git__prefixcmp("ab", "aa") > 0);
 END_TEST
 
-BEGIN_TEST("strutil", suffix_comparison)
+BEGIN_TEST(string1, "compare suffixes")
 	must_be_true(git__suffixcmp("", "") == 0);
 	must_be_true(git__suffixcmp("a", "") == 0);
 	must_be_true(git__suffixcmp("", "a") < 0);
@@ -60,7 +60,31 @@ BEGIN_TEST("strutil", suffix_comparison)
 	must_be_true(git__suffixcmp("zaz", "ac") > 0);
 END_TEST
 
-BEGIN_TEST("strutil", dirname)
+
+BEGIN_TEST(vector0, "initial size of 1 would cause writing past array bounds")
+  git_vector x;
+  int i;
+  git_vector_init(&x, 1, NULL, NULL);
+  for (i = 0; i < 10; ++i) {
+    git_vector_insert(&x, (void*) 0xabc);
+  }
+  git_vector_free(&x);
+END_TEST
+
+BEGIN_TEST(vector1, "don't read past array bounds on remove()")
+  git_vector x;
+  // make initial capacity exact for our insertions.
+  git_vector_init(&x, 3, NULL, NULL);
+  git_vector_insert(&x, (void*) 0xabc);
+  git_vector_insert(&x, (void*) 0xdef);
+  git_vector_insert(&x, (void*) 0x123);
+
+  git_vector_remove(&x, 0);  // used to read past array bounds.
+  git_vector_free(&x);
+END_TEST
+
+
+BEGIN_TEST(path0, "get the dirname of a path")
 	char dir[64], *dir2;
 
 #define DIRNAME_TEST(A, B) { \
@@ -89,7 +113,7 @@ BEGIN_TEST("strutil", dirname)
 
 END_TEST
 
-BEGIN_TEST("strutil", basename)
+BEGIN_TEST(path1, "get the base name of a path")
 	char base[64], *base2;
 
 #define BASENAME_TEST(A, B) { \
@@ -114,7 +138,7 @@ BEGIN_TEST("strutil", basename)
 
 END_TEST
 
-BEGIN_TEST("strutil", topdir)
+BEGIN_TEST(path2, "get the latest component in a path")
 	const char *dir;
 
 #define TOPDIR_TEST(A, B) { \
@@ -138,32 +162,6 @@ BEGIN_TEST("strutil", topdir)
 #undef TOPDIR_TEST
 END_TEST
 
-/* Initial size of 1 will cause writing past array bounds prior to fix */
-BEGIN_TEST("vector", initial_size_one)
-  git_vector x;
-  int i;
-  git_vector_init(&x, 1, NULL, NULL);
-  for (i = 0; i < 10; ++i) {
-    git_vector_insert(&x, (void*) 0xabc);
-  }
-  git_vector_free(&x);
-END_TEST
-
-/* vector used to read past array bounds on remove() */
-BEGIN_TEST("vector", remove)
-  git_vector x;
-  // make initial capacity exact for our insertions.
-  git_vector_init(&x, 3, NULL, NULL);
-  git_vector_insert(&x, (void*) 0xabc);
-  git_vector_insert(&x, (void*) 0xdef);
-  git_vector_insert(&x, (void*) 0x123);
-
-  git_vector_remove(&x, 0);  // used to read past array bounds.
-  git_vector_free(&x);
-END_TEST
-
-
-
 typedef int (normalize_path)(char *, const char *);
 
 static int ensure_normalized(const char *input_path, const char *expected_path, normalize_path normalizer)
@@ -194,7 +192,7 @@ static int ensure_file_path_normalized(const char *input_path, const char *expec
 	return ensure_normalized(input_path, expected_path, gitfo_prettify_file_path);
 }
 
-BEGIN_TEST("path", file_path_prettifying)
+BEGIN_TEST(path3, "prettify and validate a path to a file")
 	must_pass(ensure_file_path_normalized("a", "a"));
 	must_pass(ensure_file_path_normalized("./testrepo.git", "testrepo.git"));
 	must_pass(ensure_file_path_normalized("./.git", ".git"));
@@ -274,7 +272,7 @@ BEGIN_TEST("path", file_path_prettifying)
 	must_fail(ensure_file_path_normalized("/d1/.../d2", NULL));
 END_TEST
 
-BEGIN_TEST("path", dir_path_prettifying)
+BEGIN_TEST(path4, "validate and prettify a path to a folder")
 	must_pass(ensure_dir_path_normalized("./testrepo.git", "testrepo.git/"));
 	must_pass(ensure_dir_path_normalized("./.git", ".git/"));
 	must_pass(ensure_dir_path_normalized("./git.", "git./"));
@@ -354,7 +352,7 @@ static int ensure_joinpath(const char *path_a, const char *path_b, const char *e
 	return strcmp(joined_path, expected_path) == 0 ? GIT_SUCCESS : GIT_ERROR;
 }
 
-BEGIN_TEST("path", joinpath)
+BEGIN_TEST(path5, "properly join path components")
 	must_pass(ensure_joinpath("", "", ""));
 	must_pass(ensure_joinpath("", "a", "a"));
 	must_pass(ensure_joinpath("", "/a", "/a"));
@@ -376,7 +374,7 @@ static int ensure_joinpath_n(const char *path_a, const char *path_b, const char 
 	return strcmp(joined_path, expected_path) == 0 ? GIT_SUCCESS : GIT_ERROR;
 }
 
-BEGIN_TEST("path", joinpath_n)
+BEGIN_TEST(path6, "properly join path components for more than one path")
 	must_pass(ensure_joinpath_n("", "", "", "", ""));
 	must_pass(ensure_joinpath_n("", "a", "", "", "a/"));
 	must_pass(ensure_joinpath_n("a", "", "", "", "a/"));
@@ -506,7 +504,7 @@ static walk_data dot = {
 	dot_names
 };
 
-BEGIN_TEST("dirent", dot)
+BEGIN_TEST(dirent0, "make sure that the '.' folder is not traversed")
 
 	must_pass(setup(&dot));
 
@@ -531,7 +529,7 @@ static walk_data sub = {
 	sub_names
 };
 
-BEGIN_TEST("dirent", sub)
+BEGIN_TEST(dirent1, "traverse a subfolder")
 
 	must_pass(setup(&sub));
 
@@ -550,7 +548,7 @@ static walk_data sub_slash = {
 	sub_names
 };
 
-BEGIN_TEST("dirent", sub_slash)
+BEGIN_TEST(dirent2, "traverse a slash-terminated subfolder")
 
 	must_pass(setup(&sub_slash));
 
@@ -579,7 +577,7 @@ static int dont_call_me(void *GIT_UNUSED(state), char *GIT_UNUSED(path))
 	return GIT_ERROR;
 }
 
-BEGIN_TEST("dirent", empty)
+BEGIN_TEST(dirent3, "make sure that empty folders are not traversed")
 
 	must_pass(setup(&empty));
 
@@ -612,7 +610,7 @@ static walk_data odd = {
 	odd_names
 };
 
-BEGIN_TEST("dirent", odd)
+BEGIN_TEST(dirent4, "make sure that strange looking filenames ('..c') are traversed")
 
 	must_pass(setup(&odd));
 
@@ -627,31 +625,26 @@ BEGIN_TEST("dirent", odd)
 END_TEST
 
 
-git_testsuite *libgit2_suite_core(void)
-{
-	git_testsuite *suite = git_testsuite_new("Core");
-
-	ADD_TEST(suite, "refcnt", init_inc2_dec2_free);
-
-	ADD_TEST(suite, "strutil", prefix_comparison);
-	ADD_TEST(suite, "strutil", suffix_comparison);
-	ADD_TEST(suite, "strutil", dirname);
-	ADD_TEST(suite, "strutil", basename);
-	ADD_TEST(suite, "strutil", topdir);
+BEGIN_SUITE(core)
+	ADD_TEST(refcnt0);
 
-	ADD_TEST(suite, "vector", initial_size_one);
-	ADD_TEST(suite, "vector", remove);
+	ADD_TEST(string0);
+	ADD_TEST(string1);
 
-	ADD_TEST(suite, "path", file_path_prettifying);
-	ADD_TEST(suite, "path", dir_path_prettifying);
-	ADD_TEST(suite, "path", joinpath);
-	ADD_TEST(suite, "path", joinpath_n);
+	ADD_TEST(vector0);
+	ADD_TEST(vector1);
 
-	ADD_TEST(suite, "dirent", dot);
-	ADD_TEST(suite, "dirent", sub);
-	ADD_TEST(suite, "dirent", sub_slash);
-	ADD_TEST(suite, "dirent", empty);
-	ADD_TEST(suite, "dirent", odd);
+	ADD_TEST(path0);
+	ADD_TEST(path1);
+	ADD_TEST(path2);
+	ADD_TEST(path3);
+	ADD_TEST(path4);
+	ADD_TEST(path5);
+	ADD_TEST(path6);
 
-	return suite;
-}
+	ADD_TEST(dirent0);
+	ADD_TEST(dirent1);
+	ADD_TEST(dirent2);
+	ADD_TEST(dirent3);
+	ADD_TEST(dirent4);
+END_SUITE
diff --git a/tests/t01-rawobj.c b/tests/t01-rawobj.c
index 51a7942..cc46415 100644
--- a/tests/t01-rawobj.c
+++ b/tests/t01-rawobj.c
@@ -27,7 +27,7 @@
 
 #include "hash.h"
 
-BEGIN_TEST("oid", oid_szs)
+BEGIN_TEST(oid0, "validate size of oid objects")
 	git_oid out;
 	must_be_true(20 == GIT_OID_RAWSZ);
 	must_be_true(40 == GIT_OID_HEXSZ);
@@ -35,12 +35,12 @@ BEGIN_TEST("oid", oid_szs)
 	must_be_true(sizeof(out.id) == GIT_OID_RAWSZ);
 END_TEST
 
-BEGIN_TEST("oid", empty_string)
+BEGIN_TEST(oid1, "fail when parsing an empty string as oid")
 	git_oid out;
 	must_fail(git_oid_mkstr(&out, ""));
 END_TEST
 
-BEGIN_TEST("oid", invalid_string_moo)
+BEGIN_TEST(oid2, "fail when parsing an invalid string as oid")
 	git_oid out;
 	must_fail(git_oid_mkstr(&out, "moo"));
 END_TEST
@@ -56,7 +56,7 @@ static int from_hex(unsigned int i)
 	return -1;
 }
 
-BEGIN_TEST("oid", invalid_string_all_chars)
+BEGIN_TEST(oid3, "find all invalid characters when parsing an oid")
 	git_oid out;
 	unsigned char exp[] = {
 		0x16, 0xa6, 0x77, 0x70, 0xb7,
@@ -80,12 +80,12 @@ BEGIN_TEST("oid", invalid_string_all_chars)
 	}
 END_TEST
 
-BEGIN_TEST("oid", invalid_string_16a67770b7d8d72317c4b775213c23a8bd74f5ez)
+BEGIN_TEST(oid4, "fail when parsing an invalid oid string")
 	git_oid out;
 	must_fail(git_oid_mkstr(&out, "16a67770b7d8d72317c4b775213c23a8bd74f5ez"));
 END_TEST
 
-BEGIN_TEST("oid", valid_string_16a67770b7d8d72317c4b775213c23a8bd74f5e0)
+BEGIN_TEST(oid5, "succeed when parsing a valid oid string")
 	git_oid out;
 	unsigned char exp[] = {
 		0x16, 0xa6, 0x77, 0x70, 0xb7,
@@ -101,7 +101,7 @@ BEGIN_TEST("oid", valid_string_16a67770b7d8d72317c4b775213c23a8bd74f5e0)
 	must_pass(memcmp(out.id, exp, sizeof(out.id)));
 END_TEST
 
-BEGIN_TEST("oid", valid_raw)
+BEGIN_TEST(oid6, "build a valid oid from raw bytes")
 	git_oid out;
 	unsigned char exp[] = {
 		0x16, 0xa6, 0x77, 0x70, 0xb7,
@@ -114,7 +114,7 @@ BEGIN_TEST("oid", valid_raw)
 	must_pass(memcmp(out.id, exp, sizeof(out.id)));
 END_TEST
 
-BEGIN_TEST("oid", copy_oid)
+BEGIN_TEST(oid7, "properly copy an oid to another")
 	git_oid a, b;
 	unsigned char exp[] = {
 		0x16, 0xa6, 0x77, 0x70, 0xb7,
@@ -129,7 +129,7 @@ BEGIN_TEST("oid", copy_oid)
 	must_pass(memcmp(a.id, exp, sizeof(a.id)));
 END_TEST
 
-BEGIN_TEST("oid", cmp_oid_lt)
+BEGIN_TEST(oid8, "compare two oids (lesser than)")
 	git_oid a, b;
 	unsigned char a_in[] = {
 		0x16, 0xa6, 0x77, 0x70, 0xb7,
@@ -149,7 +149,7 @@ BEGIN_TEST("oid", cmp_oid_lt)
 	must_be_true(git_oid_cmp(&a, &b) < 0);
 END_TEST
 
-BEGIN_TEST("oid", cmp_oid_eq)
+BEGIN_TEST(oid9, "compare two oids (equal)")
 	git_oid a, b;
 	unsigned char a_in[] = {
 		0x16, 0xa6, 0x77, 0x70, 0xb7,
@@ -163,7 +163,7 @@ BEGIN_TEST("oid", cmp_oid_eq)
 	must_be_true(git_oid_cmp(&a, &b) == 0);
 END_TEST
 
-BEGIN_TEST("oid", cmp_oid_gt)
+BEGIN_TEST(oid10, "compare two oids (greater than)")
 	git_oid a, b;
 	unsigned char a_in[] = {
 		0x16, 0xa6, 0x77, 0x70, 0xb7,
@@ -183,7 +183,7 @@ BEGIN_TEST("oid", cmp_oid_gt)
 	must_be_true(git_oid_cmp(&a, &b) > 0);
 END_TEST
 
-BEGIN_TEST("oid", cmp_oid_fmt)
+BEGIN_TEST(oid11, "compare formated oids")
 	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
 	char out[GIT_OID_HEXSZ + 1];
@@ -200,7 +200,7 @@ BEGIN_TEST("oid", cmp_oid_fmt)
 	must_pass(strcmp(exp, out));
 END_TEST
 
-BEGIN_TEST("oid", cmp_oid_allocfmt)
+BEGIN_TEST(oid12, "compare oids (allocate + format)")
 	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
 	char *out;
@@ -213,7 +213,7 @@ BEGIN_TEST("oid", cmp_oid_allocfmt)
 	free(out);
 END_TEST
 
-BEGIN_TEST("oid", cmp_oid_pathfmt)
+BEGIN_TEST(oid13, "compare oids (path format)")
 	const char *exp1 = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	const char *exp2 = "16/a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
@@ -231,7 +231,7 @@ BEGIN_TEST("oid", cmp_oid_pathfmt)
 	must_pass(strcmp(exp2, out));
 END_TEST
 
-BEGIN_TEST("oid", oid_to_string)
+BEGIN_TEST(oid14, "convert raw oid to string")
 	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
 	char out[GIT_OID_HEXSZ + 1];
@@ -275,7 +275,7 @@ BEGIN_TEST("oid", oid_to_string)
 	must_pass(strcmp(exp, out));
 END_TEST
 
-BEGIN_TEST("oid", oid_to_string_big)
+BEGIN_TEST(oid15, "convert raw oid to string (big)")
 	const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
 	git_oid in;
 	char big[GIT_OID_HEXSZ + 1 + 3]; /* note + 4 => big buffer */
@@ -306,7 +306,7 @@ static char *hello_text = "hello world\n";
 static char *bye_id = "ce08fe4884650f067bd5703b6a59a8b3b3c99a09";
 static char *bye_text = "bye world\n";
 
-BEGIN_TEST("hash", hash_iuf)
+BEGIN_TEST(hash0, "normal hash by blocks")
     git_hash_ctx *ctx;
     git_oid id1, id2;
 
@@ -328,7 +328,7 @@ BEGIN_TEST("hash", hash_iuf)
     git_hash_free_ctx(ctx);
 END_TEST
 
-BEGIN_TEST("hash", hash_buf)
+BEGIN_TEST(hash1, "hash whole buffer in a single call")
     git_oid id1, id2;
 
     must_pass(git_oid_mkstr(&id1, hello_id));
@@ -338,7 +338,7 @@ BEGIN_TEST("hash", hash_buf)
     must_be_true(git_oid_cmp(&id1, &id2) == 0);
 END_TEST
 
-BEGIN_TEST("hash", hash_vec)
+BEGIN_TEST(hash2, "hash a vector")
     git_oid id1, id2;
     git_buf_vec vec[2];
 
@@ -354,7 +354,7 @@ BEGIN_TEST("hash", hash_vec)
     must_be_true(git_oid_cmp(&id1, &id2) == 0);
 END_TEST
 
-BEGIN_TEST("objtype", type_to_string)
+BEGIN_TEST(objtype0, "convert type to string")
 	must_be_true(!strcmp(git_object_type2string(GIT_OBJ_BAD), ""));
 	must_be_true(!strcmp(git_object_type2string(GIT_OBJ__EXT1), ""));
 	must_be_true(!strcmp(git_object_type2string(GIT_OBJ_COMMIT), "commit"));
@@ -370,7 +370,7 @@ BEGIN_TEST("objtype", type_to_string)
 	must_be_true(!strcmp(git_object_type2string(1234), ""));
 END_TEST
 
-BEGIN_TEST("objtype", string_to_type)
+BEGIN_TEST(objtype1, "convert string to type")
 	must_be_true(git_object_string2type(NULL) == GIT_OBJ_BAD);
 	must_be_true(git_object_string2type("") == GIT_OBJ_BAD);
 	must_be_true(git_object_string2type("commit") == GIT_OBJ_COMMIT);
@@ -384,7 +384,7 @@ BEGIN_TEST("objtype", string_to_type)
 	must_be_true(git_object_string2type("hohoho") == GIT_OBJ_BAD);
 END_TEST
 
-BEGIN_TEST("objtype", loose_object)
+BEGIN_TEST(objtype2, "check if an object type is loose")
 	must_be_true(git_object_typeisloose(GIT_OBJ_BAD) == 0);
 	must_be_true(git_object_typeisloose(GIT_OBJ__EXT1) == 0);
 	must_be_true(git_object_typeisloose(GIT_OBJ_COMMIT) == 1);
@@ -400,7 +400,7 @@ BEGIN_TEST("objtype", loose_object)
 	must_be_true(git_object_typeisloose(1234) == 0);
 END_TEST
 
-BEGIN_TEST("objhash", hash_junk)
+BEGIN_TEST(objhash0, "hash junk data")
     git_oid id, id_zero;
 
     must_pass(git_oid_mkstr(&id_zero, zero_id));
@@ -431,7 +431,7 @@ BEGIN_TEST("objhash", hash_junk)
     must_fail(git_rawobj_hash(&id, &junk_obj));
 END_TEST
 
-BEGIN_TEST("objhash", hash_commit)
+BEGIN_TEST(objhash1, "hash a commit object")
     git_oid id1, id2;
 
     must_pass(git_oid_mkstr(&id1, commit_id));
@@ -441,7 +441,7 @@ BEGIN_TEST("objhash", hash_commit)
     must_be_true(git_oid_cmp(&id1, &id2) == 0);
 END_TEST
 
-BEGIN_TEST("objhash", hash_tree)
+BEGIN_TEST(objhash2, "hash a tree object")
     git_oid id1, id2;
 
     must_pass(git_oid_mkstr(&id1, tree_id));
@@ -451,7 +451,7 @@ BEGIN_TEST("objhash", hash_tree)
     must_be_true(git_oid_cmp(&id1, &id2) == 0);
 END_TEST
 
-BEGIN_TEST("objhash", hash_tag)
+BEGIN_TEST(objhash3, "hash a tag object")
     git_oid id1, id2;
 
     must_pass(git_oid_mkstr(&id1, tag_id));
@@ -461,7 +461,7 @@ BEGIN_TEST("objhash", hash_tag)
     must_be_true(git_oid_cmp(&id1, &id2) == 0);
 END_TEST
 
-BEGIN_TEST("objhash", hash_zero)
+BEGIN_TEST(objhash4, "hash a zero-length object")
     git_oid id1, id2;
 
     must_pass(git_oid_mkstr(&id1, zero_id));
@@ -471,7 +471,7 @@ BEGIN_TEST("objhash", hash_zero)
     must_be_true(git_oid_cmp(&id1, &id2) == 0);
 END_TEST
 
-BEGIN_TEST("objhash", hash_one)
+BEGIN_TEST(objhash5, "hash an one-byte long object")
     git_oid id1, id2;
 
     must_pass(git_oid_mkstr(&id1, one_id));
@@ -481,7 +481,7 @@ BEGIN_TEST("objhash", hash_one)
     must_be_true(git_oid_cmp(&id1, &id2) == 0);
 END_TEST
 
-BEGIN_TEST("objhash", hash_two)
+BEGIN_TEST(objhash6, "hash a two-byte long object")
     git_oid id1, id2;
 
     must_pass(git_oid_mkstr(&id1, two_id));
@@ -491,7 +491,7 @@ BEGIN_TEST("objhash", hash_two)
     must_be_true(git_oid_cmp(&id1, &id2) == 0);
 END_TEST
 
-BEGIN_TEST("objhash", hash_some)
+BEGIN_TEST(objhash7, "hash an object several bytes long")
     git_oid id1, id2;
 
     must_pass(git_oid_mkstr(&id1, some_id));
@@ -501,46 +501,39 @@ BEGIN_TEST("objhash", hash_some)
     must_be_true(git_oid_cmp(&id1, &id2) == 0);
 END_TEST
 
-
-git_testsuite *libgit2_suite_rawobjects(void)
-{
-	git_testsuite *suite = git_testsuite_new("Raw Objects");
-
-	ADD_TEST(suite, "hash", hash_iuf);
-	ADD_TEST(suite, "hash", hash_buf);
-	ADD_TEST(suite, "hash", hash_vec);
-
-	ADD_TEST(suite, "oid", oid_szs);
-	ADD_TEST(suite, "oid", empty_string);
-	ADD_TEST(suite, "oid", invalid_string_moo);
-	ADD_TEST(suite, "oid", invalid_string_all_chars);
-	ADD_TEST(suite, "oid", invalid_string_16a67770b7d8d72317c4b775213c23a8bd74f5ez);
-	ADD_TEST(suite, "oid", valid_string_16a67770b7d8d72317c4b775213c23a8bd74f5e0);
-	ADD_TEST(suite, "oid", valid_raw);
-	ADD_TEST(suite, "oid", copy_oid);
-	ADD_TEST(suite, "oid", cmp_oid_lt);
-	ADD_TEST(suite, "oid", cmp_oid_eq);
-	ADD_TEST(suite, "oid", cmp_oid_gt);
-	ADD_TEST(suite, "oid", cmp_oid_fmt);
-	ADD_TEST(suite, "oid", cmp_oid_allocfmt);
-	ADD_TEST(suite, "oid", cmp_oid_pathfmt);
-	ADD_TEST(suite, "oid", oid_to_string);
-	ADD_TEST(suite, "oid", oid_to_string_big);
-
-	ADD_TEST(suite, "objtype", type_to_string);
-	ADD_TEST(suite, "objtype", string_to_type);
-	ADD_TEST(suite, "objtype", loose_object);
-
-	ADD_TEST(suite, "objhash", hash_junk);
-	ADD_TEST(suite, "objhash", hash_commit);
-	ADD_TEST(suite, "objhash", hash_tree);
-	ADD_TEST(suite, "objhash", hash_tag);
-	ADD_TEST(suite, "objhash", hash_zero);
-	ADD_TEST(suite, "objhash", hash_one);
-	ADD_TEST(suite, "objhash", hash_two);
-	ADD_TEST(suite, "objhash", hash_some);
-
-	return suite;
-}
-
+BEGIN_SUITE(rawobjects)
+	ADD_TEST(oid0);
+	ADD_TEST(oid1);
+	ADD_TEST(oid2);
+	ADD_TEST(oid3);
+	ADD_TEST(oid4);
+	ADD_TEST(oid5);
+	ADD_TEST(oid6);
+	ADD_TEST(oid7);
+	ADD_TEST(oid8);
+	ADD_TEST(oid9);
+	ADD_TEST(oid10);
+	ADD_TEST(oid11);
+	ADD_TEST(oid12);
+	ADD_TEST(oid13);
+	ADD_TEST(oid14);
+	ADD_TEST(oid15);
+
+	ADD_TEST(hash0);
+	ADD_TEST(hash1);
+	ADD_TEST(hash2);
+
+	ADD_TEST(objtype0);
+	ADD_TEST(objtype1);
+	ADD_TEST(objtype2);
+
+	ADD_TEST(objhash0);
+	ADD_TEST(objhash1);
+	ADD_TEST(objhash2);
+	ADD_TEST(objhash3);
+	ADD_TEST(objhash4);
+	ADD_TEST(objhash5);
+	ADD_TEST(objhash6);
+	ADD_TEST(objhash7);
+END_SUITE
 
diff --git a/tests/t02-data.h b/tests/t02-data.h
index 456be50..705a2d7 100644
--- a/tests/t02-data.h
+++ b/tests/t02-data.h
@@ -23,25 +23,6 @@ static object_data one = {
 };
 
 
-BEGIN_TEST("existsloose", exists_loose_one)
-    git_odb *db;
-    git_oid id, id2;
-
-    must_pass(write_object_files(odb_dir, &one));
-    must_pass(git_odb_open(&db, odb_dir));
-    must_pass(git_oid_mkstr(&id, one.id));
-
-    must_be_true(git_odb_exists(db, &id));
-
-	/* Test for a non-existant object */
-    must_pass(git_oid_mkstr(&id2, "8b137891791fe96927ad78e64b0aad7bded08baa"));
-    must_be_true(0 == git_odb_exists(db, &id2));
-
-    git_odb_close(db);
-    must_pass(remove_object_files(odb_dir, &one));
-END_TEST
-
-
 /* commit == 3d7f8a6af076c8c3f20071a8935cdbe8228594d1 */
 static unsigned char commit_bytes[] = {
     0x78, 0x01, 0x85, 0x50, 0xc1, 0x6a, 0xc3, 0x30,
diff --git a/tests/t02-objread.c b/tests/t02-objread.c
index 1b2e2d5..2a9d130 100644
--- a/tests/t02-objread.c
+++ b/tests/t02-objread.c
@@ -28,7 +28,26 @@
 #include "t02-data.h"
 #include "t02-oids.h"
 
-BEGIN_TEST("readloose", read_loose_commit)
+
+BEGIN_TEST(existsloose0, "check if a loose object exists on the odb")
+    git_odb *db;
+    git_oid id, id2;
+
+    must_pass(write_object_files(odb_dir, &one));
+    must_pass(git_odb_open(&db, odb_dir));
+    must_pass(git_oid_mkstr(&id, one.id));
+
+    must_be_true(git_odb_exists(db, &id));
+
+	/* Test for a non-existant object */
+    must_pass(git_oid_mkstr(&id2, "8b137891791fe96927ad78e64b0aad7bded08baa"));
+    must_be_true(0 == git_odb_exists(db, &id2));
+
+    git_odb_close(db);
+    must_pass(remove_object_files(odb_dir, &one));
+END_TEST
+
+BEGIN_TEST(readloose0, "read a loose commit")
     git_odb *db;
     git_oid id;
     git_rawobj obj;
@@ -45,7 +64,7 @@ BEGIN_TEST("readloose", read_loose_commit)
     must_pass(remove_object_files(odb_dir, &commit));
 END_TEST
 
-BEGIN_TEST("readloose", read_loose_tree)
+BEGIN_TEST(readloose1, "read a loose tree")
     git_odb *db;
     git_oid id;
     git_rawobj obj;
@@ -62,7 +81,7 @@ BEGIN_TEST("readloose", read_loose_tree)
     must_pass(remove_object_files(odb_dir, &tree));
 END_TEST
 
-BEGIN_TEST("readloose", read_loose_tag)
+BEGIN_TEST(readloose2, "read a loose tag")
     git_odb *db;
     git_oid id;
     git_rawobj obj;
@@ -79,7 +98,7 @@ BEGIN_TEST("readloose", read_loose_tag)
     must_pass(remove_object_files(odb_dir, &tag));
 END_TEST
 
-BEGIN_TEST("readloose", read_loose_zero)
+BEGIN_TEST(readloose3, "read a loose zero-bytes object")
     git_odb *db;
     git_oid id;
     git_rawobj obj;
@@ -96,7 +115,7 @@ BEGIN_TEST("readloose", read_loose_zero)
     must_pass(remove_object_files(odb_dir, &zero));
 END_TEST
 
-BEGIN_TEST("readloose", read_loose_one)
+BEGIN_TEST(readloose4, "read a one-byte long loose object")
     git_odb *db;
     git_oid id;
     git_rawobj obj;
@@ -113,7 +132,7 @@ BEGIN_TEST("readloose", read_loose_one)
     must_pass(remove_object_files(odb_dir, &one));
 END_TEST
 
-BEGIN_TEST("readloose", read_loose_two)
+BEGIN_TEST(readloose5, "read a two-bytes long loose object")
     git_odb *db;
     git_oid id;
     git_rawobj obj;
@@ -130,7 +149,7 @@ BEGIN_TEST("readloose", read_loose_two)
     must_pass(remove_object_files(odb_dir, &two));
 END_TEST
 
-BEGIN_TEST("readloose", read_loose_some)
+BEGIN_TEST(readloose6, "read a loose object which is several bytes long")
     git_odb *db;
     git_oid id;
     git_rawobj obj;
@@ -147,7 +166,7 @@ BEGIN_TEST("readloose", read_loose_some)
     must_pass(remove_object_files(odb_dir, &some));
 END_TEST
 
-BEGIN_TEST("readpack", readpacked_test)
+BEGIN_TEST(readpack0, "read several packed objects")
 	unsigned int i;
     git_odb *db;
 
@@ -167,7 +186,7 @@ BEGIN_TEST("readpack", readpacked_test)
     git_odb_close(db);
 END_TEST
 
-BEGIN_TEST("readheader", readheader_packed_test)
+BEGIN_TEST(readheader0, "read only the header of several packed objects")
 	unsigned int i;
     git_odb *db;
 
@@ -191,7 +210,7 @@ BEGIN_TEST("readheader", readheader_packed_test)
     git_odb_close(db); 
 END_TEST
 
-BEGIN_TEST("readheader", readheader_loose_test)
+BEGIN_TEST(readheader1, "read only the header of several loose objects")
 	unsigned int i;
     git_odb *db;
 
@@ -217,36 +236,29 @@ BEGIN_TEST("readheader", readheader_loose_test)
     git_odb_close(db);
 END_TEST
 
-git_testsuite *libgit2_suite_objread(void)
-{
-	git_testsuite *suite = git_testsuite_new("Object Read");
-
-	ADD_TEST(suite, "existsloose", exists_loose_one);
+BEGIN_SUITE(objread)
+	ADD_TEST(existsloose0);
 
-	ADD_TEST(suite, "readloose", read_loose_commit);
-	ADD_TEST(suite, "readloose", read_loose_tree);
-	ADD_TEST(suite, "readloose", read_loose_tag);
-	ADD_TEST(suite, "readloose", read_loose_zero);
-	ADD_TEST(suite, "readloose", read_loose_one);
-	ADD_TEST(suite, "readloose", read_loose_two);
-	ADD_TEST(suite, "readloose", read_loose_some);
+	ADD_TEST(readloose0);
+	ADD_TEST(readloose1);
+	ADD_TEST(readloose2);
+	ADD_TEST(readloose3);
+	ADD_TEST(readloose4);
+	ADD_TEST(readloose5);
+	ADD_TEST(readloose6);
 
-	/* TODO: import these (naming conflicts) */
 /*
-	ADD_TEST(suite, "readloose", read_loose_commit_enc);
-	ADD_TEST(suite, "readloose", read_loose_tree_enc);
-	ADD_TEST(suite, "readloose", read_loose_tag_enc);
-	ADD_TEST(suite, "readloose", read_loose_zero_enc);
-	ADD_TEST(suite, "readloose", read_loose_one_enc);
-	ADD_TEST(suite, "readloose", read_loose_two_enc);
-	ADD_TEST(suite, "readloose", read_loose_some_enc);
+	ADD_TEST(readloose_enc0);
+	ADD_TEST(readloose_enc1);
+	ADD_TEST(readloose_enc2);
+	ADD_TEST(readloose_enc3);
+	ADD_TEST(readloose_enc4);
+	ADD_TEST(readloose_enc5);
+	ADD_TEST(readloose_enc6);
 */
 
-	ADD_TEST(suite, "readpack", readpacked_test);
-
-	ADD_TEST(suite, "readheader", readheader_packed_test);
-	ADD_TEST(suite, "readheader", readheader_loose_test);
-
+	ADD_TEST(readpack0);
 
-	return suite;
-}
+	ADD_TEST(readheader0);
+	ADD_TEST(readheader1);
+END_SUITE
diff --git a/tests/t03-objwrite.c b/tests/t03-objwrite.c
index 0b92325..10c6c7f 100644
--- a/tests/t03-objwrite.c
+++ b/tests/t03-objwrite.c
@@ -80,7 +80,7 @@ static int remove_object_files(object_data *d)
 	return 0;
 }
 
-BEGIN_TEST("write", write_commit)
+BEGIN_TEST(write0, "write loose commit object")
     git_odb *db;
     git_oid id1, id2;
     git_rawobj obj;
@@ -101,7 +101,7 @@ BEGIN_TEST("write", write_commit)
     must_pass(remove_object_files(&commit));
 END_TEST
 
-BEGIN_TEST("write", write_tree)
+BEGIN_TEST(write1, "write loose tree object")
     git_odb *db;
     git_oid id1, id2;
     git_rawobj obj;
@@ -122,7 +122,7 @@ BEGIN_TEST("write", write_tree)
     must_pass(remove_object_files(&tree));
 END_TEST
 
-BEGIN_TEST("write", write_tag)
+BEGIN_TEST(write2, "write loose tag object")
     git_odb *db;
     git_oid id1, id2;
     git_rawobj obj;
@@ -143,7 +143,7 @@ BEGIN_TEST("write", write_tag)
     must_pass(remove_object_files(&tag));
 END_TEST
 
-BEGIN_TEST("write", write_zero)
+BEGIN_TEST(write3, "write zero-length object")
     git_odb *db;
     git_oid id1, id2;
     git_rawobj obj;
@@ -164,7 +164,7 @@ BEGIN_TEST("write", write_zero)
     must_pass(remove_object_files(&zero));
 END_TEST
 
-BEGIN_TEST("write", write_one)
+BEGIN_TEST(write4, "write one-byte long object")
     git_odb *db;
     git_oid id1, id2;
     git_rawobj obj;
@@ -185,7 +185,7 @@ BEGIN_TEST("write", write_one)
     must_pass(remove_object_files(&one));
 END_TEST
 
-BEGIN_TEST("write", write_two)
+BEGIN_TEST(write5, "write two-byte long object")
     git_odb *db;
     git_oid id1, id2;
     git_rawobj obj;
@@ -206,7 +206,7 @@ BEGIN_TEST("write", write_two)
     must_pass(remove_object_files(&two));
 END_TEST
 
-BEGIN_TEST("write", write_some)
+BEGIN_TEST(write6, "write an object which is several bytes long")
     git_odb *db;
     git_oid id1, id2;
     git_rawobj obj;
@@ -227,18 +227,12 @@ BEGIN_TEST("write", write_some)
     must_pass(remove_object_files(&some));
 END_TEST
 
-git_testsuite *libgit2_suite_objwrite(void)
-{
-	git_testsuite *suite = git_testsuite_new("Object Write");
-
-	ADD_TEST(suite, "write", write_commit);
-	ADD_TEST(suite, "write", write_tree);
-	ADD_TEST(suite, "write", write_tag);
-	ADD_TEST(suite, "write", write_zero);
-	ADD_TEST(suite, "write", write_one);
-	ADD_TEST(suite, "write", write_two);
-	ADD_TEST(suite, "write", write_some);
-
-	return suite;
-}
-
+BEGIN_SUITE(objwrite)
+	ADD_TEST(write0);
+	ADD_TEST(write1);
+	ADD_TEST(write2);
+	ADD_TEST(write3);
+	ADD_TEST(write4);
+	ADD_TEST(write5);
+	ADD_TEST(write6);
+END_SUITE
diff --git a/tests/t04-commit.c b/tests/t04-commit.c
index 1e3b45c..8e62759 100644
--- a/tests/t04-commit.c
+++ b/tests/t04-commit.c
@@ -109,7 +109,7 @@ committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
 a simple commit which works\n",
 };
 
-BEGIN_TEST("parse", parse_oid_test)
+BEGIN_TEST(parse0, "parse the OID line in a commit")
 
 	git_oid oid;
 
@@ -151,7 +151,7 @@ BEGIN_TEST("parse", parse_oid_test)
 
 END_TEST
 
-BEGIN_TEST("parse", parse_sig_test)
+BEGIN_TEST(parse1, "parse the signature line in a commit")
 
 #define TEST_SIGNATURE_PASS(_string, _header, _name, _email, _time, _offset) { \
 	char *ptr = _string; \
@@ -285,7 +285,7 @@ END_TEST
 /* External declaration for testing the buffer parsing method */
 int commit_parse_buffer(git_commit *commit, void *data, size_t len, unsigned int parse_flags);
 
-BEGIN_TEST("parse", parse_buffer_test)
+BEGIN_TEST(parse2, "parse a whole commit buffer")
 	const int broken_commit_count = sizeof(test_commits_broken) / sizeof(*test_commits_broken);
 	const int working_commit_count = sizeof(test_commits_working) / sizeof(*test_commits_working);
 
@@ -352,7 +352,7 @@ static const char *commit_ids[] = {
 	"5b5b025afb0b4c913b4c338a42934a3863bf3644", /* 5 */
 };
 
-BEGIN_TEST("details", query_details_test)
+BEGIN_TEST(details0, "query the details on a parsed commit")
 	const size_t commit_count = sizeof(commit_ids) / sizeof(const char *);
 
 	unsigned int i;
@@ -407,7 +407,7 @@ This is a commit created in memory and it will be written back to disk\n"
 
 static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
 
-BEGIN_TEST("write", writenew_test)
+BEGIN_TEST(write0, "write a new commit object from memory to disk")
 	git_repository *repo;
 	git_commit *commit, *parent;
 	git_tree *tree;
@@ -474,7 +474,7 @@ BEGIN_TEST("write", writenew_test)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("write", writeback_test)
+BEGIN_TEST(write1, "load a commit object, modify it and write it back")
 	git_repository *repo;
 	git_oid id;
 	git_commit *commit, *parent;
@@ -504,16 +504,11 @@ BEGIN_TEST("write", writeback_test)
 END_TEST
 
 
-git_testsuite *libgit2_suite_commit(void)
-{
-	git_testsuite *suite = git_testsuite_new("Commit");
-
-	ADD_TEST(suite, "parse", parse_oid_test);
-	ADD_TEST(suite, "parse", parse_sig_test);
-	ADD_TEST(suite, "parse", parse_buffer_test);
-	ADD_TEST(suite, "details", query_details_test);
-	ADD_TEST(suite, "write", writenew_test);
-	ADD_TEST(suite, "write", writeback_test);
-
-	return suite;
-}
+BEGIN_SUITE(commit)
+	ADD_TEST(parse0);
+	ADD_TEST(parse1);
+	ADD_TEST(parse2);
+	ADD_TEST(details0);
+	ADD_TEST(write0);
+	ADD_TEST(write1);
+END_SUITE
diff --git a/tests/t05-revwalk.c b/tests/t05-revwalk.c
index 473ea33..fd009fa 100644
--- a/tests/t05-revwalk.c
+++ b/tests/t05-revwalk.c
@@ -110,7 +110,7 @@ static int test_walk(git_revwalk *walk, git_commit *start_from,
 	return GIT_ERROR;
 }
 
-BEGIN_TEST("walk", simple_walk_test)
+BEGIN_TEST(walk0, "do a simple walk on a repo with different sorting modes")
 	git_oid id;
 	git_repository *repo;
 	git_revwalk *walk;
@@ -145,7 +145,7 @@ BEGIN_TEST("walk", simple_walk_test)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("list", list_timesort_test)
+BEGIN_TEST(list0, "check that a commit list is properly sorted by time")
 
 	git_revwalk_list list;
 	git_revwalk_listnode *n;
@@ -210,12 +210,7 @@ BEGIN_TEST("list", list_timesort_test)
 
 END_TEST
 
-git_testsuite *libgit2_suite_revwalk(void)
-{
-	git_testsuite *suite = git_testsuite_new("Revwalk");
-
-	ADD_TEST(suite, "walk", simple_walk_test);
-	ADD_TEST(suite, "list", list_timesort_test);
-
-	return suite;
-}
+BEGIN_SUITE(revwalk)
+	ADD_TEST(walk0);
+	ADD_TEST(list0);
+END_SUITE
diff --git a/tests/t06-index.c b/tests/t06-index.c
index ded2370..0c748cc 100644
--- a/tests/t06-index.c
+++ b/tests/t06-index.c
@@ -45,7 +45,7 @@ struct test_entry TEST_ENTRIES[] = {
 	{48, "src/revobject.h", 1448, 0x4C3F7FE2}
 };
 
-BEGIN_TEST("read", index_loadempty_test)
+BEGIN_TEST(read0, "load an empty index")
 	git_index *index;
 
 	must_pass(git_index_open_bare(&index, "in-memory-index"));
@@ -60,7 +60,7 @@ BEGIN_TEST("read", index_loadempty_test)
 	git_index_free(index);
 END_TEST
 
-BEGIN_TEST("read", index_load_test)
+BEGIN_TEST(read1, "load a standard index (default test index)")
 	git_index *index;
 	unsigned int i;
 	git_index_entry **entries;
@@ -87,7 +87,7 @@ BEGIN_TEST("read", index_load_test)
 	git_index_free(index);
 END_TEST
 
-BEGIN_TEST("read", index2_load_test)
+BEGIN_TEST(read2, "load a standard index (git.git index)")
 	git_index *index;
 
 	must_pass(git_index_open_bare(&index, TEST_INDEX2_PATH));
@@ -103,7 +103,7 @@ BEGIN_TEST("read", index2_load_test)
 	git_index_free(index);
 END_TEST
 
-BEGIN_TEST("read", index_find_test)
+BEGIN_TEST(find0, "find an entry on an index")
 	git_index *index;
 	unsigned int i;
 
@@ -118,7 +118,7 @@ BEGIN_TEST("read", index_find_test)
 	git_index_free(index);
 END_TEST
 
-BEGIN_TEST("read", index_findempty_test)
+BEGIN_TEST(find1, "find an entry in an empty index")
 	git_index *index;
 	unsigned int i;
 
@@ -132,7 +132,7 @@ BEGIN_TEST("read", index_findempty_test)
 	git_index_free(index);
 END_TEST
 
-BEGIN_TEST("write", index_write_test)
+BEGIN_TEST(write0, "write an index back to disk")
 	git_index *index;
 
 	must_pass(copy_file(TEST_INDEXBIG_PATH, "index_rewrite"));
@@ -149,7 +149,7 @@ BEGIN_TEST("write", index_write_test)
 	gitfo_unlink("index_rewrite");
 END_TEST
 
-BEGIN_TEST("sort", index_sort_test)
+BEGIN_TEST(sort0, "sort the entires in an index")
 	/*
 	 * TODO: This no longer applies:
 	 * index sorting in Git uses some specific changes to the way
@@ -162,7 +162,7 @@ BEGIN_TEST("sort", index_sort_test)
 END_TEST
 
 
-BEGIN_TEST("sort", index_sort_empty_test)
+BEGIN_TEST(sort1, "sort the entires in an empty index")
 	git_index *index;
 
 	must_pass(git_index_open_bare(&index, "fake-index"));
@@ -173,19 +173,16 @@ BEGIN_TEST("sort", index_sort_empty_test)
 	git_index_free(index);
 END_TEST
 
+BEGIN_SUITE(index)
+	ADD_TEST(read0);
+	ADD_TEST(read1);
+	ADD_TEST(read2);
 
-git_testsuite *libgit2_suite_index(void)
-{
-	git_testsuite *suite = git_testsuite_new("Index");
+	ADD_TEST(find0);
+	ADD_TEST(find1);
 
-	ADD_TEST(suite, "read", index_loadempty_test);
-	ADD_TEST(suite, "read", index_load_test);
-	ADD_TEST(suite, "read", index2_load_test);
-	ADD_TEST(suite, "read", index_find_test);
-	ADD_TEST(suite, "read", index_findempty_test);
-	ADD_TEST(suite, "write", index_write_test);
-	ADD_TEST(suite, "sort", index_sort_test);
-	ADD_TEST(suite, "sort", index_sort_empty_test);
+	ADD_TEST(write0);
 
-	return suite;
-}
+	ADD_TEST(sort0);
+	ADD_TEST(sort1);
+END_SUITE
diff --git a/tests/t07-hashtable.c b/tests/t07-hashtable.c
index 76eb0d1..5971369 100644
--- a/tests/t07-hashtable.c
+++ b/tests/t07-hashtable.c
@@ -49,7 +49,7 @@ int hash_cmpkey(const void *a, const void *b)
 	return git_oid_cmp(a, b);
 }
 
-BEGIN_TEST("table", table_create)
+BEGIN_TEST(table0, "create a new hashtable")
 
 	git_hashtable *table = NULL;
 
@@ -61,7 +61,7 @@ BEGIN_TEST("table", table_create)
 
 END_TEST
 
-BEGIN_TEST("table", table_populate)
+BEGIN_TEST(table1, "fill the hashtable with random entries")
 
 	const int objects_n = 32;
 	int i;
@@ -109,7 +109,7 @@ BEGIN_TEST("table", table_populate)
 END_TEST
 
 
-BEGIN_TEST("table", table_resize)
+BEGIN_TEST(table2, "make sure the table resizes automatically")
 
 	const int objects_n = 64;
 	int i;
@@ -150,7 +150,7 @@ BEGIN_TEST("table", table_resize)
 
 END_TEST
 
-BEGIN_TEST("tableit", table_iterator)
+BEGIN_TEST(tableit0, "iterate through all the contents of the table")
 
 	const int objects_n = 32;
 	int i;
@@ -184,14 +184,10 @@ BEGIN_TEST("tableit", table_iterator)
 END_TEST
 
 
-git_testsuite *libgit2_suite_hashtable(void)
-{
-	git_testsuite *suite = git_testsuite_new("Hashtable");
-
-	ADD_TEST(suite, "table", table_create);
-	ADD_TEST(suite, "table", table_populate);
-	ADD_TEST(suite, "table", table_resize);
-	ADD_TEST(suite, "tableit", table_iterator);
+BEGIN_SUITE(hashtable)
+	ADD_TEST(table0);
+	ADD_TEST(table1);
+	ADD_TEST(table2);
+	ADD_TEST(tableit0);
+END_SUITE
 
-	return suite;
-}
diff --git a/tests/t08-tag.c b/tests/t08-tag.c
index 1b7c5fa..0afdf71 100644
--- a/tests/t08-tag.c
+++ b/tests/t08-tag.c
@@ -31,7 +31,7 @@ static const char *tag1_id = "b25fa35b38051e4ae45d4222e795f9df2e43f1d1";
 static const char *tag2_id = "7b4384978d2493e851f9cca7858815fac9b10980";
 static const char *tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
 
-BEGIN_TEST("readtag", readtag)
+BEGIN_TEST(read0, "read and parse a tag from the repository")
 	git_repository *repo;
 	git_tag *tag1, *tag2;
 	git_commit *commit;
@@ -61,7 +61,7 @@ BEGIN_TEST("readtag", readtag)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("write", tag_writeback_test)
+BEGIN_TEST(write0, "write back a tag to the repository")
 	git_oid id;
 	git_repository *repo;
 	git_tag *tag;
@@ -81,12 +81,7 @@ BEGIN_TEST("write", tag_writeback_test)
 END_TEST
 
 
-git_testsuite *libgit2_suite_tag(void)
-{
-	git_testsuite *suite = git_testsuite_new("Tag");
-
-	ADD_TEST(suite, "readtag", readtag);
-	ADD_TEST(suite, "write", tag_writeback_test);
-
-	return suite;
-}
+BEGIN_SUITE(tag)
+	ADD_TEST(read0);
+	ADD_TEST(write0);
+END_SUITE
diff --git a/tests/t09-tree.c b/tests/t09-tree.c
index 8c0b5b0..cb12755 100644
--- a/tests/t09-tree.c
+++ b/tests/t09-tree.c
@@ -29,7 +29,7 @@
 
 static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
 
-BEGIN_TEST("readtree", tree_entry_access_test)
+BEGIN_TEST(read0, "acces randomly the entries on a loaded tree")
 	git_oid id;
 	git_repository *repo;
 	git_tree *tree;
@@ -51,7 +51,7 @@ BEGIN_TEST("readtree", tree_entry_access_test)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("readtree", tree_read_test)
+BEGIN_TEST(read1, "read a tree from the repository")
 	git_oid id;
 	git_repository *repo;
 	git_tree *tree;
@@ -76,7 +76,7 @@ BEGIN_TEST("readtree", tree_read_test)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("modify", tree_in_memory_add_test)
+BEGIN_TEST(write0, "add a new entry to a tree and write it back to disk")
 	const unsigned int entry_count = 128;
 
 	git_repository *repo;
@@ -106,7 +106,7 @@ BEGIN_TEST("modify", tree_in_memory_add_test)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("modify", tree_add_entry_test)
+BEGIN_TEST(write1, "add several entries in-memory and validate that they exist; write back to disk")
 	git_oid id;
 	git_repository *repo;
 	git_tree *tree;
@@ -157,14 +157,10 @@ BEGIN_TEST("modify", tree_add_entry_test)
 END_TEST
 
 
-git_testsuite *libgit2_suite_tree(void)
-{
-	git_testsuite *suite = git_testsuite_new("Tree");
+BEGIN_SUITE(tree)
+	ADD_TEST(read0);
+	ADD_TEST(read1);
+	ADD_TEST(write0);
+	ADD_TEST(write1);
+END_SUITE
 
-	ADD_TEST(suite, "readtree", tree_entry_access_test);
-	ADD_TEST(suite, "readtree", tree_read_test);
-	ADD_TEST(suite, "modify", tree_in_memory_add_test);
-	ADD_TEST(suite, "modify", tree_add_entry_test);
-
-	return suite;
-}
diff --git a/tests/t10-refs.c b/tests/t10-refs.c
index 2915c7a..225b4e0 100644
--- a/tests/t10-refs.c
+++ b/tests/t10-refs.c
@@ -30,7 +30,7 @@
 static const char *loose_tag_ref_name = "refs/tags/test";
 static const char *non_existing_tag_ref_name = "refs/tags/i-do-not-exist";
 
-BEGIN_TEST("readtag", loose_tag_reference_looking_up)
+BEGIN_TEST(readtag0, "lookup a loose tag reference")
 	git_repository *repo;
 	git_reference *reference;
 	git_object *object;
@@ -49,7 +49,7 @@ BEGIN_TEST("readtag", loose_tag_reference_looking_up)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("readtag", non_existing_tag_reference_looking_up)
+BEGIN_TEST(readtag1, "lookup a loose tag reference that doesn't exist")
 	git_repository *repo;
 	git_reference *reference;
 
@@ -63,7 +63,7 @@ static const char *head_tracker_sym_ref_name = "head-tracker";
 static const char *current_head_target = "refs/heads/master";
 static const char *current_master_tip = "be3563ae3f795b2b4353bcce3a527ad0a4f7f644";
 
-BEGIN_TEST("readsymref", symbolic_reference_looking_up)
+BEGIN_TEST(readsym0, "lookup a symbolic reference")
 	git_repository *repo;
 	git_reference *reference, *resolved_ref;
 	git_object *object;
@@ -89,7 +89,7 @@ BEGIN_TEST("readsymref", symbolic_reference_looking_up)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("readsymref", nested_symbolic_reference_looking_up)
+BEGIN_TEST(readsym1, "lookup a nested symbolic reference")
 	git_repository *repo;
 	git_reference *reference, *resolved_ref;
 	git_object *object;
@@ -115,7 +115,7 @@ BEGIN_TEST("readsymref", nested_symbolic_reference_looking_up)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("readsymref", looking_up_head_then_master)
+BEGIN_TEST(readsym2, "lookup the HEAD and resolve the master branch")
 	git_repository *repo;
 	git_reference *reference, *resolved_ref, *comp_base_ref;
 
@@ -136,7 +136,7 @@ BEGIN_TEST("readsymref", looking_up_head_then_master)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("readsymref", looking_up_master_then_head)
+BEGIN_TEST(readsym3, "lookup the master branch and then the HEAD")
 	git_repository *repo;
 	git_reference *reference, *master_ref, *resolved_ref;
 
@@ -154,7 +154,7 @@ END_TEST
 static const char *packed_head_name = "refs/heads/packed";
 static const char *packed_test_head_name = "refs/heads/packed-test";
 
-BEGIN_TEST("readpackedref", packed_reference_looking_up)
+BEGIN_TEST(readpacked0, "lookup a packed reference")
 	git_repository *repo;
 	git_reference *reference;
 	git_object *object;
@@ -173,7 +173,7 @@ BEGIN_TEST("readpackedref", packed_reference_looking_up)
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("readpackedref", packed_exists_but_more_recent_loose_reference_is_retrieved)
+BEGIN_TEST(readpacked1, "assure that a loose reference is looked up before a packed reference")
 	git_repository *repo;
 	git_reference *reference;
 
@@ -187,7 +187,7 @@ BEGIN_TEST("readpackedref", packed_exists_but_more_recent_loose_reference_is_ret
 	git_repository_free(repo);
 END_TEST
 
-BEGIN_TEST("createref", create_new_symbolic_ref)
+BEGIN_TEST(create0, "create a new symbolic reference")
 	git_reference *new_reference, *looked_up_ref, *resolved_ref;
 	git_repository *repo;
 	git_oid id;
@@ -232,7 +232,7 @@ BEGIN_TEST("createref", create_new_symbolic_ref)
 	must_pass(gitfo_unlink(ref_path));	/* TODO: replace with git_reference_delete() when available */
 END_TEST
 
-BEGIN_TEST("createref", create_deep_symbolic_ref)
+BEGIN_TEST(create1, "create a deep symbolic reference")
 	git_reference *new_reference, *looked_up_ref, *resolved_ref;
 	git_repository *repo;
 	git_oid id;
@@ -255,7 +255,7 @@ BEGIN_TEST("createref", create_deep_symbolic_ref)
 	must_pass(gitfo_unlink(ref_path));	/* TODO: replace with git_reference_delete() when available */
 END_TEST
 
-BEGIN_TEST("createref", create_new_object_id_ref)
+BEGIN_TEST(create2, "create a new OID reference")
 	git_reference *new_reference, *looked_up_ref;
 	git_repository *repo;
 	git_oid id;
@@ -295,37 +295,27 @@ BEGIN_TEST("createref", create_new_object_id_ref)
 	must_pass(gitfo_unlink(ref_path));	/* TODO: replace with git_reference_delete() when available */
 END_TEST
 
-BEGIN_TEST("packrefs", create_packfile_with_empty_folder)
+BEGIN_TEST(pack0, "create a packfile for an empty folder")
 	git_repository *repo;
-	git_reference *reference;
 	char temp_path[GIT_PATH_MAX];
-	int path_len = 0;
 	const int mode = 0755; /* or 0777 ? */
 
-	must_pass(copydir_recurs(REPOSITORY_FOLDER, TEMP_DIR));
-
-	git__joinpath(temp_path, TEMP_DIR, TEST_REPOSITORY_NAME);
-	must_pass(git_repository_open(&repo, temp_path));
+	must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
 	
 	git__joinpath_n(temp_path, 3, repo->path_repository, GIT_REFS_HEADS_DIR, "empty_dir");
 	must_pass(gitfo_mkdir_recurs(temp_path, mode));
 
 	must_pass(git_reference_packall(repo));
 
-	git_repository_free(repo);
-	must_pass(rmdir_recurs(TEMP_DIR));
+	close_temp_repo(repo);
 END_TEST
 
-BEGIN_TEST("packrefs", create_packfile)
+BEGIN_TEST(pack1, "create a packfile from all the loose rn a repo")
 	git_repository *repo;
 	git_reference *reference;
 	char temp_path[GIT_PATH_MAX];
-	int path_len = 0;
 
-	must_pass(copydir_recurs(REPOSITORY_FOLDER, TEMP_DIR));
-
-	git__joinpath(temp_path, TEMP_DIR, TEST_REPOSITORY_NAME);
-	must_pass(git_repository_open(&repo, temp_path));
+	must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
 	
 	/* Ensure a known loose ref can be looked up */
 	must_pass(git_repository_lookup_ref(&reference, repo, loose_tag_ref_name));
@@ -347,20 +337,16 @@ BEGIN_TEST("packrefs", create_packfile)
 	git__joinpath(temp_path, repo->path_repository, loose_tag_ref_name);
 	must_pass(!gitfo_exists(temp_path));
 
-	git_repository_free(repo);
-	must_pass(rmdir_recurs(TEMP_DIR));
+	close_temp_repo(repo);
 END_TEST
 
-BEGIN_TEST("renameref", rename_a_loose_reference)
+BEGIN_TEST(rename0, "rename a loose reference")
 	git_reference *looked_up_ref, *another_looked_up_ref;
 	git_repository *repo;
 	char temp_path[GIT_PATH_MAX];
 	const char *new_name = "refs/tags/Nemo/knows/refs.kung-fu";
 
-	must_pass(copydir_recurs(REPOSITORY_FOLDER, TEMP_DIR));
-
-	git__joinpath(temp_path, TEMP_DIR, TEST_REPOSITORY_NAME);
-	must_pass(git_repository_open(&repo, temp_path));
+	must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
 
 	/* Ensure the ref doesn't exist on the file system */
 	git__joinpath(temp_path, repo->path_repository, new_name);
@@ -391,21 +377,16 @@ BEGIN_TEST("renameref", rename_a_loose_reference)
 	git__joinpath(temp_path, repo->path_repository, new_name);
 	must_pass(gitfo_exists(temp_path));
 
-	git_repository_free(repo);
-
-	must_pass(rmdir_recurs(TEMP_DIR));
+	close_temp_repo(repo);
 END_TEST
 
-BEGIN_TEST("renameref", renaming_a_packed_reference_makes_it_loose)
+BEGIN_TEST(rename1, "rename a packed reference (should make it loose)")
 	git_reference *looked_up_ref, *another_looked_up_ref;
 	git_repository *repo;
 	char temp_path[GIT_PATH_MAX];
 	const char *brand_new_name = "refs/heads/brand_new_name";
 
-	must_pass(copydir_recurs(REPOSITORY_FOLDER, TEMP_DIR));
-
-	git__joinpath(temp_path, TEMP_DIR, TEST_REPOSITORY_NAME);
-	must_pass(git_repository_open(&repo, temp_path));
+	must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
 
 	/* Ensure the ref doesn't exist on the file system */
 	git__joinpath(temp_path, repo->path_repository, packed_head_name);
@@ -436,21 +417,16 @@ BEGIN_TEST("renameref", renaming_a_packed_reference_makes_it_loose)
 	git__joinpath(temp_path, repo->path_repository, brand_new_name);
 	must_pass(gitfo_exists(temp_path));
 
-	git_repository_free(repo);
-
-	must_pass(rmdir_recurs(TEMP_DIR));
+	close_temp_repo(repo);
 END_TEST
 
-BEGIN_TEST("renameref", renaming_a_packed_reference_does_not_pack_another_reference_which_happens_to_be_in_both_loose_and_pack_state)
+BEGIN_TEST(rename2, "renaming a packed reference does not pack another reference which happens to be in both loose and pack state")
 	git_reference *looked_up_ref, *another_looked_up_ref;
 	git_repository *repo;
 	char temp_path[GIT_PATH_MAX];
 	const char *brand_new_name = "refs/heads/brand_new_name";
 
-	must_pass(copydir_recurs(REPOSITORY_FOLDER, TEMP_DIR));
-
-	git__joinpath(temp_path, TEMP_DIR, TEST_REPOSITORY_NAME);
-	must_pass(git_repository_open(&repo, temp_path));
+	must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
 
 	/* Ensure the other reference exists on the file system */
 	git__joinpath(temp_path, repo->path_repository, packed_test_head_name);
@@ -480,16 +456,14 @@ BEGIN_TEST("renameref", renaming_a_packed_reference_does_not_pack_another_refere
 	/* Ensure the other ref still exists on the file system */
 	must_pass(gitfo_exists(temp_path));
 
-	git_repository_free(repo);
-
-	must_pass(rmdir_recurs(TEMP_DIR));
+	close_temp_repo(repo);
 END_TEST
 
-BEGIN_TEST("renameref", can_not_rename_a_reference_with_the_name_of_an_existing_reference)
+BEGIN_TEST(rename3, "can not rename a reference with the name of an existing reference")
 	git_reference *looked_up_ref;
 	git_repository *repo;
 
-	must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
+	must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
 
 	/* An existing reference... */
 	must_pass(git_repository_lookup_ref(&looked_up_ref, repo, packed_head_name));
@@ -501,14 +475,14 @@ BEGIN_TEST("renameref", can_not_rename_a_reference_with_the_name_of_an_existing_
 	must_pass(git_repository_lookup_ref(&looked_up_ref, repo, packed_head_name));
 	must_be_true(!strcmp(looked_up_ref->name, packed_head_name));
 
-	git_repository_free(repo);
+	close_temp_repo(repo);
 END_TEST
 
-BEGIN_TEST("renameref", can_not_rename_a_reference_with_an_invalid_name)
+BEGIN_TEST(rename4, "can not rename a reference with an invalid name")
 	git_reference *looked_up_ref;
 	git_repository *repo;
 
-	must_pass(git_repository_open(&repo, REPOSITORY_FOLDER));
+	must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
 
 	/* An existing oid reference... */
 	must_pass(git_repository_lookup_ref(&looked_up_ref, repo, packed_test_head_name));
@@ -523,18 +497,15 @@ BEGIN_TEST("renameref", can_not_rename_a_reference_with_an_invalid_name)
 	must_pass(git_repository_lookup_ref(&looked_up_ref, repo, packed_test_head_name));
 	must_be_true(!strcmp(looked_up_ref->name, packed_test_head_name));
 
-	git_repository_free(repo);
+	close_temp_repo(repo);
 END_TEST
 
-BEGIN_TEST("deleteref", deleting_a_ref_which_is_both_packed_and_loose_should_remove_both_tracks_in_the_filesystem)
+BEGIN_TEST(delete0, "deleting a ref which is both packed and loose should remove both tracks in the filesystem")
 	git_reference *looked_up_ref, *another_looked_up_ref;
 	git_repository *repo;
 	char temp_path[GIT_PATH_MAX];
 
-	must_pass(copydir_recurs(REPOSITORY_FOLDER, TEMP_DIR));
-
-	git__joinpath(temp_path, TEMP_DIR, TEST_REPOSITORY_NAME);
-	must_pass(git_repository_open(&repo, temp_path));
+	must_pass(open_temp_repo(&repo, REPOSITORY_FOLDER));
 
 	/* Ensure the loose reference exists on the file system */
 	git__joinpath(temp_path, repo->path_repository, packed_test_head_name);
@@ -555,9 +526,7 @@ BEGIN_TEST("deleteref", deleting_a_ref_which_is_both_packed_and_loose_should_rem
 	/* Ensure the loose reference doesn't exist any longer on the file system */
 	must_pass(!gitfo_exists(temp_path));
 
-	git_repository_free(repo);
-
-	must_pass(rmdir_recurs(TEMP_DIR));
+	close_temp_repo(repo);
 END_TEST
 
 static int ensure_refname_normalized(int is_oid_ref, const char *input_refname, const char *expected_refname)
@@ -585,7 +554,7 @@ static int ensure_refname_normalized(int is_oid_ref, const char *input_refname, 
 #define OID_REF 1
 #define SYM_REF 0
 
-BEGIN_TEST("normalizeref", normalize_object_id_ref)
+BEGIN_TEST(normalize0, "normalize a direct (OID) reference name")
 	must_fail(ensure_refname_normalized(OID_REF, "a", NULL));
 	must_fail(ensure_refname_normalized(OID_REF, "", NULL));
 	must_fail(ensure_refname_normalized(OID_REF, "refs/heads/a/", NULL));
@@ -606,7 +575,7 @@ BEGIN_TEST("normalizeref", normalize_object_id_ref)
 	must_fail(ensure_refname_normalized(OID_REF, "refs/heads/v@{ation", NULL));
 END_TEST
 
-BEGIN_TEST("normalizeref", normalize_symbolic_ref)
+BEGIN_TEST(normalize1, "normalize a symbolic reference name")
 	must_pass(ensure_refname_normalized(SYM_REF, "a", "a"));
 	must_pass(ensure_refname_normalized(SYM_REF, "a/b", "a/b"));
 	must_pass(ensure_refname_normalized(SYM_REF, "refs///heads///a", "refs/heads/a"));
@@ -614,158 +583,162 @@ BEGIN_TEST("normalizeref", normalize_symbolic_ref)
 	must_fail(ensure_refname_normalized(SYM_REF, "heads\foo", NULL));
 END_TEST
 
-/* Ported from JGit, BSD licence. See https://github.com/spearce/JGit/commit/e4bf8f6957bbb29362575d641d1e77a02d906739 */
-BEGIN_TEST("normalizeref", jgit_tests)
-
-		/* EmptyString */
-			must_fail(ensure_refname_normalized(SYM_REF, "", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "/", NULL));
-
-		/* MustHaveTwoComponents */
-			must_fail(ensure_refname_normalized(OID_REF, "master", NULL));
-			must_pass(ensure_refname_normalized(SYM_REF, "heads/master", "heads/master"));
-
-		/* ValidHead */
-
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/master", "refs/heads/master"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/pu", "refs/heads/pu"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/z", "refs/heads/z"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/FoO", "refs/heads/FoO"));
-
-		/* ValidTag */
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/tags/v1.0", "refs/tags/v1.0"));
-
-		/* NoLockSuffix */
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master.lock", NULL));
-
-		/* NoDirectorySuffix */
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master/", NULL));
-
-		/* NoSpace */
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/i haz space", NULL));
-
-		/* NoAsciiControlCharacters */
-			{
-				char c;
-				char buffer[MAX_GITDIR_TREE_STRUCTURE_PATH_LENGTH];
-				for (c = '\1'; c < ' '; c++) {
-					strncpy(buffer, "refs/heads/mast", 15);
-					strncpy(buffer + 15, (const char *)&c, 1);
-					strncpy(buffer + 16, "er", 2);
-					buffer[18 - 1] = '\0';
-					must_fail(ensure_refname_normalized(SYM_REF, buffer, NULL));
-				}
-			}
-
-		/* NoBareDot */
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/.", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/..", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/./master", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/../master", NULL));
-
-		/* NoLeadingOrTrailingDot */
-			must_fail(ensure_refname_normalized(SYM_REF, ".", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/.bar", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/..bar", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/bar.", NULL));
-
-		/* ContainsDot */
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/m.a.s.t.e.r", "refs/heads/m.a.s.t.e.r"));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master..pu", NULL));
-
-		/* NoMagicRefCharacters */
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master^", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/^master", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "^refs/heads/master", NULL));
-
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master~", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/~master", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "~refs/heads/master", NULL));
-
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master:", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/:master", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, ":refs/heads/master", NULL));
-
-		/* ShellGlob */
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master?", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/?master", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "?refs/heads/master", NULL));
-
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master[", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/[master", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "[refs/heads/master", NULL));
-
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master*", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/*master", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "*refs/heads/master", NULL));
-
-		/* ValidSpecialCharacters */
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/!", "refs/heads/!"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/\"", "refs/heads/\""));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/#", "refs/heads/#"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/$", "refs/heads/$"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/%", "refs/heads/%"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/&", "refs/heads/&"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/'", "refs/heads/'"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/(", "refs/heads/("));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/)", "refs/heads/)"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/+", "refs/heads/+"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/,", "refs/heads/,"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/-", "refs/heads/-"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/;", "refs/heads/;"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/<", "refs/heads/<"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/=", "refs/heads/="));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/>", "refs/heads/>"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/@", "refs/heads/@"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/]", "refs/heads/]"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/_", "refs/heads/_"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/`", "refs/heads/`"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/{", "refs/heads/{"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/|", "refs/heads/|"));
-			must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/}", "refs/heads/}"));
-
-			// This is valid on UNIX, but not on Windows
-			// hence we make in invalid due to non-portability
-			//
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/\\", NULL));
-
-		/* UnicodeNames */
-			/*
-			 * Currently this fails.
-			 * must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/\u00e5ngstr\u00f6m", "refs/heads/\u00e5ngstr\u00f6m"));
-			 */
-
-		/* RefLogQueryIsValidRef */
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master@{1}", NULL));
-			must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master@{1.hour.ago}", NULL));
+/* Ported from JGit, BSD licence.
+ * See https://github.com/spearce/JGit/commit/e4bf8f6957bbb29362575d641d1e77a02d906739 */
+BEGIN_TEST(normalize2, "tests borrowed from JGit")
+
+/* EmptyString */
+	must_fail(ensure_refname_normalized(SYM_REF, "", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "/", NULL));
+
+/* MustHaveTwoComponents */
+	must_fail(ensure_refname_normalized(OID_REF, "master", NULL));
+	must_pass(ensure_refname_normalized(SYM_REF, "heads/master", "heads/master"));
+
+/* ValidHead */
+
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/master", "refs/heads/master"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/pu", "refs/heads/pu"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/z", "refs/heads/z"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/FoO", "refs/heads/FoO"));
+
+/* ValidTag */
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/tags/v1.0", "refs/tags/v1.0"));
+
+/* NoLockSuffix */
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master.lock", NULL));
+
+/* NoDirectorySuffix */
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master/", NULL));
+
+/* NoSpace */
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/i haz space", NULL));
+
+/* NoAsciiControlCharacters */
+	{
+		char c;
+		char buffer[MAX_GITDIR_TREE_STRUCTURE_PATH_LENGTH];
+		for (c = '\1'; c < ' '; c++) {
+			strncpy(buffer, "refs/heads/mast", 15);
+			strncpy(buffer + 15, (const char *)&c, 1);
+			strncpy(buffer + 16, "er", 2);
+			buffer[18 - 1] = '\0';
+			must_fail(ensure_refname_normalized(SYM_REF, buffer, NULL));
+		}
+	}
+
+/* NoBareDot */
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/.", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/..", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/./master", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/../master", NULL));
+
+/* NoLeadingOrTrailingDot */
+	must_fail(ensure_refname_normalized(SYM_REF, ".", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/.bar", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/..bar", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/bar.", NULL));
+
+/* ContainsDot */
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/m.a.s.t.e.r", "refs/heads/m.a.s.t.e.r"));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master..pu", NULL));
+
+/* NoMagicRefCharacters */
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master^", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/^master", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "^refs/heads/master", NULL));
+
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master~", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/~master", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "~refs/heads/master", NULL));
+
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master:", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/:master", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, ":refs/heads/master", NULL));
+
+/* ShellGlob */
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master?", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/?master", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "?refs/heads/master", NULL));
+
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master[", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/[master", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "[refs/heads/master", NULL));
+
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master*", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/*master", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "*refs/heads/master", NULL));
+
+/* ValidSpecialCharacters */
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/!", "refs/heads/!"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/\"", "refs/heads/\""));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/#", "refs/heads/#"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/$", "refs/heads/$"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/%", "refs/heads/%"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/&", "refs/heads/&"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/'", "refs/heads/'"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/(", "refs/heads/("));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/)", "refs/heads/)"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/+", "refs/heads/+"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/,", "refs/heads/,"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/-", "refs/heads/-"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/;", "refs/heads/;"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/<", "refs/heads/<"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/=", "refs/heads/="));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/>", "refs/heads/>"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/@", "refs/heads/@"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/]", "refs/heads/]"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/_", "refs/heads/_"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/`", "refs/heads/`"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/{", "refs/heads/{"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/|", "refs/heads/|"));
+	must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/}", "refs/heads/}"));
+
+	// This is valid on UNIX, but not on Windows
+	// hence we make in invalid due to non-portability
+	//
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/\\", NULL));
+
+/* UnicodeNames */
+	/*
+	 * Currently this fails.
+	 * must_pass(ensure_refname_normalized(SYM_REF, "refs/heads/\u00e5ngstr\u00f6m", "refs/heads/\u00e5ngstr\u00f6m"));
+	 */
+
+/* RefLogQueryIsValidRef */
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master@{1}", NULL));
+	must_fail(ensure_refname_normalized(SYM_REF, "refs/heads/master@{1.hour.ago}", NULL));
 END_TEST
 
-git_testsuite *libgit2_suite_refs(void)
-{
-	git_testsuite *suite = git_testsuite_new("References");
-
-	ADD_TEST(suite, "readtag", loose_tag_reference_looking_up);
-	ADD_TEST(suite, "readtag", non_existing_tag_reference_looking_up);
-	ADD_TEST(suite, "readsymref", symbolic_reference_looking_up);
-	ADD_TEST(suite, "readsymref", nested_symbolic_reference_looking_up);
-	ADD_TEST(suite, "readsymref", looking_up_head_then_master);
-	ADD_TEST(suite, "readsymref", looking_up_master_then_head);
-	ADD_TEST(suite, "readpackedref", packed_reference_looking_up);
-	ADD_TEST(suite, "readpackedref", packed_exists_but_more_recent_loose_reference_is_retrieved);
-	ADD_TEST(suite, "createref", create_new_symbolic_ref);
-	ADD_TEST(suite, "createref", create_deep_symbolic_ref);
-	ADD_TEST(suite, "createref", create_new_object_id_ref);
-	ADD_TEST(suite, "normalizeref", normalize_object_id_ref);
-	ADD_TEST(suite, "normalizeref", normalize_symbolic_ref);
-	ADD_TEST(suite, "normalizeref", jgit_tests);
-	ADD_TEST(suite, "packrefs", create_packfile_with_empty_folder);
-	ADD_TEST(suite, "packrefs", create_packfile);
-	ADD_TEST(suite, "renameref", renaming_a_packed_reference_makes_it_loose);
-	ADD_TEST(suite, "renameref", renaming_a_packed_reference_does_not_pack_another_reference_which_happens_to_be_in_both_loose_and_pack_state);
-	ADD_TEST(suite, "renameref", rename_a_loose_reference);
-	ADD_TEST(suite, "renameref", can_not_rename_a_reference_with_the_name_of_an_existing_reference);
-	ADD_TEST(suite, "renameref", can_not_rename_a_reference_with_an_invalid_name);
-	ADD_TEST(suite, "deleteref", deleting_a_ref_which_is_both_packed_and_loose_should_remove_both_tracks_in_the_filesystem);
-
-	return suite;
-}
+
+BEGIN_SUITE(refs)
+	ADD_TEST(readtag0);
+	ADD_TEST(readtag1);
+
+	ADD_TEST(readsym0);
+	ADD_TEST(readsym1);
+	ADD_TEST(readsym2);
+	ADD_TEST(readsym3);
+
+	ADD_TEST(readpacked0);
+	ADD_TEST(readpacked1);
+
+	ADD_TEST(create0);
+	ADD_TEST(create1);
+	ADD_TEST(create2);
+
+	ADD_TEST(normalize0);
+	ADD_TEST(normalize1);
+	ADD_TEST(normalize2);
+
+	ADD_TEST(pack0);
+	ADD_TEST(pack1);
+
+	ADD_TEST(rename0);
+	ADD_TEST(rename1);
+	ADD_TEST(rename2);
+	ADD_TEST(rename3);
+	ADD_TEST(rename4);
+
+	ADD_TEST(delete0);
+END_SUITE
diff --git a/tests/t11-sqlite.c b/tests/t11-sqlite.c
index 9b8cc6b..9e9d1b7 100644
--- a/tests/t11-sqlite.c
+++ b/tests/t11-sqlite.c
@@ -75,49 +75,43 @@ static git_odb *open_sqlite_odb(void)
     git_odb_close(db); \
 }
 
-BEGIN_TEST("sqlite", sql_write_commit)
+BEGIN_TEST(sqlite0, "write a commit, read it back (sqlite backend)")
 	TEST_WRITE(commit);
 END_TEST
 
-BEGIN_TEST("sqlite", sql_write_tree)
+BEGIN_TEST(sqlite1, "write a tree, read it back (sqlite backend)")
 	TEST_WRITE(tree);
 END_TEST
 
-BEGIN_TEST("sqlite", sql_write_tag)
+BEGIN_TEST(sqlite2, "write a tag, read it back (sqlite backend)")
 	TEST_WRITE(tag);
 END_TEST
 
-BEGIN_TEST("sqlite", sql_write_zero)
+BEGIN_TEST(sqlite3, "write a zero-byte entry, read it back (sqlite backend)")
 	TEST_WRITE(zero);
 END_TEST
 
-BEGIN_TEST("sqlite", sql_write_one)
+BEGIN_TEST(sqlite4, "write a one-byte entry, read it back (sqlite backend)")
 	TEST_WRITE(one);
 END_TEST
 
-BEGIN_TEST("sqlite", sql_write_two)
+BEGIN_TEST(sqlite5, "write a two-byte entry, read it back (sqlite backend)")
 	TEST_WRITE(two);
 END_TEST
 
-BEGIN_TEST("sqlite", sql_write_some)
+BEGIN_TEST(sqlite6, "write some bytes in an entry, read it back (sqlite backend)")
 	TEST_WRITE(some);
 END_TEST
 
 
-git_testsuite *libgit2_suite_sqlite(void)
-{
-	git_testsuite *suite = git_testsuite_new("SQLite Backend");
-
+BEGIN_SUITE(sqlite)
 #ifdef GIT2_SQLITE_BACKEND
-	ADD_TEST(suite, "sqlite", sql_write_commit);
-	ADD_TEST(suite, "sqlite", sql_write_tree);
-	ADD_TEST(suite, "sqlite", sql_write_tag);
-	ADD_TEST(suite, "sqlite", sql_write_zero);
-	ADD_TEST(suite, "sqlite", sql_write_one);
-	ADD_TEST(suite, "sqlite", sql_write_two);
-	ADD_TEST(suite, "sqlite", sql_write_some);
+	ADD_TEST(sqlite0);
+	ADD_TEST(sqlite1);
+	ADD_TEST(sqlite2);
+	ADD_TEST(sqlite3);
+	ADD_TEST(sqlite4);
+	ADD_TEST(sqlite5);
+	ADD_TEST(sqlite6);
 #endif
-
-	return suite;
-}
-
+END_SUITE
diff --git a/tests/t12-repo.c b/tests/t12-repo.c
index 68b3660..644669c 100644
--- a/tests/t12-repo.c
+++ b/tests/t12-repo.c
@@ -64,7 +64,7 @@ int test_backend_sorting(git_odb *odb)
 	return GIT_SUCCESS;
 }
 
-BEGIN_TEST("odb", backend_sorting)
+BEGIN_TEST(odb0, "assure that ODB backends are properly sorted")
 	git_odb *odb;
 	must_pass(git_odb_new(&odb));
 	must_pass(git_odb_add_backend(odb, new_backend(0), 5));
@@ -75,7 +75,7 @@ BEGIN_TEST("odb", backend_sorting)
 	git_odb_close(odb);
 END_TEST
 
-BEGIN_TEST("odb", backend_alternates_sorting)
+BEGIN_TEST(odb1, "assure that alternate backends are properly sorted")
 	git_odb *odb;
 	must_pass(git_odb_new(&odb));
 	must_pass(git_odb_add_backend(odb, new_backend(0), 5));
@@ -94,52 +94,70 @@ END_TEST
 #define STANDARD_REPOSITORY 0
 #define BARE_REPOSITORY 1
 
-static void ensure_repository_init(git_test *_gittest, char *working_directory, int repository_kind, char *expected_path_index, char *expected_path_repository, char *expected_working_directory)
+static int ensure_repository_init(
+	const char *working_directory,
+	int repository_kind,
+	const char *expected_path_index,
+	const char *expected_path_repository,
+	const char *expected_working_directory)
 {
 	char path_odb[GIT_PATH_MAX];
 	git_repository *repo;
 
-	must_be_true(gitfo_isdir(working_directory));
+	if (gitfo_isdir(working_directory) == GIT_SUCCESS)
+		return GIT_ERROR;
 
 	git__joinpath(path_odb, expected_path_repository, GIT_OBJECTS_DIR);
 
-	must_pass(git_repository_init(&repo, working_directory, repository_kind));
-	must_be_true((repo->path_workdir == NULL && expected_working_directory == NULL) || !strcmp(repo->path_workdir, expected_working_directory));
-	must_be_true(!strcmp(repo->path_odb, path_odb));
-	must_be_true(!strcmp(repo->path_repository, expected_path_repository));
-	must_be_true((repo->path_index == NULL && expected_path_index == NULL) || !strcmp(repo->path_index, expected_path_index));
+	if (git_repository_init(&repo, working_directory, repository_kind) < GIT_SUCCESS)
+		return GIT_ERROR;
+
+	if (repo->path_workdir != NULL || expected_working_directory != NULL) {
+		if (strcmp(repo->path_workdir, expected_working_directory) != 0)
+			return GIT_ERROR;
+	}
+
+	if (strcmp(repo->path_odb, path_odb) != 0)
+		return GIT_ERROR;
+
+	if (strcmp(repo->path_repository, expected_path_repository) != 0)
+		return GIT_ERROR;
+
+	if (repo->path_index != NULL || expected_path_index != NULL) {
+		if (strcmp(repo->path_index, expected_path_index) != 0)
+			return GIT_ERROR;
+	}
 
 	git_repository_free(repo);
-	must_pass(rmdir_recurs(working_directory));
+	rmdir_recurs(working_directory);
+
+	return GIT_SUCCESS;
 }
 
-BEGIN_TEST("repo_initialization", init_standard_repo)
+BEGIN_TEST(init0, "initialize a standard repo")
 	char path_index[GIT_PATH_MAX], path_repository[GIT_PATH_MAX];
 
-	git__joinpath(path_repository, TEMP_DIR, GIT_DIR);
+	git__joinpath(path_repository, TEMP_REPO_FOLDER, GIT_DIR);
 	git__joinpath(path_index, path_repository, GIT_INDEX_FILE);
 
-	ensure_repository_init(_gittest, TEMP_DIR, STANDARD_REPOSITORY, path_index, path_repository, TEMP_DIR);
-	ensure_repository_init(_gittest, TEMP_DIR_WITHOUT_TRAILING_SLASH, STANDARD_REPOSITORY, path_index, path_repository, TEMP_DIR);
+	ensure_repository_init(TEMP_REPO_FOLDER, STANDARD_REPOSITORY, path_index, path_repository, TEMP_REPO_FOLDER);
+	ensure_repository_init(TEMP_REPO_FOLDER_NS, STANDARD_REPOSITORY, path_index, path_repository, TEMP_REPO_FOLDER);
 END_TEST
 
-BEGIN_TEST("repo_initialization", init_bare_repo)
+BEGIN_TEST(init1, "initialize a bare repo")
 	char path_repository[GIT_PATH_MAX];
 
-	git__joinpath(path_repository, TEMP_DIR, "");
+	git__joinpath(path_repository, TEMP_REPO_FOLDER, "");
 
-	ensure_repository_init(_gittest, TEMP_DIR, BARE_REPOSITORY, NULL, path_repository, NULL);
-	ensure_repository_init(_gittest, TEMP_DIR_WITHOUT_TRAILING_SLASH, BARE_REPOSITORY, NULL, path_repository, NULL);
+	ensure_repository_init(TEMP_REPO_FOLDER, BARE_REPOSITORY, NULL, path_repository, NULL);
+	ensure_repository_init(TEMP_REPO_FOLDER_NS, BARE_REPOSITORY, NULL, path_repository, NULL);
 END_TEST
 
-git_testsuite *libgit2_suite_repository(void)
-{
-	git_testsuite *suite = git_testsuite_new("Repository");
 
-	ADD_TEST(suite, "odb", backend_sorting);
-	ADD_TEST(suite, "odb", backend_alternates_sorting);
-	ADD_TEST(suite, "repo_initialization", init_standard_repo);
-	ADD_TEST(suite, "repo_initialization", init_bare_repo);
+BEGIN_SUITE(repository)
+	ADD_TEST(odb0);
+	ADD_TEST(odb1);
+	ADD_TEST(init0);
+	ADD_TEST(init1);
+END_SUITE
 
-	return suite;
-}
diff --git a/tests/test_helpers.c b/tests/test_helpers.c
index 4805fdc..5884611 100644
--- a/tests/test_helpers.c
+++ b/tests/test_helpers.c
@@ -197,7 +197,7 @@ static int remove_filesystem_element_recurs(void *GIT_UNUSED(nil), char *path)
 	return gitfo_unlink(path);
 }
 
-int rmdir_recurs(char *directory_path)
+int rmdir_recurs(const char *directory_path)
 {
 	char buffer[GIT_PATH_MAX];
 	strcpy(buffer, directory_path);
@@ -227,7 +227,7 @@ static int copy_filesystem_element_recurs(void *_data, char *source)
 	return copy_file(source, data->dst);
 }
 
-int copydir_recurs(char *source_directory_path, char *destination_directory_path)
+int copydir_recurs(const char *source_directory_path, const char *destination_directory_path)
 {
 	char source_buffer[GIT_PATH_MAX];
 	char dest_buffer[GIT_PATH_MAX];
@@ -246,3 +246,18 @@ int copydir_recurs(char *source_directory_path, char *destination_directory_path
 
 	return copy_filesystem_element_recurs(&data, source_buffer);
 }
+
+int open_temp_repo(git_repository **repo, const char *path)
+{
+	int error;
+	if ((error = copydir_recurs(path, TEMP_REPO_FOLDER)) < GIT_SUCCESS)
+		return error;
+
+	return git_repository_open(repo, TEMP_REPO_FOLDER);
+}
+
+void close_temp_repo(git_repository *repo)
+{
+	git_repository_free(repo);
+	rmdir_recurs(TEMP_REPO_FOLDER);
+}
diff --git a/tests/test_helpers.h b/tests/test_helpers.h
index af5a0a9..78538d5 100644
--- a/tests/test_helpers.h
+++ b/tests/test_helpers.h
@@ -36,8 +36,9 @@
 #define TEST_INDEX2_PATH		(TEST_RESOURCES "/gitgit.index")
 #define TEST_INDEXBIG_PATH		(TEST_RESOURCES "/big.index")
 
-#define TEMP_DIR_WITHOUT_TRAILING_SLASH TEST_RESOURCES "/temp_working"
-#define TEMP_DIR TEMP_DIR_WITHOUT_TRAILING_SLASH "/"
+#define TEMP_FOLDER				"./"
+#define TEMP_REPO_FOLDER		TEMP_FOLDER TEST_REPOSITORY_NAME "/"
+#define TEMP_REPO_FOLDER_NS		TEMP_FOLDER TEST_REPOSITORY_NAME
 
 typedef struct object_data {
     unsigned char *bytes;  /* (compressed) bytes stored in object store */
@@ -62,8 +63,11 @@ extern int remove_loose_object(const char *odb_dir, git_object *object);
 
 extern int cmp_files(const char *a, const char *b);
 extern int copy_file(const char *source, const char *dest);
-extern int rmdir_recurs(char *directory_path);
-extern int copydir_recurs(char *source_directory_path, char *destination_directory_path);
+extern int rmdir_recurs(const char *directory_path);
+extern int copydir_recurs(const char *source_directory_path, const char *destination_directory_path);
+
+extern int open_temp_repo(git_repository **repo, const char *path);
+extern void close_temp_repo(git_repository *repo);
 
 #endif
 /* INCLUDE_test_helpers_h__ */
diff --git a/tests/test_lib.c b/tests/test_lib.c
index eb13cd8..c9c6141 100755
--- a/tests/test_lib.c
+++ b/tests/test_lib.c
@@ -12,10 +12,12 @@
 
 struct git_test {
 	char *name;
+	char *message;
+	char *failed_pos;
+	char *description;
+
 	git_testfunc function;
-	int failed;
-	int ran;
-	const char *message;
+	unsigned failed:1, ran:1;
 	jmp_buf *jump;
 };
 
@@ -25,25 +27,18 @@ struct git_testsuite {
 	git_test *list[GIT_MAX_TEST_CASES];
 };
 
-static void test_init(git_test *t, const char *name, git_testfunc function)
-{
-	t->name = strdup(name);
-	t->failed = 0;
-	t->ran = 0;
-	t->message = NULL;
-	t->function = function;
-	t->jump = NULL;
-}
-
 static void test_free(git_test *t)
 {
 	if (t) {
 		free(t->name);
+		free(t->description);
+		free(t->failed_pos);
+		free(t->message);
 		free(t);
 	}
 }
 
-void test_run(git_test *tc)
+static void test_run(git_test *tc)
 {
 	jmp_buf buf;
 	tc->jump = &buf;
@@ -56,11 +51,26 @@ void test_run(git_test *tc)
 	tc->jump = 0;
 }
 
-git_test *git_test_new(const char *name, git_testfunc function)
+static git_test *create_test(git_testfunc function)
 {
-	git_test *tc = DO_ALLOC(git_test);
-	test_init(tc, name, function);
-	return tc;
+	git_test *t = DO_ALLOC(git_test);
+
+	t->name = NULL;
+	t->failed = 0;
+	t->ran = 0;
+	t->description = NULL;
+	t->message = NULL;
+	t->failed_pos = NULL;
+	t->function = function;
+	t->jump = NULL;
+
+	return t;
+}
+
+void git_test__init(git_test *t, const char *name, const char *description)
+{
+	t->name = strdup(name);
+	t->description = strdup(description);
 }
 
 
@@ -72,10 +82,11 @@ static void fail_test(git_test *tc, const char *file, int line, const char *mess
 {
 	char buf[1024];
 
-	snprintf(buf, 1024, "%s @ %s:%d", message, file, line);
+	snprintf(buf, 1024, "%s:%d", file, line);
 
 	tc->failed = 1;
-	tc->message = strdup(buf);
+	tc->message = strdup(message);
+	tc->failed_pos = strdup(buf);
 
 	if (tc->jump != 0)
 		longjmp(*(tc->jump), 0);
@@ -111,7 +122,7 @@ git_testsuite *git_testsuite_new(const char *name)
 	return ts;
 }
 
-void git_testsuite_free(git_testsuite *ts)
+static void free_suite(git_testsuite *ts)
 {
 	unsigned int n;
 
@@ -122,20 +133,12 @@ void git_testsuite_free(git_testsuite *ts)
 	free(ts);
 }
 
-void git_testsuite_add(git_testsuite *ts, git_test *tc)
+void git_testsuite_add(git_testsuite *ts, git_testfunc test)
 {
 	assert(ts->count < GIT_MAX_TEST_CASES);
-	ts->list[ts->count++] = tc;
+	ts->list[ts->count++] = create_test(test);
 }
 
-void git_testsuite_addsuite(git_testsuite *ts, git_testsuite *ts2)
-{
-	int i;
-	for (i = 0 ; i < ts2->count ; ++i)
-		git_testsuite_add(ts, ts2->list[i]);
-}
-
-
 static void print_details(git_testsuite *ts)
 {
 	int i;
@@ -151,7 +154,8 @@ static void print_details(git_testsuite *ts)
 			git_test *tc = ts->list[i];
 			if (tc->failed) {
 				failCount++;
-				printf("  %d) %s: %s\n", failCount, tc->name, tc->message);
+				printf("  %d) \"%s\" [test %s @ %s]\n\t%s\n",
+					failCount, tc->description, tc->name, tc->failed_pos, tc->message);
 			}
 		}
 	}
@@ -159,7 +163,7 @@ static void print_details(git_testsuite *ts)
 
 int git_testsuite_run(git_testsuite *ts)
 {
-	int i;
+	int i, fail_count;
 
 	printf("Suite \"%s\": ", ts->name);
 
@@ -175,7 +179,9 @@ int git_testsuite_run(git_testsuite *ts)
 	}
 	printf("\n  ");
 	print_details(ts);
+	fail_count = ts->fail_count;
 
-	return ts->fail_count;
+	free_suite(ts);
+	return fail_count;
 }
 
diff --git a/tests/test_lib.h b/tests/test_lib.h
index ae384ba..d0b62c8 100755
--- a/tests/test_lib.h
+++ b/tests/test_lib.h
@@ -9,13 +9,23 @@
 #include "common.h"
 #include <git2.h>
 
-#define ADD_TEST(SUITE, MODULE, TEST) \
-	git_testsuite_add(SUITE, git_test_new(MODULE "::" #TEST, &_gittest__##TEST))
-
-#define BEGIN_TEST(MODULE, TEST) \
-	void _gittest__##TEST(git_test *_gittest) \
-	{ \
-		assert(_gittest);\
+#define DECLARE_SUITE(SNAME) extern git_testsuite *libgit2_suite_##SNAME(void)
+#define SUITE_NAME(SNAME) libgit2_suite_##SNAME
+
+#define BEGIN_SUITE(SNAME) \
+	git_testsuite *libgit2_suite_##SNAME(void) {\
+		git_testsuite *_gitsuite = git_testsuite_new(#SNAME);
+	
+#define ADD_TEST(TNAME) \
+	git_testsuite_add(_gitsuite, _gittest__##TNAME);
+
+#define END_SUITE \
+		return _gitsuite;\
+	}
+
+#define BEGIN_TEST(TNAME, DESC) \
+	static void _gittest__##TNAME(git_test *_gittest) { \
+		git_test__init(_gittest, #TNAME, DESC); \
 		{\
 
 #define END_TEST }}
@@ -23,21 +33,18 @@
 typedef struct git_test git_test;
 typedef struct git_testsuite git_testsuite;
 typedef void (*git_testfunc)(git_test *);
+typedef git_testsuite *(*libgit2_suite)(void);
 
+void git_test__init(git_test *t, const char *name, const char *description);
 void git_test__fail(git_test *tc, const char *file, int line, const char *message);
 void git_test__assert(git_test *tc, const char *file, int line, const char *message, int condition);
 
-#define must_pass(expr) git_test__assert(_gittest, __FILE__, __LINE__, "Method failed, " #expr, (expr) == 0)
-#define must_fail(expr) git_test__assert(_gittest, __FILE__, __LINE__, "Expected method to fail, " #expr, (expr) < 0)
-#define must_be_true(expr) git_test__assert(_gittest, __FILE__, __LINE__, "Expected " #expr, !!(expr))
+#define must_pass(expr) git_test__assert(_gittest, __FILE__, __LINE__, "Method failed: " #expr, (expr) == 0)
+#define must_fail(expr) git_test__assert(_gittest, __FILE__, __LINE__, "Expected method to fail: " #expr, (expr) < 0)
+#define must_be_true(expr) git_test__assert(_gittest, __FILE__, __LINE__, "Expression is not true: " #expr, !!(expr))
 
 git_testsuite *git_testsuite_new(const char *name);
-git_test *git_test_new(const char *name, git_testfunc function);
-
-void git_testsuite_free(git_testsuite *ts);
-
-void git_testsuite_add(git_testsuite *ts, git_test *tc);
-void git_testsuite_addsuite(git_testsuite* ts, git_testsuite *ts2);
+void git_testsuite_add(git_testsuite *ts, git_testfunc test);
 int git_testsuite_run(git_testsuite *ts);
 
 #endif
diff --git a/tests/test_main.c b/tests/test_main.c
index 01e7d51..9308b8d 100644
--- a/tests/test_main.c
+++ b/tests/test_main.c
@@ -29,81 +29,49 @@
 #include "test_lib.h"
 #include "test_helpers.h"
 
-extern git_testsuite *libgit2_suite_core(void);
-extern git_testsuite *libgit2_suite_rawobjects(void);
-extern git_testsuite *libgit2_suite_objread(void);
-extern git_testsuite *libgit2_suite_objwrite(void);
-extern git_testsuite *libgit2_suite_commit(void);
-extern git_testsuite *libgit2_suite_revwalk(void);
-extern git_testsuite *libgit2_suite_index(void);
-extern git_testsuite *libgit2_suite_hashtable(void);
-extern git_testsuite *libgit2_suite_tag(void);
-extern git_testsuite *libgit2_suite_tree(void);
-extern git_testsuite *libgit2_suite_refs(void);
-extern git_testsuite *libgit2_suite_sqlite(void);
-extern git_testsuite *libgit2_suite_repository(void);
-
-typedef git_testsuite *(*libgit2_suite)(void);
+DECLARE_SUITE(core);
+DECLARE_SUITE(rawobjects);
+DECLARE_SUITE(objread);
+DECLARE_SUITE(objwrite);
+DECLARE_SUITE(commit);
+DECLARE_SUITE(revwalk);
+DECLARE_SUITE(index);
+DECLARE_SUITE(hashtable);
+DECLARE_SUITE(tag);
+DECLARE_SUITE(tree);
+DECLARE_SUITE(refs);
+DECLARE_SUITE(sqlite);
+DECLARE_SUITE(repository);
 
 static libgit2_suite suite_methods[]= {
-	libgit2_suite_core,
-	libgit2_suite_rawobjects,
-	libgit2_suite_objread,
-	libgit2_suite_objwrite,
-	libgit2_suite_commit,
-	libgit2_suite_revwalk,
-	libgit2_suite_index,
-	libgit2_suite_hashtable,
-	libgit2_suite_tag,
-	libgit2_suite_tree,
-	libgit2_suite_refs,
-	libgit2_suite_sqlite,
-	libgit2_suite_repository,
+	SUITE_NAME(core),
+	SUITE_NAME(rawobjects),
+	SUITE_NAME(objread),
+	SUITE_NAME(objwrite),
+	SUITE_NAME(commit),
+	SUITE_NAME(revwalk),
+	SUITE_NAME(index),
+	SUITE_NAME(hashtable),
+	SUITE_NAME(tag),
+	SUITE_NAME(tree),
+	SUITE_NAME(refs),
+	SUITE_NAME(sqlite),
+	SUITE_NAME(repository),
 };
 
 #define GIT_SUITE_COUNT (ARRAY_SIZE(suite_methods))
 
-
-git_testsuite **libgit2_get_suites()
-{
-	git_testsuite **suites;
-	unsigned int i;
-
-	suites = git__malloc(GIT_SUITE_COUNT * sizeof(void *));
-	if (suites == NULL)
-		return NULL;
-
-	for (i = 0; i < GIT_SUITE_COUNT; ++i)
-		suites[i] = suite_methods[i]();
-
-	return suites;
-}
-
-void libgit2_free_suites(git_testsuite **suites)
-{
-	unsigned int i;
-
-	for (i = 0; i < GIT_SUITE_COUNT; ++i)
-		git_testsuite_free(suites[i]);
-
-	free(suites);
-}
-
 int main(int GIT_UNUSED(argc), char *GIT_UNUSED(argv[]))
 {
 	unsigned int i, failures;
-	git_testsuite **suites;
 
 	GIT_UNUSED_ARG(argc);
 	GIT_UNUSED_ARG(argv);
 
-	suites = libgit2_get_suites();
 	failures = 0;
 
 	for (i = 0; i < GIT_SUITE_COUNT; ++i)
-		failures += git_testsuite_run(suites[i]);
-
-	libgit2_free_suites(suites);
+		failures += git_testsuite_run(suite_methods[i]());
 
 	return failures ? -1 : 0;
 }