10000 Add files and tests with many UTF-8 chars and few UTF-8 chars · libgit2/libgit2@b4c6a9d · GitHub
[go: up one dir, main page]

Skip to content

Commit b4c6a9d

Browse files
linquizeEdward Thomson
authored andcommitted
Add files and tests with many UTF-8 chars and few UTF-8 chars
1 parent 0161e09 commit b4c6a9d

9 files changed

+31
-1
lines changed

tests/checkout/crlf.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,31 @@ void test_checkout_crlf__all_crlf_autocrlf_true(void)
106106
check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_RAW);
107107
}
108108

109+
void test_checkout_crlf__detect_crlf_autocrlf_true_utf8(void)
110+
{
111+
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
112+
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
113+
114+
cl_repo_set_bool(g_repo, "core.autocrlf", true);
115+
116+
git_repository_set_head(g_repo, "refs/heads/utf8", NULL, NULL);
117+
git_checkout_head(g_repo, &opts);
118+
119+
if (GIT_EOL_NATIVE == GIT_EOL_LF)
120+
{
121+
check_file_contents("./crlf/few-utf8-chars-lf.txt", FEW_UTF8_LF_RAW);
122+
check_file_contents("./crlf/many-utf8-chars-lf.txt", MANY_UTF8_LF_RAW);
123+
}
124+
else
125+
{
126+
check_file_contents("./crlf/few-utf8-chars-lf.txt", FEW_UTF8_CRLF_RAW);
127+
check_file_contents("./crlf/many-utf8-chars-lf.txt", MANY_UTF8_CRLF_RAW);
128+
}
129+
130+
check_file_contents("./crlf/few-utf8-chars-crlf.txt", FEW_UTF8_CRLF_RAW);
131+
check_file_contents("./crlf/many-utf8-chars-crlf.txt", MANY_UTF8_CRLF_RAW);
132+
}
133+
109134
void test_checkout_crlf__autocrlf_true_index_size_is_filtered_size(void)
110135
{
111136
git_index *index;

tests/filter/crlf.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@
2222
#define MORE_CRLF_TEXT_AS_LF "crlf\ncrlf\nlf\ncrlf\ncrlf\n"
2323
#define MORE_LF_TEXT_AS_LF "lf\nlf\ncrlf\nlf\nlf\n"
2424

25+
#define FEW_UTF8_CRLF_RAW "\xe2\x9a\xbdThe rest is ASCII01.\r\nThe rest is ASCII02.\r\nThe rest is ASCII03.\r\nThe rest is ASCII04.\r\nThe rest is ASCII05.\r\nThe rest is ASCII06.\r\nThe rest is ASCII07.\r\nThe rest is ASCII08.\r\nThe rest is ASCII09.\r\nThe rest is ASCII10.\r\nThe rest is ASCII11.\r\nThe rest is ASCII12.\r\nThe rest is ASCII13.\r\nThe rest is ASCII14.\r\nThe rest is ASCII15.\r\nThe rest is ASCII16.\r\nThe rest is ASCII17.\r\nThe rest is ASCII18.\r\nThe rest is ASCII19.\r\nThe rest is ASCII20.\r\nThe rest is ASCII21.\r\nThe rest is ASCII22.\r\n"
26+
#define FEW_UTF8_LF_RAW "\xe2\x9a\xbdThe rest is ASCII01.\nThe rest is ASCII02.\nThe rest is ASCII03.\nThe rest is ASCII04.\nThe rest is ASCII05.\nThe rest is ASCII06.\nThe rest is ASCII07.\nThe rest is ASCII08.\nThe rest is ASCII09.\nThe rest is ASCII10.\nThe rest is ASCII11.\nThe rest is ASCII12.\nThe rest is ASCII13.\nThe rest is ASCII14.\nThe rest is ASCII15.\nThe rest is ASCII16.\nThe rest is ASCII17.\nThe rest is ASCII18.\nThe rest is ASCII19.\nThe rest is ASCII20.\nThe rest is ASCII21.\nThe rest is ASCII22.\n"
27+
#define MANY_UTF8_CRLF_RAW "Lets sing!\r\n\xe2\x99\xab\xe2\x99\xaa\xe2\x99\xac\xe2\x99\xa9\r\nEat food\r\n\xf0\x9f\x8d\x85\xf0\x9f\x8d\x95\r\n"
28+
#define MANY_UTF8_LF_RAW "Lets sing!\n\xe2\x99\xab\xe2\x99\xaa\xe2\x99\xac\xe2\x99\xa9\nEat food\n\xf0\x9f\x8d\x85\xf0\x9f\x8d\x95\n"
29+
2530
#endif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2b55b4b94f655c857635b6a9005c056aa7de3532
1+
a234455d62297f1856c4603686150c59fcb0aafe

0 commit comments

Comments
 (0)
0