diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-08 17:38:30 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-08 17:38:30 +0000 |
commit | d0767cb54b2b5ee4d9cf00b3ee0fa585826b4036 (patch) | |
tree | 1c2ee733bf62a44c31dc11f76dad53243a84439f /base/string_util_unittest.cc | |
parent | e91d532339c854ff0a082c6562a519647524fa66 (diff) | |
download | chromium_src-d0767cb54b2b5ee4d9cf00b3ee0fa585826b4036.zip chromium_src-d0767cb54b2b5ee4d9cf00b3ee0fa585826b4036.tar.gz chromium_src-d0767cb54b2b5ee4d9cf00b3ee0fa585826b4036.tar.bz2 |
Separate out some more ICU from base and into base/i18n.
This moves string_util_icu. I moved the number formatting function into
base/i18n/number_formatting and just removed the other function in
string_util_icu which was TrimWhitespaceUTF8. It is only used in a few places
and isn't actually helpful (and the fact that it round-trips through UTF-16 is
better for the caller to see).
This takes out the sorting from the FileEnumerator. The comment says the
sorting is not guaranteed. I moved it into file_util_icu as a standalone
function for callers of FileEnumerator to call manually if they need sorted
results. I modified the directory lister to use this sorting instead, and filed
a bug on doing more optimal JS-based sorting.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/267001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util_unittest.cc')
-rw-r--r-- | base/string_util_unittest.cc | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc index 2723541..a70b03e 100644 --- a/base/string_util_unittest.cc +++ b/base/string_util_unittest.cc @@ -100,52 +100,6 @@ TEST(StringUtilTest, TrimWhitespace) { } } -static const struct trim_case_utf8 { - const char* input; - const TrimPositions positions; - const char* output; - const TrimPositions return_value; -} trim_cases_utf8[] = { - // UTF-8 strings that start (and end) with Unicode space characters - // (including zero-width spaces). - {"\xE2\x80\x80Test String\xE2\x80\x81", TRIM_ALL, "Test String", TRIM_ALL}, - {"\xE2\x80\x82Test String\xE2\x80\x83", TRIM_ALL, "Test String", TRIM_ALL}, - {"\xE2\x80\x84Test String\xE2\x80\x85", TRIM_ALL, "Test String", TRIM_ALL}, - {"\xE2\x80\x86Test String\xE2\x80\x87", TRIM_ALL, "Test String", TRIM_ALL}, - {"\xE2\x80\x88Test String\xE2\x80\x8A", TRIM_ALL, "Test String", TRIM_ALL}, - {"\xE3\x80\x80Test String\xE3\x80\x80", TRIM_ALL, "Test String", TRIM_ALL}, - // UTF-8 strings that end with 0x85 (NEL in ISO-8859). - {"\xD0\x85", TRIM_TRAILING, "\xD0\x85", TRIM_NONE}, - {"\xD9\x85", TRIM_TRAILING, "\xD9\x85", TRIM_NONE}, - {"\xEC\x97\x85", TRIM_TRAILING, "\xEC\x97\x85", TRIM_NONE}, - {"\xF0\x90\x80\x85", TRIM_TRAILING, "\xF0\x90\x80\x85", TRIM_NONE}, - // UTF-8 strings that end with 0xA0 (non-break space in ISO-8859-1). - {"\xD0\xA0", TRIM_TRAILING, "\xD0\xA0", TRIM_NONE}, - {"\xD9\xA0", TRIM_TRAILING, "\xD9\xA0", TRIM_NONE}, - {"\xEC\x97\xA0", TRIM_TRAILING, "\xEC\x97\xA0", TRIM_NONE}, - {"\xF0\x90\x80\xA0", TRIM_TRAILING, "\xF0\x90\x80\xA0", TRIM_NONE}, -}; - -TEST(StringUtilTest, TrimWhitespaceUTF8) { - std::string output_ascii; - for (size_t i = 0; i < arraysize(trim_cases_ascii); ++i) { - const trim_case_ascii& value = trim_cases_ascii[i]; - EXPECT_EQ(value.return_value, - TrimWhitespaceASCII(value.input, value.positions, &output_ascii)); - EXPECT_EQ(value.output, output_ascii); - } - - // Test that TrimWhiteSpaceUTF8() can remove Unicode space characters and - // prevent from removing UTF-8 characters that end with an ISO-8859 NEL. - std::string output_utf8; - for (size_t i = 0; i < arraysize(trim_cases_utf8); ++i) { - const trim_case_utf8& value = trim_cases_utf8[i]; - EXPECT_EQ(value.return_value, - TrimWhitespaceUTF8(value.input, value.positions, &output_utf8)); - EXPECT_EQ(value.output, output_utf8); - } -} - static const struct collapse_case { const wchar_t* input; const bool trim; |