Update test suite
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
diff --git a/src/mwindow.c b/src/mwindow.c
index fa55490..b59c4d2 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -218,9 +218,8 @@ unsigned char *git_mwindow_open(
for (w = mwf->windows; w; w = w->next) {
if (git_mwindow_contains(w, offset) &&
- git_mwindow_contains(w, offset + extra))
+ git_mwindow_contains(w, offset + extra))
break;
- }
}
/*
diff --git a/tests-clar/buf/basic.c b/tests-clar/buf/basic.c
index 5d4a5ff..d558757 100644
--- a/tests-clar/buf/basic.c
+++ b/tests-clar/buf/basic.c
@@ -8,7 +8,7 @@ void test_buf_basic__resize(void)
git_buf buf1 = GIT_BUF_INIT;
git_buf_puts(&buf1, test_string);
cl_assert(git_buf_oom(&buf1) == 0);
- cl_assert_strequal(git_buf_cstr(&buf1), test_string);
+ cl_assert_equal_s(git_buf_cstr(&buf1), test_string);
git_buf_puts(&buf1, test_string);
cl_assert(strlen(git_buf_cstr(&buf1)) == strlen(test_string) * 2);
@@ -20,10 +20,10 @@ void test_buf_basic__printf(void)
git_buf buf2 = GIT_BUF_INIT;
git_buf_printf(&buf2, "%s %s %d ", "shoop", "da", 23);
cl_assert(git_buf_oom(&buf2) == 0);
- cl_assert_strequal(git_buf_cstr(&buf2), "shoop da 23 ");
+ cl_assert_equal_s(git_buf_cstr(&buf2), "shoop da 23 ");
git_buf_printf(&buf2, "%s %d", "woop", 42);
cl_assert(git_buf_oom(&buf2) == 0);
- cl_assert_strequal(git_buf_cstr(&buf2), "shoop da 23 woop 42");
+ cl_assert_equal_s(git_buf_cstr(&buf2), "shoop da 23 woop 42");
git_buf_free(&buf2);
}
diff --git a/tests-clar/config/new.c b/tests-clar/config/new.c
index 651e739..78e8ec8 100644
--- a/tests-clar/config/new.c
+++ b/tests-clar/config/new.c
@@ -26,9 +26,9 @@ void test_config_new__write_new_config(void)
cl_git_pass(git_config_add_file(config, file, 0));
cl_git_pass(git_config_get_string(config, "color.ui", &out));
- cl_assert_strequal(out, "auto");
+ cl_assert_equal_s(out, "auto");
cl_git_pass(git_config_get_string(config, "core.editor", &out));
- cl_assert_strequal(out, "ed");
+ cl_assert_equal_s(out, "ed");
git_config_free(config);
diff --git a/tests-clar/config/read.c b/tests-clar/config/read.c
index a8ed44d..3e9a8d4 100644
--- a/tests-clar/config/read.c
+++ b/tests-clar/config/read.c
@@ -28,9 +28,9 @@ void test_config_read__case_sensitive(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config1")));
cl_git_pass(git_config_get_string(cfg, "this.that.other", &str));
- cl_assert_strequal(str, "true");
+ cl_assert_equal_s(str, "true");
cl_git_pass(git_config_get_string(cfg, "this.That.other", &str));
- cl_assert_strequal(str, "yes");
+ cl_assert_equal_s(str, "yes");
cl_git_pass(git_config_get_bool(cfg, "this.that.other", &i));
cl_assert(i == 1);
@@ -55,7 +55,7 @@ void test_config_read__multiline_value(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config2")));
cl_git_pass(git_config_get_string(cfg, "this.That.and", &str));
- cl_assert_strequal(str, "one one one two two three three");
+ cl_assert_equal_s(str, "one one one two two three three");
git_config_free(cfg);
}
@@ -71,7 +71,7 @@ void test_config_read__subsection_header(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config3")));
cl_git_pass(git_config_get_string(cfg, "section.subsection.var", &str));
- cl_assert_strequal(str, "hello");
+ cl_assert_equal_s(str, "hello");
/* The subsection is transformed to lower-case */
cl_must_fail(git_config_get_string(cfg, "section.subSectIon.var", &str));
@@ -171,10 +171,10 @@ void test_config_read__prefixes(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config9")));
cl_git_pass(git_config_get_string(cfg, "remote.ab.url", &str));
- cl_assert_strequal(str, "http://example.com/git/ab");
+ cl_assert_equal_s(str, "http://example.com/git/ab");
cl_git_pass(git_config_get_string(cfg, "remote.abba.url", &str));
- cl_assert_strequal(str, "http://example.com/git/abba");
+ cl_assert_equal_s(str, "http://example.com/git/abba");
git_config_free(cfg);
}
diff --git a/tests-clar/hash/table.c b/tests-clar/hash/table.c
deleted file mode 100644
index e69d386..0000000
--- a/tests-clar/hash/table.c
+++ /dev/null
@@ -1,162 +0,0 @@
-#include "clar_libgit2.h"
-
-#include "hashtable.h"
-#include "hash.h"
-
-
-// Helpers
-typedef struct _aux_object {
- int __bulk;
- git_oid id;
- int visited;
-} table_item;
-
-static uint32_t hash_func(const void *key, int hash_id)
-{
- uint32_t r;
- const git_oid *id = (const git_oid *)key;
-
- memcpy(&r, id->id + (hash_id * sizeof(uint32_t)), sizeof(r));
- return r;
-}
-
-static int hash_cmpkey(const void *a, const void *b)
-{
- return git_oid_cmp((const git_oid*)a, (const git_oid*)b);
-}
-
-
-void test_hash_table__new(void)
-{
- // create a new hashtable
- git_hashtable *table = NULL;
-
- table = git_hashtable_alloc(55, hash_func, hash_cmpkey);
- cl_assert(table != NULL);
- cl_assert(table->size_mask + 1 == 64);
-
- git_hashtable_free(table);
-}
-
-void test_hash_table__fill(void)
-{
- // fill the hashtable with random entries
- const int objects_n = 32;
- int i;
- table_item *objects;
- git_hashtable *table = NULL;
-
- table = git_hashtable_alloc(objects_n * 2, hash_func, hash_cmpkey);
- cl_assert(table != NULL);
-
- objects = (table_item *)git__malloc(objects_n * sizeof(table_item));
- memset(objects, 0x0, objects_n * sizeof(table_item));
-
- /* populate the hash table */
- for (i = 0; i < objects_n; ++i) {
- git_hash_buf(&(objects[i].id), &i, sizeof(int));
- cl_git_pass(git_hashtable_insert(table, &(objects[i].id), &(objects[i])));
- }
-
- /* make sure all the inserted objects can be found */
- for (i = 0; i < objects_n; ++i) {
- git_oid id;
- table_item *ob;
-
- git_hash_buf(&id, &i, sizeof(int));
- ob = (table_item *)git_hashtable_lookup(table, &id);
-
- cl_assert(ob != NULL);
- cl_assert(ob == &(objects[i]));
- }
-
- /* make sure we cannot find inexisting objects */
- for (i = 0; i < 50; ++i) {
- int hash_id;
- git_oid id;
-
- hash_id = (rand() % 50000) + objects_n;
- git_hash_buf(&id, &hash_id, sizeof(int));
- cl_assert(git_hashtable_lookup(table, &id) == NULL);
- }
-
- git_hashtable_free(table);
- git__free(objects);
-}
-
-
-void test_hash_table__resize(void)
-{
- // make sure the table resizes automatically
- const int objects_n = 64;
- int i;
- unsigned int old_size;
- table_item *objects;
- git_hashtable *table = NULL;
-
- table = git_hashtable_alloc(objects_n, hash_func, hash_cmpkey);
- cl_assert(table != NULL);
-
- objects = (table_item*)git__malloc(objects_n * sizeof(table_item));
- memset(objects, 0x0, objects_n * sizeof(table_item));
-
- old_size = table->size_mask + 1;
-
- /* populate the hash table -- should be automatically resized */
- for (i = 0; i < objects_n; ++i) {
- git_hash_buf(&(objects[i].id), &i, sizeof(int));
- cl_git_pass(git_hashtable_insert(table, &(objects[i].id), &(objects[i])));
- }
-
- cl_assert(table->size_mask > old_size);
-
- /* make sure all the inserted objects can be found */
- for (i = 0; i < objects_n; ++i) {
- git_oid id;
- table_item *ob;
-
- git_hash_buf(&id, &i, sizeof(int));
- ob = (table_item *)git_hashtable_lookup(table, &id);
-
- cl_assert(ob != NULL);
- cl_assert(ob == &(objects[i]));
- }
-
- git_hashtable_free(table);
- git__free(objects);
-}
-
-
-void test_hash_table__iterate(void)
-{
- // iterate through all the contents of the table
-
- const int objects_n = 32;
- int i;
- table_item *objects, *ob;
-
- git_hashtable *table = NULL;
-
- table = git_hashtable_alloc(objects_n * 2, hash_func, hash_cmpkey);
- cl_assert(table != NULL);
-
- objects = git__malloc(objects_n * sizeof(table_item));
- memset(objects, 0x0, objects_n * sizeof(table_item));
-
- /* populate the hash table */
- for (i = 0; i < objects_n; ++i) {
- git_hash_buf(&(objects[i].id), &i, sizeof(int));
- cl_git_pass(git_hashtable_insert(table, &(objects[i].id), &(objects[i])));
- }
-
- GIT_HASHTABLE_FOREACH_VALUE(table, ob, ob->visited = 1);
-
- /* make sure all nodes have been visited */
- for (i = 0; i < objects_n; ++i)
- {
- cl_assert(objects[i].visited);
- }
-
- git_hashtable_free(table);
- git__free(objects);
-}
diff --git a/tests-clar/index/tests.c b/tests-clar/index/tests.c
index a8ca2ee..3d01b7c 100644
--- a/tests-clar/index/tests.c
+++ b/tests-clar/index/tests.c
@@ -107,7 +107,7 @@ void test_index_tests__default_test_index(void)
for (i = 0; i < ARRAY_SIZE(test_entries); ++i) {
git_index_entry *e = entries[test_entries[i].index];
- cl_assert_strequal(e->path, test_entries[i].path);
+ cl_assert_equal_s(e->path, test_entries[i].path);
cl_assert(e->mtime.seconds == test_entries[i].mtime);
cl_assert(e->file_size == test_entries[i].file_size);
}
diff --git a/tests-clar/network/createremotethenload.c b/tests-clar/network/createremotethenload.c
index a805e2d..45931d3 100644
--- a/tests-clar/network/createremotethenload.c
+++ b/tests-clar/network/createremotethenload.c
@@ -28,6 +28,6 @@ void test_network_createremotethenload__cleanup(void)
void test_network_createremotethenload__parsing(void)
{
- cl_assert_strequal(git_remote_name(_remote), "origin");
- cl_assert_strequal(git_remote_url(_remote), url);
+ cl_assert_equal_s(git_remote_name(_remote), "origin");
+ cl_assert_equal_s(git_remote_url(_remote), url);
}
diff --git a/tests-clar/network/remotes.c b/tests-clar/network/remotes.c
index 5dc5f33..9d414c9 100644
--- a/tests-clar/network/remotes.c
+++ b/tests-clar/network/remotes.c
@@ -27,8 +27,8 @@ void test_network_remotes__cleanup(void)
void test_network_remotes__parsing(void)
{
- cl_assert_strequal(git_remote_name(_remote), "test");
- cl_assert_strequal(git_remote_url(_remote), "git://github.com/libgit2/libgit2");
+ cl_assert_equal_s(git_remote_name(_remote), "test");
+ cl_assert_equal_s(git_remote_url(_remote), "git://github.com/libgit2/libgit2");
}
void test_network_remotes__parsing_ssh_remote(void)
@@ -53,24 +53,24 @@ void test_network_remotes__unsupported_transport_methods_are_unsupported(void)
void test_network_remotes__refspec_parsing(void)
{
- cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
- cl_assert_strequal(git_refspec_dst(_refspec), "refs/remotes/test/*");
+ cl_assert_equal_s(git_refspec_src(_refspec), "refs/heads/*");
+ cl_assert_equal_s(git_refspec_dst(_refspec), "refs/remotes/test/*");
}
void test_network_remotes__set_fetchspec(void)
{
cl_git_pass(git_remote_set_fetchspec(_remote, "refs/*:refs/*"));
_refspec = git_remote_fetchspec(_remote);
- cl_assert_strequal(git_refspec_src(_refspec), "refs/*");
- cl_assert_strequal(git_refspec_dst(_refspec), "refs/*");
+ cl_assert_equal_s(git_refspec_src(_refspec), "refs/*");
+ cl_assert_equal_s(git_refspec_dst(_refspec), "refs/*");
}
void test_network_remotes__set_pushspec(void)
{
cl_git_pass(git_remote_set_pushspec(_remote, "refs/*:refs/*"));
_refspec = git_remote_pushspec(_remote);
- cl_assert_strequal(git_refspec_src(_refspec), "refs/*");
- cl_assert_strequal(git_refspec_dst(_refspec), "refs/*");
+ cl_assert_equal_s(git_refspec_src(_refspec), "refs/*");
+ cl_assert_equal_s(git_refspec_dst(_refspec), "refs/*");
}
void test_network_remotes__save(void)
@@ -90,13 +90,13 @@ void test_network_remotes__save(void)
_refspec = git_remote_fetchspec(_remote);
cl_assert(_refspec != NULL);
- cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
- cl_assert_strequal(git_refspec_dst(_refspec), "refs/remotes/upstream/*");
+ cl_assert_equal_s(git_refspec_src(_refspec), "refs/heads/*");
+ cl_assert_equal_s(git_refspec_dst(_refspec), "refs/remotes/upstream/*");
_refspec = git_remote_pushspec(_remote);
cl_assert(_refspec != NULL);
- cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
- cl_assert_strequal(git_refspec_dst(_refspec), "refs/heads/*");
+ cl_assert_equal_s(git_refspec_src(_refspec), "refs/heads/*");
+ cl_assert_equal_s(git_refspec_dst(_refspec), "refs/heads/*");
}
void test_network_remotes__fnmatch(void)
@@ -111,7 +111,7 @@ void test_network_remotes__transform(void)
memset(ref, 0x0, sizeof(ref));
cl_git_pass(git_refspec_transform(ref, sizeof(ref), _refspec, "refs/heads/master"));
- cl_assert_strequal(ref, "refs/remotes/test/master");
+ cl_assert_equal_s(ref, "refs/remotes/test/master");
}
void test_network_remotes__transform_r(void)
@@ -119,7 +119,7 @@ void test_network_remotes__transform_r(void)
git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_refspec_transform_r(&buf, _refspec, "refs/heads/master"));
- cl_assert_strequal(git_buf_cstr(&buf), "refs/remotes/test/master");
+ cl_assert_equal_s(git_buf_cstr(&buf), "refs/remotes/test/master");
git_buf_free(&buf);
}
diff --git a/tests-clar/notes/notes.c b/tests-clar/notes/notes.c
index bb5a85d..ca82ab2 100644
--- a/tests-clar/notes/notes.c
+++ b/tests-clar/notes/notes.c
@@ -33,11 +33,11 @@ void test_notes_notes__1(void)
cl_git_pass(git_note_read(&_note, _repo, NULL, &oid));
- cl_assert_strequal(git_note_message(_note), "hello world\n");
+ cl_assert_equal_s(git_note_message(_note), "hello world\n");
cl_assert(!git_oid_cmp(git_note_oid(_note), ¬e_oid));
cl_git_pass(git_blob_lookup(&_blob, _repo, ¬e_oid));
- cl_assert_strequal(git_note_message(_note), git_blob_rawcontent(_blob));
+ cl_assert_equal_s(git_note_message(_note), git_blob_rawcontent(_blob));
cl_git_fail(git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &oid, "hello world\n"));
cl_git_fail(git_note_create(¬e_oid, _repo, _sig, _sig, "refs/notes/some/namespace", &oid, "hello world\n"));
diff --git a/tests-clar/object/raw/compare.c b/tests-clar/object/raw/compare.c
index 6dc6d71..1c9ce4b 100644
--- a/tests-clar/object/raw/compare.c
+++ b/tests-clar/object/raw/compare.c
@@ -87,7 +87,7 @@ void test_object_raw_compare__compare_fmt_oids(void)
/* Format produced the right result */
out[GIT_OID_HEXSZ] = '\0';
- cl_assert_strequal(exp, out);
+ cl_assert_equal_s(exp, out);
}
void test_object_raw_compare__compare_allocfmt_oids(void)
@@ -100,7 +100,7 @@ void test_object_raw_compare__compare_allocfmt_oids(void)
out = git_oid_allocfmt(&in);
cl_assert(out);
- cl_assert_strequal(exp, out);
+ cl_assert_equal_s(exp, out);
git__free(out);
}
@@ -120,5 +120,5 @@ void test_object_raw_compare__compare_pathfmt_oids(void)
/* Format produced the right result */
out[GIT_OID_HEXSZ + 1] = '\0';
- cl_assert_strequal(exp2, out);
+ cl_assert_equal_s(exp2, out);
}
diff --git a/tests-clar/object/raw/convert.c b/tests-clar/object/raw/convert.c
index 4e7aecf..7f310dd 100644
--- a/tests-clar/object/raw/convert.c
+++ b/tests-clar/object/raw/convert.c
@@ -45,7 +45,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
/* returns out as hex formatted c-string */
str = git_oid_tostr(out, sizeof(out), &in);
cl_assert(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
- cl_assert_strequal(exp, out);
+ cl_assert_equal_s(exp, out);
}
void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
@@ -66,7 +66,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
/* returns big as hex formatted c-string */
str = git_oid_tostr(big, sizeof(big), &in);
cl_assert(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
- cl_assert_strequal(exp, big);
+ cl_assert_equal_s(exp, big);
/* check tail material is untouched */
cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
diff --git a/tests-clar/object/raw/type2string.c b/tests-clar/object/raw/type2string.c
index 2092d2c..a358548 100644
--- a/tests-clar/object/raw/type2string.c
+++ b/tests-clar/object/raw/type2string.c
@@ -6,19 +6,19 @@
void test_object_raw_type2string__convert_type_to_string(void)
{
- cl_assert_strequal(git_object_type2string(GIT_OBJ_BAD), "");
- cl_assert_strequal(git_object_type2string(GIT_OBJ__EXT1), "");
- cl_assert_strequal(git_object_type2string(GIT_OBJ_COMMIT), "commit");
- cl_assert_strequal(git_object_type2string(GIT_OBJ_TREE), "tree");
- cl_assert_strequal(git_object_type2string(GIT_OBJ_BLOB), "blob");
- cl_assert_strequal(git_object_type2string(GIT_OBJ_TAG), "tag");
- cl_assert_strequal(git_object_type2string(GIT_OBJ__EXT2), "");
- cl_assert_strequal(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA");
- cl_assert_strequal(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA");
-
- cl_assert_strequal(git_object_type2string(-2), "");
- cl_assert_strequal(git_object_type2string(8), "");
- cl_assert_strequal(git_object_type2string(1234), "");
+ cl_assert_equal_s(git_object_type2string(GIT_OBJ_BAD), "");
+ cl_assert_equal_s(git_object_type2string(GIT_OBJ__EXT1), "");
+ cl_assert_equal_s(git_object_type2string(GIT_OBJ_COMMIT), "commit");
+ cl_assert_equal_s(git_object_type2string(GIT_OBJ_TREE), "tree");
+ cl_assert_equal_s(git_object_type2string(GIT_OBJ_BLOB), "blob");
+ cl_assert_equal_s(git_object_type2string(GIT_OBJ_TAG), "tag");
+ cl_assert_equal_s(git_object_type2string(GIT_OBJ__EXT2), "");
+ cl_assert_equal_s(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA");
+ cl_assert_equal_s(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA");
+
+ cl_assert_equal_s(git_object_type2string(-2), "");
+ cl_assert_equal_s(git_object_type2string(8), "");
+ cl_assert_equal_s(git_object_type2string(1234), "");
}
void test_object_raw_type2string__convert_string_to_type(void)
diff --git a/tests-clar/object/tag/read.c b/tests-clar/object/tag/read.c
index 2ab31e5..cfeb3ae 100644
--- a/tests-clar/object/tag/read.c
+++ b/tests-clar/object/tag/read.c
@@ -56,7 +56,7 @@ void test_object_tag_read__parse(void)
cl_git_pass(git_tag_lookup(&tag1, g_repo, &id1));
- cl_assert_strequal(git_tag_name(tag1), "test");
+ cl_assert_equal_s(git_tag_name(tag1), "test");
cl_assert(git_tag_type(tag1) == GIT_OBJ_TAG);
cl_git_pass(git_tag_target((git_object **)&tag2, tag1));
@@ -115,7 +115,7 @@ void test_object_tag_read__parse_without_tagger(void)
cl_git_pass(git_tag_lookup(&bad_tag, bad_tag_repo, &id));
cl_assert(bad_tag != NULL);
- cl_assert_strequal(git_tag_name(bad_tag), "e90810b");
+ cl_assert_equal_s(git_tag_name(bad_tag), "e90810b");
cl_assert(git_oid_cmp(&id, git_tag_id(bad_tag)) == 0);
cl_assert(bad_tag->tagger == NULL);
diff --git a/tests-clar/object/tag/write.c b/tests-clar/object/tag/write.c
index 791e1ac..cb196b6 100644
--- a/tests-clar/object/tag/write.c
+++ b/tests-clar/object/tag/write.c
@@ -50,12 +50,12 @@ void test_object_tag_write__basic(void)
/* Check attributes were set correctly */
tagger1 = git_tag_tagger(tag);
cl_assert(tagger1 != NULL);
- cl_assert_strequal(tagger1->name, tagger_name);
- cl_assert_strequal(tagger1->email, tagger_email);
+ cl_assert_equal_s(tagger1->name, tagger_name);
+ cl_assert_equal_s(tagger1->email, tagger_email);
cl_assert(tagger1->when.time == 123456789);
cl_assert(tagger1->when.offset == 60);
- cl_assert_strequal(git_tag_message(tag), tagger_message);
+ cl_assert_equal_s(git_tag_message(tag), tagger_message);
cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/the-tag"));
cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
diff --git a/tests-clar/object/tree/diff.c b/tests-clar/object/tree/diff.c
index b664dfd..631fc3b 100644
--- a/tests-clar/object/tree/diff.c
+++ b/tests-clar/object/tree/diff.c
@@ -18,7 +18,7 @@ static void diff_cmp(const git_tree_diff_data *a, const git_tree_diff_data *b)
cl_assert(a->status - b->status == 0);
- cl_assert_strequal(a->path, b->path);
+ cl_assert_equal_s(a->path, b->path);
}
static int diff_cb(const git_tree_diff_data *diff, void *data)
diff --git a/tests-clar/object/tree/read.c b/tests-clar/object/tree/read.c
index fc2b44b..7129a94 100644
--- a/tests-clar/object/tree/read.c
+++ b/tests-clar/object/tree/read.c
@@ -65,7 +65,7 @@ void test_object_tree_read__two(void)
entry = git_tree_entry_byname(tree, "README");
cl_assert(entry != NULL);
- cl_assert_strequal(git_tree_entry_name(entry), "README");
+ cl_assert_equal_s(git_tree_entry_name(entry), "README");
cl_git_pass(git_tree_entry_2object(&obj, g_repo, entry));
cl_assert(obj != NULL);
diff --git a/tests-clar/refs/create.c b/tests-clar/refs/create.c
index 3674022..dde4c57 100644
--- a/tests-clar/refs/create.c
+++ b/tests-clar/refs/create.c
@@ -42,7 +42,7 @@ void test_refs_create__symbolic(void)
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_is_packed(looked_up_ref) == 0);
- cl_assert_strequal(looked_up_ref->name, new_head_tracker);
+ cl_assert_equal_s(looked_up_ref->name, new_head_tracker);
/* ...peeled.. */
cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
@@ -112,7 +112,7 @@ void test_refs_create__oid(void)
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_OID);
cl_assert(git_reference_is_packed(looked_up_ref) == 0);
- cl_assert_strequal(looked_up_ref->name, new_head);
+ cl_assert_equal_s(looked_up_ref->name, new_head);
/* ...and that it points to the current master tip */
cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0);
diff --git a/tests-clar/refs/overwrite.c b/tests-clar/refs/overwrite.c
index 5c6fd54..410e39a 100644
--- a/tests-clar/refs/overwrite.c
+++ b/tests-clar/refs/overwrite.c
@@ -34,7 +34,7 @@ void test_refs_overwrite__symbolic(void)
/* Ensure it points to the right place*/
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- cl_assert_strequal(git_reference_target(ref), ref_branch_name);
+ cl_assert_equal_s(git_reference_target(ref), ref_branch_name);
git_reference_free(ref);
/* Ensure we can't create it unless we force it to */
@@ -45,7 +45,7 @@ void test_refs_overwrite__symbolic(void)
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- cl_assert_strequal(git_reference_target(ref), ref_master_name);
+ cl_assert_equal_s(git_reference_target(ref), ref_master_name);
git_reference_free(ref);
git_reference_free(branch_ref);
@@ -103,7 +103,7 @@ void test_refs_overwrite__object_id_with_symbolic(void)
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- cl_assert_strequal(git_reference_target(ref), ref_master_name);
+ cl_assert_equal_s(git_reference_target(ref), ref_master_name);
git_reference_free(ref);
}
diff --git a/tests-clar/refs/pack.c b/tests-clar/refs/pack.c
index dca83d1..d506356 100644
--- a/tests-clar/refs/pack.c
+++ b/tests-clar/refs/pack.c
@@ -39,7 +39,7 @@ void test_refs_pack__loose(void)
/* Ensure a known loose ref can be looked up */
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert_strequal(reference->name, loose_tag_ref_name);
+ cl_assert_equal_s(reference->name, loose_tag_ref_name);
git_reference_free(reference);
/*
@@ -56,7 +56,7 @@ void test_refs_pack__loose(void)
/* Ensure the known ref can still be looked up but is now packed */
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_is_packed(reference));
- cl_assert_strequal(reference->name, loose_tag_ref_name);
+ cl_assert_equal_s(reference->name, loose_tag_ref_name);
/* Ensure the known ref has been removed from the loose folder structure */
cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, loose_tag_ref_name));
diff --git a/tests-clar/refs/read.c b/tests-clar/refs/read.c
index c7e88ab..d7111b2 100644
--- a/tests-clar/refs/read.c
+++ b/tests-clar/refs/read.c
@@ -34,7 +34,7 @@ void test_refs_read__loose_tag(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert_strequal(reference->name, loose_tag_ref_name);
+ cl_assert_equal_s(reference->name, loose_tag_ref_name);
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
cl_assert(object != NULL);
@@ -42,7 +42,7 @@ void test_refs_read__loose_tag(void)
/* Ensure the name of the tag matches the name of the reference */
cl_git_pass(git_buf_joinpath(&ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object)));
- cl_assert_strequal(ref_name_from_tag_name.ptr, loose_tag_ref_name);
+ cl_assert_equal_s(ref_name_from_tag_name.ptr, loose_tag_ref_name);
git_buf_free(&ref_name_from_tag_name);
git_object_free(object);
@@ -71,7 +71,7 @@ void test_refs_read__symbolic(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert_strequal(reference->name, GIT_HEAD_FILE);
+ cl_assert_equal_s(reference->name, GIT_HEAD_FILE);
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
@@ -99,7 +99,7 @@ void test_refs_read__nested_symbolic(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name));
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert_strequal(reference->name, head_tracker_sym_ref_name);
+ cl_assert_equal_s(reference->name, head_tracker_sym_ref_name);
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
@@ -167,7 +167,7 @@ void test_refs_read__packed(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_is_packed(reference));
- cl_assert_strequal(reference->name, packed_head_name);
+ cl_assert_equal_s(reference->name, packed_head_name);
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
cl_assert(object != NULL);
@@ -188,7 +188,7 @@ void test_refs_read__loose_first(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_test_head_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert_strequal(reference->name, packed_test_head_name);
+ cl_assert_equal_s(reference->name, packed_test_head_name);
git_reference_free(reference);
}
diff --git a/tests-clar/refs/reflog.c b/tests-clar/refs/reflog.c
index 8000e48..1bc51b2 100644
--- a/tests-clar/refs/reflog.c
+++ b/tests-clar/refs/reflog.c
@@ -16,8 +16,8 @@ static git_repository *g_repo;
static void assert_signature(git_signature *expected, git_signature *actual)
{
cl_assert(actual);
- cl_assert_strequal(expected->name, actual->name);
- cl_assert_strequal(expected->email, actual->email);
+ cl_assert_equal_s(expected->name, actual->name);
+ cl_assert_equal_s(expected->email, actual->email);
cl_assert(expected->when.offset == actual->when.offset);
cl_assert(expected->when.time == actual->when.time);
}
@@ -73,18 +73,18 @@ void test_refs_reflog__write_then_read(void)
entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 0);
assert_signature(committer, entry->committer);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
- cl_assert_strequal("0000000000000000000000000000000000000000", oid_str);
+ cl_assert_equal_s("0000000000000000000000000000000000000000", oid_str);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
- cl_assert_strequal(current_master_tip, oid_str);
+ cl_assert_equal_s(current_master_tip, oid_str);
cl_assert(entry->msg == NULL);
entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 1);
assert_signature(committer, entry->committer);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
- cl_assert_strequal(current_master_tip, oid_str);
+ cl_assert_equal_s(current_master_tip, oid_str);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
- cl_assert_strequal(current_master_tip, oid_str);
- cl_assert_strequal(commit_msg, entry->msg);
+ cl_assert_equal_s(current_master_tip, oid_str);
+ cl_assert_equal_s(commit_msg, entry->msg);
git_signature_free(committer);
git_reflog_free(reflog);
diff --git a/tests-clar/refs/rename.c b/tests-clar/refs/rename.c
index 8e7c93c..abcc751 100644
--- a/tests-clar/refs/rename.c
+++ b/tests-clar/refs/rename.c
@@ -48,14 +48,14 @@ void test_refs_rename__loose(void)
/* Now that the reference is renamed... */
cl_git_pass(git_reference_rename(looked_up_ref, new_name, 0));
- cl_assert_strequal(looked_up_ref->name, new_name);
+ cl_assert_equal_s(looked_up_ref->name, new_name);
/* ...It can't be looked-up with the old name... */
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, loose_tag_ref_name));
/* ...but the new name works ok... */
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, new_name));
- cl_assert_strequal(another_looked_up_ref->name, new_name);
+ cl_assert_equal_s(another_looked_up_ref->name, new_name);
/* .. the ref is still loose... */
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
@@ -89,14 +89,14 @@ void test_refs_rename__packed(void)
/* Now that the reference is renamed... */
cl_git_pass(git_reference_rename(looked_up_ref, brand_new_name, 0));
- cl_assert_strequal(looked_up_ref->name, brand_new_name);
+ cl_assert_equal_s(looked_up_ref->name, brand_new_name);
/* ...It can't be looked-up with the old name... */
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, packed_head_name));
/* ...but the new name works ok... */
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, brand_new_name));
- cl_assert_strequal(another_looked_up_ref->name, brand_new_name);
+ cl_assert_equal_s(another_looked_up_ref->name, brand_new_name);
/* .. the ref is no longer packed... */
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
@@ -166,7 +166,7 @@ void test_refs_rename__name_collision(void)
/* Failure to rename it hasn't corrupted its state */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
- cl_assert_strequal(looked_up_ref->name, packed_head_name);
+ cl_assert_equal_s(looked_up_ref->name, packed_head_name);
git_reference_free(looked_up_ref);
}
@@ -188,7 +188,7 @@ void test_refs_rename__invalid_name(void)
/* Failure to rename it hasn't corrupted its state */
git_reference_free(looked_up_ref);
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
- cl_assert_strequal(looked_up_ref->name, packed_test_head_name);
+ cl_assert_equal_s(looked_up_ref->name, packed_test_head_name);
git_reference_free(looked_up_ref);
}
@@ -209,7 +209,7 @@ void test_refs_rename__force_loose_packed(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
- cl_assert_strequal(looked_up_ref->name, packed_test_head_name);
+ cl_assert_equal_s(looked_up_ref->name, packed_test_head_name);
cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
git_reference_free(looked_up_ref);
@@ -233,7 +233,7 @@ void test_refs_rename__force_loose(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/test"));
- cl_assert_strequal(looked_up_ref->name, "refs/heads/test");
+ cl_assert_equal_s(looked_up_ref->name, "refs/heads/test");
cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
git_reference_free(looked_up_ref);
@@ -298,7 +298,7 @@ void test_refs_rename__prefix(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
- cl_assert_strequal(looked_up_ref->name, ref_two_name_new);
+ cl_assert_equal_s(looked_up_ref->name, ref_two_name_new);
git_reference_free(looked_up_ref);
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
@@ -331,7 +331,7 @@ void test_refs_rename__move_up(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
- cl_assert_strequal(looked_up_ref->name, ref_two_name);
+ cl_assert_equal_s(looked_up_ref->name, ref_two_name);
git_reference_free(looked_up_ref);
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
git_reference_free(ref);
diff --git a/tests-clar/repo/discover.c b/tests-clar/repo/discover.c
index 072e326..2fbd55f 100644
--- a/tests-clar/repo/discover.c
+++ b/tests-clar/repo/discover.c
@@ -30,7 +30,7 @@ static void ensure_repository_discover(const char *start_path,
char found_path[GIT_PATH_MAX];
cl_git_pass(git_repository_discover(found_path, sizeof(found_path), start_path, 0, ceiling_dirs));
//across_fs is always 0 as we can't automate the filesystem change tests
- cl_assert_strequal(found_path, expected_path);
+ cl_assert_equal_s(found_path, expected_path);
}
static void write_file(const char *path, const char *content)
@@ -60,10 +60,11 @@ static void append_ceiling_dir(git_buf *ceiling_dirs, const char *path)
if (ceiling_dirs->size > 0)
git_buf_puts(ceiling_dirs, ceiling_separator);
+
git_buf_puts(ceiling_dirs, pretty_path.ptr);
-
- git_buf_free(&pretty_path);
- cl_git_pass(git_buf_lasterror(ceiling_dirs));
+
+ git_buf_free(&pretty_path);
+ cl_assert(git_buf_oom(ceiling_dirs) == 0);
}
void test_repo_discover__0(void)