summaryrefslogtreecommitdiff
path: root/tests-clar/diff/diffiter.c
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2012-11-29 15:05:04 -0800
committerBen Straub <bs@github.com>2012-11-30 13:12:14 -0800
commit2f8d30becb4801d869188d2d46ca1512843e8698 (patch)
tree603ee4d64529de316e1c83914705e83d46b38cad /tests-clar/diff/diffiter.c
parent691776213947e59a3928aab09e97a64b65e990ab (diff)
downloadlibgit2-2f8d30becb4801d869188d2d46ca1512843e8698.tar.gz
Deploy GIT_DIFF_OPTIONS_INIT
Diffstat (limited to 'tests-clar/diff/diffiter.c')
-rw-r--r--tests-clar/diff/diffiter.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/tests-clar/diff/diffiter.c b/tests-clar/diff/diffiter.c
index 133392c21..306a13eb9 100644
--- a/tests-clar/diff/diffiter.c
+++ b/tests-clar/diff/diffiter.c
@@ -76,7 +76,7 @@ void test_diff_diffiter__iterate_files_2(void)
void test_diff_diffiter__iterate_files_and_hunks(void)
{
git_repository *repo = cl_git_sandbox_init("status");
- git_diff_options opts = {0};
+ git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
git_diff_list *diff = NULL;
size_t d, num_d;
int file_count = 0, hunk_count = 0;
@@ -129,7 +129,7 @@ void test_diff_diffiter__iterate_files_and_hunks(void)
void test_diff_diffiter__max_size_threshold(void)
{
git_repository *repo = cl_git_sandbox_init("status");
- git_diff_options opts = {0};
+ git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
git_diff_list *diff = NULL;
int file_count = 0, binary_count = 0, hunk_count = 0;
size_t d, num_d;
@@ -207,7 +207,7 @@ void test_diff_diffiter__max_size_threshold(void)
void test_diff_diffiter__iterate_all(void)
{
git_repository *repo = cl_git_sandbox_init("status");
- git_diff_options opts = {0};
+ git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
git_diff_list *diff = NULL;
diff_expects exp = {0};
size_t d, num_d;
@@ -280,7 +280,7 @@ static void iterate_over_patch(git_diff_patch *patch, diff_expects *exp)
void test_diff_diffiter__iterate_randomly_while_saving_state(void)
{
git_repository *repo = cl_git_sandbox_init("status");
- git_diff_options opts = {0};
+ git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
git_diff_list *diff = NULL;
diff_expects exp = {0};
git_diff_patch *patches[PATCH_CACHE];
@@ -441,3 +441,25 @@ void test_diff_diffiter__iterate_and_generate_patch_text(void)
git_diff_list_free(diff);
}
+
+void test_diff_diffiter__checks_options_version(void)
+{
+ git_repository *repo = cl_git_sandbox_init("status");
+ git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
+ git_diff_list *diff = NULL;
+ const git_error *err;
+
+ opts.version = 0;
+ opts.flags |= GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_INCLUDE_UNTRACKED;
+
+ cl_git_fail(git_diff_workdir_to_index(&diff, repo, NULL, &opts));
+ err = giterr_last();
+ cl_assert_equal_i(GITERR_INVALID, err->klass);
+
+ giterr_clear();
+ opts.version = 1024;
+ cl_git_fail(git_diff_workdir_to_index(&diff, repo, NULL, &opts));
+ err = giterr_last();
+ cl_assert_equal_i(GITERR_INVALID, err->klass);
+}
+