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/tree.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/tree.c')
-rw-r--r-- | tests-clar/diff/tree.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/tests-clar/diff/tree.c b/tests-clar/diff/tree.c index 58dc4e6fa..442e53b25 100644 --- a/tests-clar/diff/tree.c +++ b/tests-clar/diff/tree.c @@ -19,7 +19,7 @@ void test_diff_tree__0(void) const char *b_commit = "370fe9ec22"; const char *c_commit = "f5b0af1fb4f5c"; git_tree *a, *b, *c; - git_diff_options opts = {0}; + git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff_list *diff = NULL; diff_expects exp; @@ -175,7 +175,7 @@ void test_diff_tree__bare(void) const char *a_commit = "8496071c1b46c85"; const char *b_commit = "be3563ae3f79"; git_tree *a, *b; - git_diff_options opts = {0}; + git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff_list *diff = NULL; diff_expects exp; @@ -264,7 +264,7 @@ void test_diff_tree__larger_hunks(void) const char *a_commit = "d70d245ed97ed2aa596dd1af6536e4bfdb047b69"; const char *b_commit = "7a9e0b02e63179929fed24f0a3e0f19168114d10"; git_tree *a, *b; - git_diff_options opts = {0}; + git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff_list *diff = NULL; size_t d, num_d, h, num_h, l, num_l, header_len, line_len; const git_diff_delta *delta; @@ -319,3 +319,31 @@ void test_diff_tree__larger_hunks(void) git_tree_free(a); git_tree_free(b); } + +void test_diff_tree__checks_options_version(void) +{ + const char *a_commit = "8496071c1b46c85"; + const char *b_commit = "be3563ae3f79"; + git_tree *a, *b; + git_diff_options opts = GIT_DIFF_OPTIONS_INIT; + git_diff_list *diff = NULL; + const git_error *err; + + g_repo = cl_git_sandbox_init("testrepo.git"); + + cl_assert((a = resolve_commit_oid_to_tree(g_repo, a_commit)) != NULL); + cl_assert((b = resolve_commit_oid_to_tree(g_repo, b_commit)) != NULL); + + opts.version = 0; + cl_git_fail(git_diff_tree_to_tree(&diff, g_repo, a, b, &opts)); + err = giterr_last(); + cl_assert_equal_i(GITERR_INVALID, err->klass); + + giterr_clear(); + opts.version = 1024; + cl_git_fail(git_diff_tree_to_tree(&diff, g_repo, a, b, &opts)); + err = giterr_last(); + + git_tree_free(a); + git_tree_free(b); +} |