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/blob.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/blob.c')
-rw-r--r-- | tests-clar/diff/blob.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests-clar/diff/blob.c b/tests-clar/diff/blob.c index 6a5645d4b..d7fdba0e6 100644 --- a/tests-clar/diff/blob.c +++ b/tests-clar/diff/blob.c @@ -12,7 +12,7 @@ void test_diff_blob__initialize(void) g_repo = cl_git_sandbox_init("attr"); - memset(&opts, 0, sizeof(opts)); + GIT_INIT_STRUCTURE(&opts, GIT_DIFF_OPTIONS_VERSION); opts.context_lines = 1; opts.interhunk_lines = 0; @@ -313,3 +313,25 @@ void test_diff_blob__comparing_two_text_blobs_honors_interhunkcontext(void) git_blob_free(old_d); } + +void test_diff_blob__checks_options_version_too_low(void) +{ + const git_error *err; + + opts.version = 0; + cl_git_fail(git_diff_blobs( + d, alien, &opts, diff_file_cb, diff_hunk_cb, diff_line_cb, &expected)); + err = giterr_last(); + cl_assert_equal_i(GITERR_INVALID, err->klass); +} + +void test_diff_blob__checks_options_version_too_high(void) +{ + const git_error *err; + + opts.version = 1024; + cl_git_fail(git_diff_blobs( + d, alien, &opts, diff_file_cb, diff_hunk_cb, diff_line_cb, &expected)); + err = giterr_last(); + cl_assert_equal_i(GITERR_INVALID, err->klass); +} |