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:
Diffstat (limited to 'tests/filter/blob.c')
-rw-r--r--tests/filter/blob.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/filter/blob.c b/tests/filter/blob.c
index 9600a9779..8dce6470a 100644
--- a/tests/filter/blob.c
+++ b/tests/filter/blob.c
@@ -47,6 +47,38 @@ void test_filter_blob__all_crlf(void)
git_blob_free(blob);
}
+void test_filter_blob__sanitizes(void)
+{
+ git_blob *blob;
+ git_buf buf;
+
+ cl_git_pass(git_revparse_single(
+ (git_object **)&blob, g_repo, "e69de29")); /* zero-byte */
+
+ cl_assert_equal_i(0, git_blob_rawsize(blob));
+ cl_assert_equal_s("", git_blob_rawcontent(blob));
+
+ memset(&buf, 0, sizeof(git_buf));
+ cl_git_pass(git_blob_filtered_content(&buf, blob, "file.bin", 1));
+ cl_assert_equal_sz(0, buf.size);
+ cl_assert_equal_s("", buf.ptr);
+ git_buf_free(&buf);
+
+ memset(&buf, 0, sizeof(git_buf));
+ cl_git_pass(git_blob_filtered_content(&buf, blob, "file.crlf", 1));
+ cl_assert_equal_sz(0, buf.size);
+ cl_assert_equal_s("", buf.ptr);
+ git_buf_free(&buf);
+
+ memset(&buf, 0, sizeof(git_buf));
+ cl_git_pass(git_blob_filtered_content(&buf, blob, "file.lf", 1));
+ cl_assert_equal_sz(0, buf.size);
+ cl_assert_equal_s("", buf.ptr);
+ git_buf_free(&buf);
+
+ git_blob_free(blob);
+}
+
void test_filter_blob__ident(void)
{
git_oid id;