Chromium Code Reviews| Index: tests/StringTest.cpp |
| diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp |
| index 13ee5ec2153ff6da775bef64887fc16f759da2f4..d2fa1500db28853f2fc6672d0e36ac6284849932 100644 |
| --- a/tests/StringTest.cpp |
| +++ b/tests/StringTest.cpp |
| @@ -183,7 +183,37 @@ DEF_TEST(String, reporter) { |
| REPORTER_ASSERT(reporter, buffer[18] == ' '); |
| REPORTER_ASSERT(reporter, buffer[19] == 0); |
| REPORTER_ASSERT(reporter, buffer[20] == 'a'); |
| +} |
| +DEF_TEST(String_Replace, r) { |
| + SkString str("skia_2d"); |
| + str.replace('_', '-'); |
| + REPORTER_ASSERT(r, str.equals("skia-2d")); |
| + |
| + str.set("meat"); |
| + str.replace('a', 'e'); |
| + REPORTER_ASSERT(r, str.equals("meet")); |
| + |
| + str.set("hello, world!"); |
| + str.replace('h', 'h'); |
| + REPORTER_ASSERT(r, str.equals("hello, world!")); |
| + str.replace('x', 'x'); |
| + REPORTER_ASSERT(r, str.equals("hello, world!")); |
| + str.replace('o', 'u'); |
| + REPORTER_ASSERT(r, str.equals("hellu, wurld!")); |
| + str.replace('x', 'u'); |
| + REPORTER_ASSERT(r, str.equals("hellu, wurld!")); |
| + str.replace('x', 'y'); |
| + REPORTER_ASSERT(r, str.equals("hellu, wurld!")); |
| + |
| + str.set(""); |
| + str.replace('a', 'b'); |
| + REPORTER_ASSERT(r, str.equals("")); |
| + |
| + str.set("\xed\x95\x9c\xea\xb5\xad\xec\x96\xb4"); |
|
tfarina
2014/11/12 01:41:34
Could you suggest another string to test that SkUT
reed1
2014/11/12 14:11:25
Why not build the string with a set of known Unich
|
| + //SkString hangul2("\xb4\x95\x9c\xea\xb5\xad\xec\x96\xb4"); |
| + str.replace('\xed', '\xb4'); |
| + //REPORTER_ASSERT(r, hangul == hangul2); |
| } |
| DEF_TEST(String_SkStrSplit, r) { |