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

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: Faster replacement + added unit tests 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..33eec46eeb618ec13cd60e8dad40df697ad1534c 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -148,6 +148,21 @@ DEF_TEST(String, reporter) {
a.appendU64(0x0000000001000000ULL, 15);
REPORTER_ASSERT(reporter, a.equals("000000016777216"));
+ a.set("hello world");
tfarina 2014/06/13 17:02:10 If Elliot and Mike don't mind, could you set up a
+ 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(""));
+
static const struct {
SkScalar fValue;
const char* fString;
« 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