aboutsummaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
Diffstat (limited to 'test/common')
-rw-r--r--test/common/str.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h
index b7ad28e56e..9f8c6fbd60 100644
--- a/test/common/str.h
+++ b/test/common/str.h
@@ -443,6 +443,28 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_LESS_THAN(scumm_strnicmp("abCd", "ABCde", 5), 0);
}
+ void test_wordWrap() {
+ Common::String testString("123456");
+ testString.wordWrap(10);
+ TS_ASSERT(testString == "123456");
+ testString.wordWrap(2);
+ TS_ASSERT(testString == "12\n34\n56");
+ testString = "1234 5678";
+ testString.wordWrap(4);
+ TS_ASSERT(testString == "1234\n5678");
+ testString = "12 3 45";
+ testString.wordWrap(4);
+ TS_ASSERT(testString == "12 3\n45");
+ testString = "\n1\n23 45\n\n";
+ testString.wordWrap(3);
+ TS_ASSERT(testString == "\n1\n23\n45\n\n");
+ testString = "123 ";
+ testString.wordWrap(4);
+ TS_ASSERT(testString == "123 ");
+ testString.wordWrap(3);
+ TS_ASSERT(testString == "123\n");
+ }
+
void test_replace() {
// Tests created with the results of the STL std::string class