Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-02-28 23:51:38 +0300
committerEdward Thomson <ethomson@github.com>2016-02-29 02:59:43 +0300
commitf2dddf52c041ff2f9185bdb320ddccad1523a2bf (patch)
tree6e818814d93e1781c51da842e6c02529a17167b6 /tests/index
parent4afe536ba1c909ff8ab8d1b75997d3897b72571b (diff)
turn on strict object validation by default
Diffstat (limited to 'tests/index')
-rw-r--r--tests/index/add.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/index/add.c b/tests/index/add.c
index cfa81c4d9..f101ea266 100644
--- a/tests/index/add.c
+++ b/tests/index/add.c
@@ -20,7 +20,7 @@ void test_index_add__cleanup(void)
cl_git_sandbox_cleanup();
g_repo = NULL;
- cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 0));
+ cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 1));
}
static void test_add_entry(
@@ -42,7 +42,7 @@ static void test_add_entry(
void test_index_add__invalid_entries_succeeds_by_default(void)
{
/*
- * Ensure that there is no validation on ids by default
+ * Ensure that there is validation on object ids by default
*/
/* ensure that we can add some actually good entries */
@@ -51,34 +51,34 @@ void test_index_add__invalid_entries_succeeds_by_default(void)
test_add_entry(true, valid_blob_id, GIT_FILEMODE_LINK);
/* test that we fail to add some invalid (missing) blobs and trees */
- test_add_entry(true, invalid_id, GIT_FILEMODE_BLOB);
- test_add_entry(true, invalid_id, GIT_FILEMODE_BLOB_EXECUTABLE);
- test_add_entry(true, invalid_id, GIT_FILEMODE_LINK);
+ test_add_entry(false, invalid_id, GIT_FILEMODE_BLOB);
+ test_add_entry(false, invalid_id, GIT_FILEMODE_BLOB_EXECUTABLE);
+ test_add_entry(false, invalid_id, GIT_FILEMODE_LINK);
/* test that we validate the types of objects */
- test_add_entry(true, valid_commit_id, GIT_FILEMODE_BLOB);
- test_add_entry(true, valid_tree_id, GIT_FILEMODE_BLOB_EXECUTABLE);
- test_add_entry(true, valid_commit_id, GIT_FILEMODE_LINK);
+ test_add_entry(false, valid_commit_id, GIT_FILEMODE_BLOB);
+ test_add_entry(false, valid_tree_id, GIT_FILEMODE_BLOB_EXECUTABLE);
+ test_add_entry(false, valid_commit_id, GIT_FILEMODE_LINK);
/*
- * Ensure that strict object references will fail the `index_add`
+ * Ensure that there we can disable validation
*/
- cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 1));
+ cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 0));
/* ensure that we can add some actually good entries */
test_add_entry(true, valid_blob_id, GIT_FILEMODE_BLOB);
test_add_entry(true, valid_blob_id, GIT_FILEMODE_BLOB_EXECUTABLE);
test_add_entry(true, valid_blob_id, GIT_FILEMODE_LINK);
- /* test that we fail to add some invalid (missing) blobs and trees */
- test_add_entry(false, invalid_id, GIT_FILEMODE_BLOB);
- test_add_entry(false, invalid_id, GIT_FILEMODE_BLOB_EXECUTABLE);
- test_add_entry(false, invalid_id, GIT_FILEMODE_LINK);
+ /* test that we can now add some invalid (missing) blobs and trees */
+ test_add_entry(true, invalid_id, GIT_FILEMODE_BLOB);
+ test_add_entry(true, invalid_id, GIT_FILEMODE_BLOB_EXECUTABLE);
+ test_add_entry(true, invalid_id, GIT_FILEMODE_LINK);
- /* test that we validate the types of objects */
- test_add_entry(false, valid_commit_id, GIT_FILEMODE_BLOB);
- test_add_entry(false, valid_tree_id, GIT_FILEMODE_BLOB_EXECUTABLE);
- test_add_entry(false, valid_commit_id, GIT_FILEMODE_LINK);
+ /* test that we do not validate the types of objects */
+ test_add_entry(true, valid_commit_id, GIT_FILEMODE_BLOB);
+ test_add_entry(true, valid_tree_id, GIT_FILEMODE_BLOB_EXECUTABLE);
+ test_add_entry(true, valid_commit_id, GIT_FILEMODE_LINK);
}