diff options
author | Vicent Martà <vicent@github.com> | 2012-12-05 11:47:19 -0800 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2012-12-05 11:47:19 -0800 |
commit | e05ca13f1f3550f59790c0f992841abceee1b4c5 (patch) | |
tree | a01c119011d0c6020c9288096d09ed055c475bd8 /tests-clar/diff/index.c | |
parent | a541eafa606b58e7ce3df8e496da8e032fdb74ec (diff) | |
parent | ee1c33b146a366260a4648b1f29f470fedaca0fa (diff) | |
download | libgit2-e05ca13f1f3550f59790c0f992841abceee1b4c5.tar.gz |
Merge pull request #1115 from ben/struct-versions
Version info for public structs
Diffstat (limited to 'tests-clar/diff/index.c')
-rw-r--r-- | tests-clar/diff/index.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tests-clar/diff/index.c b/tests-clar/diff/index.c index 9591e3457..267b3291c 100644 --- a/tests-clar/diff/index.c +++ b/tests-clar/diff/index.c @@ -20,7 +20,7 @@ void test_diff_index__0(void) const char *b_commit = "0017bd4ab1ec3"; /* the start */ git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit); git_tree *b = resolve_commit_oid_to_tree(g_repo, b_commit); - git_diff_options opts = {0}; + git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff_list *diff = NULL; diff_expects exp; @@ -113,7 +113,7 @@ void test_diff_index__1(void) const char *b_commit = "0017bd4ab1ec3"; /* the start */ git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit); git_tree *b = resolve_commit_oid_to_tree(g_repo, b_commit); - git_diff_options opts = {0}; + git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff_list *diff = NULL; diff_expects exp; @@ -140,3 +140,24 @@ void test_diff_index__1(void) git_tree_free(a); git_tree_free(b); } + +void test_diff_index__checks_options_version(void) +{ + const char *a_commit = "26a125ee1bf"; + git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit); + git_diff_options opts = GIT_DIFF_OPTIONS_INIT; + git_diff_list *diff; + const git_error *err; + + opts.version = 0; + cl_git_fail(git_diff_index_to_tree(&diff, g_repo, a, NULL, &opts)); + err = giterr_last(); + cl_assert_equal_i(GITERR_INVALID, err->klass); + + giterr_clear(); + opts.version = 1024; + cl_git_fail(git_diff_index_to_tree(&diff, g_repo, a, NULL, &opts)); + err = giterr_last(); + cl_assert_equal_i(GITERR_INVALID, err->klass); +} + |