Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: tests/StringTest.cpp

Issue 322253005: add replace_char() method to SkString API (skbug.com/2651) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Shift tests into DEF_TEST as requested Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« include/core/SkString.h ('K') | « src/core/SkString.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/StringTest.cpp
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index 13ee5ec2153ff6da775bef64887fc16f759da2f4..5bf49b17b45eeaa0fbca2c77f46e04377db26b94 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -186,6 +186,23 @@ DEF_TEST(String, reporter) {
}
+DEF_TEST(String_ReplaceChar, r) {
+ a.set("hello world");
+ a.replaceChar('h', 'h');
+ REPORTER_ASSERT(reporter, a.equals("hello world"));
+ a.replaceChar('x', 'x');
+ REPORTER_ASSERT(reporter, a.equals("hello world"));
+ a.replaceChar('o', 'e');
+ REPORTER_ASSERT(reporter, a.equals("helle werld"));
+ a.replaceChar('x', 'e');
+ REPORTER_ASSERT(reporter, a.equals("helle werld"));
+ a.replaceChar('x', 'z');
+ REPORTER_ASSERT(reporter, a.equals("helle werld"));
+ a.set("");
+ a.replaceChar('a', 'b');
+ REPORTER_ASSERT(reporter, a.equals(""));
+}
+
DEF_TEST(String_SkStrSplit, r) {
SkTArray<SkString> results;
« include/core/SkString.h ('K') | « src/core/SkString.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698