Change testWrapRows() data to wrap at multibyte char

This commit is contained in:
figec 2015-06-18 23:49:53 +03:00
parent 22b8b965a1
commit 5b99254d04
1 changed files with 4 additions and 5 deletions

View File

@ -244,12 +244,11 @@ void TestUtilities::testWrapRows()
UASSERT(wrap_rows("12345678",4) == "1234\n5678");
// test that wrap_rows doesn't wrap inside multibyte sequences
const unsigned char s[] = {
0x2f, 0x68, 0x6f, 0x6d, 0x65, 0x2f, 0x72, 0x61, 0x70, 0x74, 0x6f,
0x72, 0x2f, 0xd1, 0x82, 0xd0, 0xb5, 0xd1, 0x81, 0xd1, 0x82, 0x2f,
0x6d, 0x69, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x62, 0x69,
0x6e, 0x2f, 0x2e, 0x2e, 0};
0x74, 0x65, 0x73, 0x74, 0x20, 0xd1, 0x82, 0xd0, 0xb5, 0xd1, 0x81,
0xd1, 0x82, 0x20, 0xd1, 0x82, 0xd0, 0xb5, 0xd1, 0x81, 0xd1, 0x82,
0x20, 0xd1, 0x82, 0xd0, 0xb5, 0xd1, 0x81, 0xd1, 0x82, 0};
std::string str((char *)s);
UASSERT(utf8_to_wide(wrap_rows(str, 20)) != L"<invalid UTF-8 string>");
UASSERT(utf8_to_wide(wrap_rows(str, 8)) != L"<invalid UTF-8 string>");
}