зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1534878 - xpcom: Re-enable NonASCII16 UTF-16 string tests. r=hsivonen
The NonASCII16 test function was removed in bug 1402247 but the NonASCII16_helper() function was not: https://hg.mozilla.org/mozilla-central/rev/4ef0f163fdeb xpcom/tests/gtest/TestUTF.cpp:119:6 [-Wmissing-prototypes] no previous prototype for function 'NonASCII16_helper' Differential Revision: https://phabricator.services.mozilla.com/D23267 --HG-- extra : rebase_source : c53118479acc6ea866dafb04617bfb2706dddb2b extra : source : de3a70ccef6c09d0d317c7b4b5c1f8a2f93d78c7
This commit is contained in:
Родитель
e9d64cd221
Коммит
d16e0fbd74
|
@ -116,7 +116,7 @@ TEST(UTF, Hash16) {
|
|||
* This tests the handling of a non-ascii character at various locations in a
|
||||
* UTF-16 string that is being converted to UTF-8.
|
||||
*/
|
||||
void NonASCII16_helper(const size_t aStrSize) {
|
||||
static void NonASCII16_helper(const size_t aStrSize) {
|
||||
const size_t kTestSize = aStrSize;
|
||||
const size_t kMaxASCII = 0x80;
|
||||
const char16_t kUTF16Char = 0xC9;
|
||||
|
@ -154,7 +154,7 @@ void NonASCII16_helper(const size_t aStrSize) {
|
|||
// First add the leading ASCII chars.
|
||||
expected.Append(asciiCString.BeginReading(), i);
|
||||
|
||||
// Now append the UTF-8 surrogate pair we expect the UTF-16 unicode char to
|
||||
// Now append the UTF-8 pair we expect the UTF-16 unicode char to
|
||||
// be converted to.
|
||||
for (auto& c : kUTF8Surrogates) {
|
||||
expected.Append(c);
|
||||
|
@ -167,6 +167,15 @@ void NonASCII16_helper(const size_t aStrSize) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(UTF, NonASCII16) {
|
||||
// Test with various string sizes to catch any special casing.
|
||||
NonASCII16_helper(1);
|
||||
NonASCII16_helper(8);
|
||||
NonASCII16_helper(16);
|
||||
NonASCII16_helper(32);
|
||||
NonASCII16_helper(512);
|
||||
}
|
||||
|
||||
TEST(UTF, UTF8CharEnumerator) {
|
||||
const char* p =
|
||||
"\x61\xC0\xC2\xC2\x80\xE0\x80\x80\xE0\xA0\x80\xE1\x80\x80\xED\xBF\xBF\xED"
|
||||
|
|
Загрузка…
Ссылка в новой задаче