Commit d6d34cd0 by crazymaster

Add test for multi-byte characters

parent 1662158c
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "buf_text.h" #include "buf_text.h"
static git_repository *g_repo = NULL; static git_repository *g_repo = NULL;
#define NUM_TEST_OBJECTS 8 #define NUM_TEST_OBJECTS 9
static git_oid g_oids[NUM_TEST_OBJECTS]; static git_oid g_oids[NUM_TEST_OBJECTS];
static const char *g_raw[NUM_TEST_OBJECTS] = { static const char *g_raw[NUM_TEST_OBJECTS] = {
"", "",
...@@ -15,9 +15,10 @@ static const char *g_raw[NUM_TEST_OBJECTS] = { ...@@ -15,9 +15,10 @@ static const char *g_raw[NUM_TEST_OBJECTS] = {
"foo\nbar\rboth\r\nreversed\n\ragain\nproblems\r", "foo\nbar\rboth\r\nreversed\n\ragain\nproblems\r",
"123\n\000\001\002\003\004abc\255\254\253\r\n", "123\n\000\001\002\003\004abc\255\254\253\r\n",
"\xEF\xBB\xBFThis is UTF-8\n", "\xEF\xBB\xBFThis is UTF-8\n",
"\xEF\xBB\xBFほげほげ\r\nほげほげ\r\n",
"\xFE\xFF\x00T\x00h\x00i\x00s\x00!" "\xFE\xFF\x00T\x00h\x00i\x00s\x00!"
}; };
static git_off_t g_len[NUM_TEST_OBJECTS] = { -1, -1, -1, -1, -1, 17, -1, 12 }; static git_off_t g_len[NUM_TEST_OBJECTS] = { -1, -1, -1, -1, -1, 17, -1, -1, 12 };
static git_buf_text_stats g_stats[NUM_TEST_OBJECTS] = { static git_buf_text_stats g_stats[NUM_TEST_OBJECTS] = {
{ 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 2, 0, 6, 0 }, { 0, 0, 0, 2, 0, 6, 0 },
...@@ -26,6 +27,7 @@ static git_buf_text_stats g_stats[NUM_TEST_OBJECTS] = { ...@@ -26,6 +27,7 @@ static git_buf_text_stats g_stats[NUM_TEST_OBJECTS] = {
{ 0, 0, 4, 4, 1, 31, 0 }, { 0, 0, 4, 4, 1, 31, 0 },
{ 0, 1, 1, 2, 1, 9, 5 }, { 0, 1, 1, 2, 1, 9, 5 },
{ GIT_BOM_UTF8, 0, 0, 1, 0, 16, 0 }, { GIT_BOM_UTF8, 0, 0, 1, 0, 16, 0 },
{ GIT_BOM_UTF8, 0, 2, 2, 2, 27, 0 },
{ GIT_BOM_UTF16_BE, 5, 0, 0, 0, 7, 5 }, { GIT_BOM_UTF16_BE, 5, 0, 0, 0, 7, 5 },
}; };
static git_buf g_crlf_filtered[NUM_TEST_OBJECTS] = { static git_buf g_crlf_filtered[NUM_TEST_OBJECTS] = {
...@@ -36,6 +38,7 @@ static git_buf g_crlf_filtered[NUM_TEST_OBJECTS] = { ...@@ -36,6 +38,7 @@ static git_buf g_crlf_filtered[NUM_TEST_OBJECTS] = {
{ "foo\nbar\rboth\nreversed\n\ragain\nproblems\r", 0, 38 }, { "foo\nbar\rboth\nreversed\n\ragain\nproblems\r", 0, 38 },
{ "123\n\000\001\002\003\004abc\255\254\253\n", 0, 16 }, { "123\n\000\001\002\003\004abc\255\254\253\n", 0, 16 },
{ "\xEF\xBB\xBFThis is UTF-8\n", 0, 17 }, { "\xEF\xBB\xBFThis is UTF-8\n", 0, 17 },
{ "\xEF\xBB\xBFほげほげ\nほげほげ\n", 0, 29 },
{ "\xFE\xFF\x00T\x00h\x00i\x00s\x00!", 0, 12 } { "\xFE\xFF\x00T\x00h\x00i\x00s\x00!", 0, 12 }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment