diff options
author | Russell Belfer <rb@github.com> | 2012-08-30 14:24:16 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-09-05 15:17:24 -0700 |
commit | f335ecd6e126aa9dea28786522c0e6ce71596e91 (patch) | |
tree | 3393df3457e423ddc1aaad4d89fb29184246f3a8 /tests-clar/diff/index.c | |
parent | 4d3834038bd0aaef63d62c54900f6ddafec09515 (diff) | |
download | libgit2-f335ecd6e126aa9dea28786522c0e6ce71596e91.tar.gz |
Diff iterators
This refactors the diff output code so that an iterator object
can be used to traverse and generate the diffs, instead of just
the `foreach()` style with callbacks. The code has been rearranged
so that the two styles can still share most functions.
This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses
that as a common error code for marking the end of iteration when
using a iterator style of object.
Diffstat (limited to 'tests-clar/diff/index.c')
-rw-r--r-- | tests-clar/diff/index.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/tests-clar/diff/index.c b/tests-clar/diff/index.c index 89e65e3b..2c6e89c4 100644 --- a/tests-clar/diff/index.c +++ b/tests-clar/diff/index.c @@ -44,17 +44,17 @@ void test_diff_index__0(void) * - git diff -U1 --cached 26a125ee1bf * - mv .git .gitted */ - cl_assert(exp.files == 8); - cl_assert(exp.file_adds == 3); - cl_assert(exp.file_dels == 2); - cl_assert(exp.file_mods == 3); + cl_assert_equal_i(8, exp.files); + cl_assert_equal_i(3, exp.file_adds); + cl_assert_equal_i(2, exp.file_dels); + cl_assert_equal_i(3, exp.file_mods); - cl_assert(exp.hunks == 8); + cl_assert_equal_i(8, exp.hunks); - cl_assert(exp.lines == 11); - cl_assert(exp.line_ctxt == 3); - cl_assert(exp.line_adds == 6); - cl_assert(exp.line_dels == 2); + cl_assert_equal_i(11, exp.lines); + cl_assert_equal_i(3, exp.line_ctxt); + cl_assert_equal_i(6, exp.line_adds); + cl_assert_equal_i(2, exp.line_dels); git_diff_list_free(diff); diff = NULL; @@ -72,17 +72,17 @@ void test_diff_index__0(void) * - git diff -U1 --cached 0017bd4ab1ec3 * - mv .git .gitted */ - cl_assert(exp.files == 12); - cl_assert(exp.file_adds == 7); - cl_assert(exp.file_dels == 2); - cl_assert(exp.file_mods == 3); + cl_assert_equal_i(12, exp.files); + cl_assert_equal_i(7, exp.file_adds); + cl_assert_equal_i(2, exp.file_dels); + cl_assert_equal_i(3, exp.file_mods); - cl_assert(exp.hunks == 12); + cl_assert_equal_i(12, exp.hunks); - cl_assert(exp.lines == 16); - cl_assert(exp.line_ctxt == 3); - cl_assert(exp.line_adds == 11); - cl_assert(exp.line_dels == 2); + cl_assert_equal_i(16, exp.lines); + cl_assert_equal_i(3, exp.line_ctxt); + cl_assert_equal_i(11, exp.line_adds); + cl_assert_equal_i(2, exp.line_dels); git_diff_list_free(diff); diff = NULL; @@ -132,7 +132,7 @@ void test_diff_index__1(void) git_diff_foreach(diff, &exp, diff_stop_after_2_files, NULL, NULL) ); - cl_assert(exp.files == 2); + cl_assert_equal_i(2, exp.files); git_diff_list_free(diff); diff = NULL; |