summaryrefslogtreecommitdiff
path: root/tests-clar/index
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/index')
-rw-r--r--tests-clar/index/addall.c29
-rw-r--r--tests-clar/index/names.c6
-rw-r--r--tests-clar/index/reuc.c2
-rw-r--r--tests-clar/index/tests.c14
4 files changed, 30 insertions, 21 deletions
diff --git a/tests-clar/index/addall.c b/tests-clar/index/addall.c
index 3b5f5f22d..44c51279d 100644
--- a/tests-clar/index/addall.c
+++ b/tests-clar/index/addall.c
@@ -68,10 +68,11 @@ static int index_status_cb(
return 0;
}
-static void check_status(
+static void check_status_at_line(
git_repository *repo,
size_t index_adds, size_t index_dels, size_t index_mods,
- size_t wt_adds, size_t wt_dels, size_t wt_mods, size_t ignores)
+ size_t wt_adds, size_t wt_dels, size_t wt_mods, size_t ignores,
+ const char *file, int line)
{
index_status_counts vals;
@@ -79,15 +80,25 @@ static void check_status(
cl_git_pass(git_status_foreach(repo, index_status_cb, &vals));
- cl_assert_equal_sz(index_adds, vals.index_adds);
- cl_assert_equal_sz(index_dels, vals.index_dels);
- cl_assert_equal_sz(index_mods, vals.index_mods);
- cl_assert_equal_sz(wt_adds, vals.wt_adds);
- cl_assert_equal_sz(wt_dels, vals.wt_dels);
- cl_assert_equal_sz(wt_mods, vals.wt_mods);
- cl_assert_equal_sz(ignores, vals.ignores);
+ clar__assert_equal(
+ file,line,"wrong index adds", 1, "%"PRIuZ, index_adds, vals.index_adds);
+ clar__assert_equal(
+ file,line,"wrong index dels", 1, "%"PRIuZ, index_dels, vals.index_dels);
+ clar__assert_equal(
+ file,line,"wrong index mods", 1, "%"PRIuZ, index_mods, vals.index_mods);
+ clar__assert_equal(
+ file,line,"wrong workdir adds", 1, "%"PRIuZ, wt_adds, vals.wt_adds);
+ clar__assert_equal(
+ file,line,"wrong workdir dels", 1, "%"PRIuZ, wt_dels, vals.wt_dels);
+ clar__assert_equal(
+ file,line,"wrong workdir mods", 1, "%"PRIuZ, wt_mods, vals.wt_mods);
+ clar__assert_equal(
+ file,line,"wrong ignores", 1, "%"PRIuZ, ignores, vals.ignores);
}
+#define check_status(R,IA,ID,IM,WA,WD,WM,IG) \
+ check_status_at_line(R,IA,ID,IM,WA,WD,WM,IG,__FILE__,__LINE__)
+
static void check_stat_data(git_index *index, const char *path, bool match)
{
const git_index_entry *entry;
diff --git a/tests-clar/index/names.c b/tests-clar/index/names.c
index 87453ecbf..9a86b14d2 100644
--- a/tests-clar/index/names.c
+++ b/tests-clar/index/names.c
@@ -63,7 +63,7 @@ void test_index_names__roundtrip(void)
git_index_clear(repo_index);
cl_assert(git_index_name_entrycount(repo_index) == 0);
- cl_git_pass(git_index_read(repo_index));
+ cl_git_pass(git_index_read(repo_index, 0));
cl_assert(git_index_name_entrycount(repo_index) == 3);
conflict_name = git_index_name_get_byindex(repo_index, 0);
@@ -120,7 +120,7 @@ void test_index_names__cleaned_on_checkout_tree(void)
git_reference_name_to_id(&oid, repo, "refs/heads/master");
git_object_lookup(&obj, repo, &oid, GIT_OBJ_ANY);
git_checkout_tree(repo, obj, &opts);
- cl_assert(git_index_name_entrycount(repo_index) == 0);
+ cl_assert_equal_sz(0, git_index_name_entrycount(repo_index));
git_object_free(obj);
}
@@ -133,7 +133,7 @@ void test_index_names__cleaned_on_checkout_head(void)
test_index_names__add();
git_checkout_head(repo, &opts);
- cl_assert(git_index_name_entrycount(repo_index) == 0);
+ cl_assert_equal_sz(0, git_index_name_entrycount(repo_index));
}
void test_index_names__retained_on_checkout_index(void)
diff --git a/tests-clar/index/reuc.c b/tests-clar/index/reuc.c
index 69ed4a933..a18d5602e 100644
--- a/tests-clar/index/reuc.c
+++ b/tests-clar/index/reuc.c
@@ -276,8 +276,6 @@ void test_index_reuc__write(void)
0100644, &their_oid));
cl_git_pass(git_index_write(repo_index));
-
- cl_git_pass(git_index_read(repo_index));
cl_assert_equal_i(2, git_index_reuc_entrycount(repo_index));
/* ensure sort order was round-tripped correct */
diff --git a/tests-clar/index/tests.c b/tests-clar/index/tests.c
index 009d393d7..f538bc278 100644
--- a/tests-clar/index/tests.c
+++ b/tests-clar/index/tests.c
@@ -349,14 +349,14 @@ void test_index_tests__remove_entry(void)
cl_git_pass(git_index_add_bypath(index, "hello"));
cl_git_pass(git_index_write(index));
- cl_git_pass(git_index_read(index)); /* reload */
+ cl_git_pass(git_index_read(index, false)); /* reload */
cl_assert(git_index_entrycount(index) == 1);
cl_assert(git_index_get_bypath(index, "hello", 0) != NULL);
cl_git_pass(git_index_remove(index, "hello", 0));
cl_git_pass(git_index_write(index));
- cl_git_pass(git_index_read(index)); /* reload */
+ cl_git_pass(git_index_read(index, false)); /* reload */
cl_assert(git_index_entrycount(index) == 0);
cl_assert(git_index_get_bypath(index, "hello", 0) == NULL);
@@ -388,7 +388,7 @@ void test_index_tests__remove_directory(void)
cl_git_pass(git_index_add_bypath(index, "b.txt"));
cl_git_pass(git_index_write(index));
- cl_git_pass(git_index_read(index)); /* reload */
+ cl_git_pass(git_index_read(index, false)); /* reload */
cl_assert_equal_i(4, (int)git_index_entrycount(index));
cl_assert(git_index_get_bypath(index, "a/1.txt", 0) != NULL);
cl_assert(git_index_get_bypath(index, "a/2.txt", 0) != NULL);
@@ -397,7 +397,7 @@ void test_index_tests__remove_directory(void)
cl_git_pass(git_index_remove(index, "a/1.txt", 0));
cl_git_pass(git_index_write(index));
- cl_git_pass(git_index_read(index)); /* reload */
+ cl_git_pass(git_index_read(index, false)); /* reload */
cl_assert_equal_i(3, (int)git_index_entrycount(index));
cl_assert(git_index_get_bypath(index, "a/1.txt", 0) == NULL);
cl_assert(git_index_get_bypath(index, "a/2.txt", 0) != NULL);
@@ -406,7 +406,7 @@ void test_index_tests__remove_directory(void)
cl_git_pass(git_index_remove_directory(index, "a", 0));
cl_git_pass(git_index_write(index));
- cl_git_pass(git_index_read(index)); /* reload */
+ cl_git_pass(git_index_read(index, false)); /* reload */
cl_assert_equal_i(1, (int)git_index_entrycount(index));
cl_assert(git_index_get_bypath(index, "a/1.txt", 0) == NULL);
cl_assert(git_index_get_bypath(index, "a/2.txt", 0) == NULL);
@@ -517,7 +517,7 @@ void test_index_tests__reload_from_disk(void)
/* Sync the changes back into the read_index */
cl_assert_equal_sz(0, git_index_entrycount(read_index));
- cl_git_pass(git_index_read(read_index));
+ cl_git_pass(git_index_read(read_index, false));
cl_assert_equal_i(true, read_index->on_disk);
cl_assert_equal_sz(2, git_index_entrycount(read_index));
@@ -526,7 +526,7 @@ void test_index_tests__reload_from_disk(void)
cl_git_pass(p_unlink(write_index->index_file_path));
/* Sync the changes back into the read_index */
- cl_git_pass(git_index_read(read_index));
+ cl_git_pass(git_index_read(read_index, false));
cl_assert_equal_i(false, read_index->on_disk);
cl_assert_equal_sz(0, git_index_entrycount(read_index));