summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-05-10 23:04:59 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2021-05-11 01:29:22 +0100
commitd525e063ba4e478cc4afac4cdf60f7acd989dbf2 (patch)
tree40cad165fb5324ae430ebccdf7a1cc7de6687472 /tests
parent4bd172087c30e09e7720a7df11cace47ee002256 (diff)
downloadlibgit2-d525e063ba4e478cc4afac4cdf60f7acd989dbf2.tar.gz
buf: remove internal `git_buf_text` namespace
The `git_buf_text` namespace is unnecessary and strange. Remove it, just keep the functions prefixed with `git_buf`.
Diffstat (limited to 'tests')
-rw-r--r--tests/apply/fromdiff.c1
-rw-r--r--tests/apply/fromfile.c1
-rw-r--r--tests/apply/partial.c1
-rw-r--r--tests/core/buffer.c89
-rw-r--r--tests/diff/patch.c1
-rw-r--r--tests/diff/rename.c3
-rw-r--r--tests/filter/custom.c1
-rw-r--r--tests/filter/custom_helpers.c1
-rw-r--r--tests/filter/stream.c1
-rw-r--r--tests/filter/wildcard.c1
-rw-r--r--tests/mailmap/parsing.c3
-rw-r--r--tests/object/blob/filter.c3
12 files changed, 47 insertions, 59 deletions
diff --git a/tests/apply/fromdiff.c b/tests/apply/fromdiff.c
index e9329f6d3..69dfe0987 100644
--- a/tests/apply/fromdiff.c
+++ b/tests/apply/fromdiff.c
@@ -3,7 +3,6 @@
#include "apply.h"
#include "repository.h"
-#include "buf_text.h"
#include "../patch/patch_common.h"
diff --git a/tests/apply/fromfile.c b/tests/apply/fromfile.c
index 477e283ad..ae519eab0 100644
--- a/tests/apply/fromfile.c
+++ b/tests/apply/fromfile.c
@@ -5,7 +5,6 @@
#include "patch.h"
#include "patch_parse.h"
#include "repository.h"
-#include "buf_text.h"
#include "../patch/patch_common.h"
diff --git a/tests/apply/partial.c b/tests/apply/partial.c
index 466a92717..548faaadb 100644
--- a/tests/apply/partial.c
+++ b/tests/apply/partial.c
@@ -3,7 +3,6 @@
#include "apply.h"
#include "repository.h"
-#include "buf_text.h"
#include "../patch/patch_common.h"
diff --git a/tests/core/buffer.c b/tests/core/buffer.c
index 4e895afd9..22fa75e39 100644
--- a/tests/core/buffer.c
+++ b/tests/core/buffer.c
@@ -1,6 +1,5 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#include "buf_text.h"
#include "git2/sys/hashsig.h"
#include "futils.h"
@@ -644,37 +643,37 @@ void test_core_buffer__11(void)
t.strings = t1;
t.count = 3;
- cl_git_pass(git_buf_text_common_prefix(&a, &t));
+ cl_git_pass(git_buf_common_prefix(&a, &t));
cl_assert_equal_s(a.ptr, "");
t.strings = t2;
t.count = 3;
- cl_git_pass(git_buf_text_common_prefix(&a, &t));
+ cl_git_pass(git_buf_common_prefix(&a, &t));
cl_assert_equal_s(a.ptr, "some");
t.strings = t3;
t.count = 3;
- cl_git_pass(git_buf_text_common_prefix(&a, &t));
+ cl_git_pass(git_buf_common_prefix(&a, &t));
cl_assert_equal_s(a.ptr, "");
t.strings = t4;
t.count = 3;
- cl_git_pass(git_buf_text_common_prefix(&a, &t));
+ cl_git_pass(git_buf_common_prefix(&a, &t));
cl_assert_equal_s(a.ptr, "happ");
t.strings = t5;
t.count = 3;
- cl_git_pass(git_buf_text_common_prefix(&a, &t));
+ cl_git_pass(git_buf_common_prefix(&a, &t));
cl_assert_equal_s(a.ptr, "happ");
t.strings = t6;
t.count = 3;
- cl_git_pass(git_buf_text_common_prefix(&a, &t));
+ cl_git_pass(git_buf_common_prefix(&a, &t));
cl_assert_equal_s(a.ptr, "");
t.strings = t7;
t.count = 3;
- cl_git_pass(git_buf_text_common_prefix(&a, &t));
+ cl_git_pass(git_buf_common_prefix(&a, &t));
cl_assert_equal_s(a.ptr, "");
git_buf_dispose(&a);
@@ -709,19 +708,19 @@ void test_core_buffer__puts_escaped(void)
git_buf a = GIT_BUF_INIT;
git_buf_clear(&a);
- cl_git_pass(git_buf_text_puts_escaped(&a, "this is a test", "", ""));
+ cl_git_pass(git_buf_puts_escaped(&a, "this is a test", "", ""));
cl_assert_equal_s("this is a test", a.ptr);
git_buf_clear(&a);
- cl_git_pass(git_buf_text_puts_escaped(&a, "this is a test", "t", "\\"));
+ cl_git_pass(git_buf_puts_escaped(&a, "this is a test", "t", "\\"));
cl_assert_equal_s("\\this is a \\tes\\t", a.ptr);
git_buf_clear(&a);
- cl_git_pass(git_buf_text_puts_escaped(&a, "this is a test", "i ", "__"));
+ cl_git_pass(git_buf_puts_escaped(&a, "this is a test", "i ", "__"));
cl_assert_equal_s("th__is__ __is__ a__ test", a.ptr);
git_buf_clear(&a);
- cl_git_pass(git_buf_text_puts_escape_regex(&a, "^match\\s*[A-Z]+.*"));
+ cl_git_pass(git_buf_puts_escape_regex(&a, "^match\\s*[A-Z]+.*"));
cl_assert_equal_s("\\^match\\\\s\\*\\[A-Z\\]\\+\\.\\*", a.ptr);
git_buf_dispose(&a);
@@ -731,7 +730,7 @@ static void assert_unescape(char *expected, char *to_unescape) {
git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_buf_sets(&buf, to_unescape));
- git_buf_text_unescape(&buf);
+ git_buf_unescape(&buf);
cl_assert_equal_s(expected, buf.ptr);
cl_assert_equal_sz(strlen(expected), buf.size);
@@ -864,20 +863,20 @@ void test_core_buffer__classify_with_utf8(void)
git_buf b;
b.ptr = data0; b.size = b.asize = data0len;
- cl_assert(!git_buf_text_is_binary(&b));
- cl_assert(!git_buf_text_contains_nul(&b));
+ cl_assert(!git_buf_is_binary(&b));
+ cl_assert(!git_buf_contains_nul(&b));
b.ptr = data1; b.size = b.asize = data1len;
- cl_assert(!git_buf_text_is_binary(&b));
- cl_assert(!git_buf_text_contains_nul(&b));
+ cl_assert(!git_buf_is_binary(&b));
+ cl_assert(!git_buf_contains_nul(&b));
b.ptr = data2; b.size = b.asize = data2len;
- cl_assert(git_buf_text_is_binary(&b));
- cl_assert(git_buf_text_contains_nul(&b));
+ cl_assert(git_buf_is_binary(&b));
+ cl_assert(git_buf_contains_nul(&b));
b.ptr = data3; b.size = b.asize = data3len;
- cl_assert(!git_buf_text_is_binary(&b));
- cl_assert(!git_buf_text_contains_nul(&b));
+ cl_assert(!git_buf_is_binary(&b));
+ cl_assert(!git_buf_contains_nul(&b));
}
#define SIMILARITY_TEST_DATA_1 \
@@ -1074,80 +1073,80 @@ void test_core_buffer__lf_and_crlf_conversions(void)
git_buf_sets(&src, "lf\nlf\nlf\nlf\n");
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf("lf\r\nlf\r\nlf\r\nlf\r\n", tgt);
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf(src.ptr, tgt);
git_buf_sets(&src, "\nlf\nlf\nlf\nlf\nlf");
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf("\r\nlf\r\nlf\r\nlf\r\nlf\r\nlf", tgt);
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf(src.ptr, tgt);
/* CRLF source */
git_buf_sets(&src, "crlf\r\ncrlf\r\ncrlf\r\ncrlf\r\n");
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf("crlf\r\ncrlf\r\ncrlf\r\ncrlf\r\n", tgt);
git_buf_sets(&src, "crlf\r\ncrlf\r\ncrlf\r\ncrlf\r\n");
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf("crlf\ncrlf\ncrlf\ncrlf\n", tgt);
git_buf_sets(&src, "\r\ncrlf\r\ncrlf\r\ncrlf\r\ncrlf\r\ncrlf");
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf("\r\ncrlf\r\ncrlf\r\ncrlf\r\ncrlf\r\ncrlf", tgt);
git_buf_sets(&src, "\r\ncrlf\r\ncrlf\r\ncrlf\r\ncrlf\r\ncrlf");
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf("\ncrlf\ncrlf\ncrlf\ncrlf\ncrlf", tgt);
/* CRLF in LF text */
git_buf_sets(&src, "\nlf\nlf\ncrlf\r\nlf\nlf\ncrlf\r\n");
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf("\r\nlf\r\nlf\r\ncrlf\r\nlf\r\nlf\r\ncrlf\r\n", tgt);
git_buf_sets(&src, "\nlf\nlf\ncrlf\r\nlf\nlf\ncrlf\r\n");
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf("\nlf\nlf\ncrlf\nlf\nlf\ncrlf\n", tgt);
/* LF in CRLF text */
git_buf_sets(&src, "\ncrlf\r\ncrlf\r\nlf\ncrlf\r\ncrlf");
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf("\r\ncrlf\r\ncrlf\r\nlf\r\ncrlf\r\ncrlf", tgt);
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf("\ncrlf\ncrlf\nlf\ncrlf\ncrlf", tgt);
/* bare CR test */
git_buf_sets(&src, "\rcrlf\r\nlf\nlf\ncr\rcrlf\r\nlf\ncr\r");
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf("\rcrlf\r\nlf\r\nlf\r\ncr\rcrlf\r\nlf\r\ncr\r", tgt);
git_buf_sets(&src, "\rcrlf\r\nlf\nlf\ncr\rcrlf\r\nlf\ncr\r");
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf("\rcrlf\nlf\nlf\ncr\rcrlf\nlf\ncr\r", tgt);
git_buf_sets(&src, "\rcr\r");
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf(src.ptr, tgt);
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf("\rcr\r", tgt);
git_buf_dispose(&src);
@@ -1156,37 +1155,37 @@ void test_core_buffer__lf_and_crlf_conversions(void)
/* blob correspondence tests */
git_buf_sets(&src, ALL_CRLF_TEXT_RAW);
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf(ALL_CRLF_TEXT_AS_CRLF, tgt);
git_buf_sets(&src, ALL_CRLF_TEXT_RAW);
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf(ALL_CRLF_TEXT_AS_LF, tgt);
git_buf_dispose(&src);
git_buf_dispose(&tgt);
git_buf_sets(&src, ALL_LF_TEXT_RAW);
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf(ALL_LF_TEXT_AS_CRLF, tgt);
git_buf_sets(&src, ALL_LF_TEXT_RAW);
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf(ALL_LF_TEXT_AS_LF, tgt);
git_buf_dispose(&src);
git_buf_dispose(&tgt);
git_buf_sets(&src, MORE_CRLF_TEXT_RAW);
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf(MORE_CRLF_TEXT_AS_CRLF, tgt);
git_buf_sets(&src, MORE_CRLF_TEXT_RAW);
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf(MORE_CRLF_TEXT_AS_LF, tgt);
git_buf_dispose(&src);
git_buf_dispose(&tgt);
git_buf_sets(&src, MORE_LF_TEXT_RAW);
- cl_git_pass(git_buf_text_lf_to_crlf(&tgt, &src));
+ cl_git_pass(git_buf_lf_to_crlf(&tgt, &src));
check_buf(MORE_LF_TEXT_AS_CRLF, tgt);
git_buf_sets(&src, MORE_LF_TEXT_RAW);
- cl_git_pass(git_buf_text_crlf_to_lf(&tgt, &src));
+ cl_git_pass(git_buf_crlf_to_lf(&tgt, &src));
check_buf(MORE_LF_TEXT_AS_LF, tgt);
git_buf_dispose(&src);
git_buf_dispose(&tgt);
diff --git a/tests/diff/patch.c b/tests/diff/patch.c
index 7eb353627..d288bba58 100644
--- a/tests/diff/patch.c
+++ b/tests/diff/patch.c
@@ -4,7 +4,6 @@
#include "diff_helpers.h"
#include "diff.h"
#include "repository.h"
-#include "buf_text.h"
static git_repository *g_repo = NULL;
diff --git a/tests/diff/rename.c b/tests/diff/rename.c
index df32eebf2..aaae3e95b 100644
--- a/tests/diff/rename.c
+++ b/tests/diff/rename.c
@@ -1,6 +1,5 @@
#include "clar_libgit2.h"
#include "diff_helpers.h"
-#include "buf_text.h"
static git_repository *g_repo = NULL;
@@ -513,7 +512,7 @@ void test_diff_rename__working_directory_changes(void)
cl_git_pass(
git_futils_readbuffer(&old_content, "renames/songof7cities.txt"));
cl_git_pass(
- git_buf_text_lf_to_crlf(&content, &old_content));
+ git_buf_lf_to_crlf(&content, &old_content));
cl_git_pass(
git_futils_writebuffer(&content, "renames/songof7cities.txt", 0, 0));
diff --git a/tests/filter/custom.c b/tests/filter/custom.c
index fe2025fc2..8626e4b7c 100644
--- a/tests/filter/custom.c
+++ b/tests/filter/custom.c
@@ -2,7 +2,6 @@
#include "posix.h"
#include "blob.h"
#include "filter.h"
-#include "buf_text.h"
#include "git2/sys/filter.h"
#include "git2/sys/repository.h"
#include "custom_helpers.h"
diff --git a/tests/filter/custom_helpers.c b/tests/filter/custom_helpers.c
index d7f2afe7a..233ba3219 100644
--- a/tests/filter/custom_helpers.c
+++ b/tests/filter/custom_helpers.c
@@ -1,7 +1,6 @@
#include "clar_libgit2.h"
#include "posix.h"
#include "filter.h"
-#include "buf_text.h"
#include "git2/sys/filter.h"
#define VERY_SECURE_ENCRYPTION(b) ((b) ^ 0xff)
diff --git a/tests/filter/stream.c b/tests/filter/stream.c
index 226092c3f..b6a4c3ca1 100644
--- a/tests/filter/stream.c
+++ b/tests/filter/stream.c
@@ -2,7 +2,6 @@
#include "posix.h"
#include "blob.h"
#include "filter.h"
-#include "buf_text.h"
#include "git2/sys/filter.h"
#include "git2/sys/repository.h"
diff --git a/tests/filter/wildcard.c b/tests/filter/wildcard.c
index 3c25ea266..42f296054 100644
--- a/tests/filter/wildcard.c
+++ b/tests/filter/wildcard.c
@@ -2,7 +2,6 @@
#include "posix.h"
#include "blob.h"
#include "filter.h"
-#include "buf_text.h"
#include "git2/sys/filter.h"
#include "git2/sys/repository.h"
#include "custom_helpers.h"
diff --git a/tests/mailmap/parsing.c b/tests/mailmap/parsing.c
index e2ab05c99..ba3b3a2f6 100644
--- a/tests/mailmap/parsing.c
+++ b/tests/mailmap/parsing.c
@@ -2,7 +2,6 @@
#include "repository.h"
#include "git2/sys/repository.h"
#include "mailmap_testdata.h"
-#include "buf_text.h"
static git_repository *g_repo;
static git_mailmap *g_mailmap;
@@ -109,7 +108,7 @@ void test_mailmap_parsing__windows_string(void)
/* Parse with windows-style line endings */
git_buf_attach_notowned(&unixbuf, string_mailmap, strlen(string_mailmap));
- cl_git_pass(git_buf_text_lf_to_crlf(&winbuf, &unixbuf));
+ cl_git_pass(git_buf_lf_to_crlf(&winbuf, &unixbuf));
cl_git_pass(git_mailmap_from_buffer(&g_mailmap, winbuf.ptr, winbuf.size));
git_buf_dispose(&winbuf);
diff --git a/tests/object/blob/filter.c b/tests/object/blob/filter.c
index 0f0f4845f..a3921f4a0 100644
--- a/tests/object/blob/filter.c
+++ b/tests/object/blob/filter.c
@@ -1,7 +1,6 @@
#include "clar_libgit2.h"
#include "posix.h"
#include "blob.h"
-#include "buf_text.h"
static git_repository *g_repo = NULL;
@@ -97,7 +96,7 @@ void test_object_blob_filter__stats(void)
for (i = 0; i < CRLF_NUM_TEST_OBJECTS; i++) {
cl_git_pass(git_blob_lookup(&blob, g_repo, &g_crlf_oids[i]));
cl_git_pass(git_blob__getbuf(&buf, blob));
- git_buf_text_gather_stats(&stats, &buf, false);
+ git_buf_gather_text_stats(&stats, &buf, false);
cl_assert_equal_i(
0, memcmp(&g_crlf_filtered_stats[i], &stats, sizeof(stats)));
git_blob_free(blob);