aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/StringTest.cpp
diff options
context:
space:
mode:
authorGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-27 17:11:31 +0000
committerGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-27 17:11:31 +0000
commitc4ae974db67977e766b66fb42e58e088c6381e29 (patch)
treefdded56573d2214abed88d8f0a83bcf22e54504e /tests/StringTest.cpp
parent8d033a1b125886c62906d975b5cc28a382064526 (diff)
Add SkString.contains()
Review URL: https://codereview.appspot.com/6130046 git-svn-id: http://skia.googlecode.com/svn/trunk@3781 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/StringTest.cpp')
-rw-r--r--tests/StringTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index 52a038db44..ebf7006275 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -56,6 +56,19 @@ static void TestString(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, a.equals("hello"));
REPORTER_ASSERT(reporter, !a.equals("help"));
+ REPORTER_ASSERT(reporter, a.startsWith("hell"));
+ REPORTER_ASSERT(reporter, !a.startsWith( "ell"));
+ REPORTER_ASSERT(reporter, a.startsWith(""));
+ REPORTER_ASSERT(reporter, a.endsWith("llo"));
+ REPORTER_ASSERT(reporter, !a.endsWith("ll" ));
+ REPORTER_ASSERT(reporter, a.endsWith(""));
+ REPORTER_ASSERT(reporter, a.contains("he"));
+ REPORTER_ASSERT(reporter, a.contains("ll"));
+ REPORTER_ASSERT(reporter, a.contains("lo"));
+ REPORTER_ASSERT(reporter, a.contains("hello"));
+ REPORTER_ASSERT(reporter, !a.contains("hellohello"));
+ REPORTER_ASSERT(reporter, a.contains(""));
+
SkString e(a);
SkString f("hello");
SkString g("helloz", 5);