diff options
| author | Russell Belfer <rb@github.com> | 2014-05-12 14:38:39 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2014-05-15 14:11:19 -0700 |
| commit | 575f107704255254f52d197240d55f2030af0454 (patch) | |
| tree | af5149788297f3e9ec17992b342a3005eab36e31 /tests/object/raw | |
| parent | 88b1b36dfcc6b406f2b6f21e0e042071984b3b90 (diff) | |
| download | libgit2-rb/object-parse-flexibility.tar.gz | |
Add lax parsing for commit and tag objectsrb/object-parse-flexibility
This changes the behavior of object parsing for commits and tags
so that even when bad data is found inside the object, we will
continue to try to parse as much of the object as we can. The
existing functions (`git_object_lookup` for example) will still
delete the partially parsed object before returning an error, but
this also adds a new function `git_object_lookup_lax` that will
still return the error, but will also return the object with the
partial data (if we got far enough along in the parsing process to
even create the base object).
Diffstat (limited to 'tests/object/raw')
| -rw-r--r-- | tests/object/raw/type2string.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/object/raw/type2string.c b/tests/object/raw/type2string.c index a3585487f..45045a062 100644 --- a/tests/object/raw/type2string.c +++ b/tests/object/raw/type2string.c @@ -23,17 +23,17 @@ void test_object_raw_type2string__convert_type_to_string(void) void test_object_raw_type2string__convert_string_to_type(void) { - cl_assert(git_object_string2type(NULL) == GIT_OBJ_BAD); - cl_assert(git_object_string2type("") == GIT_OBJ_BAD); - cl_assert(git_object_string2type("commit") == GIT_OBJ_COMMIT); - cl_assert(git_object_string2type("tree") == GIT_OBJ_TREE); - cl_assert(git_object_string2type("blob") == GIT_OBJ_BLOB); - cl_assert(git_object_string2type("tag") == GIT_OBJ_TAG); - cl_assert(git_object_string2type("OFS_DELTA") == GIT_OBJ_OFS_DELTA); - cl_assert(git_object_string2type("REF_DELTA") == GIT_OBJ_REF_DELTA); - - cl_assert(git_object_string2type("CoMmIt") == GIT_OBJ_BAD); - cl_assert(git_object_string2type("hohoho") == GIT_OBJ_BAD); + cl_assert(git_object_string2type(NULL, 0) == GIT_OBJ_BAD); + cl_assert(git_object_string2type("", 0) == GIT_OBJ_BAD); + cl_assert(git_object_string2type("commit", 0) == GIT_OBJ_COMMIT); + cl_assert(git_object_string2type("tree", 0) == GIT_OBJ_TREE); + cl_assert(git_object_string2type("blob", 0) == GIT_OBJ_BLOB); + cl_assert(git_object_string2type("tag", 0) == GIT_OBJ_TAG); + cl_assert(git_object_string2type("OFS_DELTA", 0) == GIT_OBJ_OFS_DELTA); + cl_assert(git_object_string2type("REF_DELTA", 0) == GIT_OBJ_REF_DELTA); + + cl_assert(git_object_string2type("CoMmIt", 0) == GIT_OBJ_BAD); + cl_assert(git_object_string2type("hohoho", 0) == GIT_OBJ_BAD); } void test_object_raw_type2string__check_type_is_loose(void) |
