aboutsummaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2008-09-05 20:53:30 +0000
committerWillem Jan Palenstijn2008-09-05 20:53:30 +0000
commitb00f8dc2ed09c828747574a23a7538bb068931f5 (patch)
tree5034f46fb94c12de805befe4a1b914385ad13b7c /test/common
parente994723e7c6f8c800bc9e9aea567cf9ebda1ed9d (diff)
downloadscummvm-rg350-b00f8dc2ed09c828747574a23a7538bb068931f5.tar.gz
scummvm-rg350-b00f8dc2ed09c828747574a23a7538bb068931f5.tar.bz2
scummvm-rg350-b00f8dc2ed09c828747574a23a7538bb068931f5.zip
additional Common::String tests
svn-id: r34369
Diffstat (limited to 'test/common')
-rw-r--r--test/common/str.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h
index a94ec3227f..c352bd1887 100644
--- a/test/common/str.h
+++ b/test/common/str.h
@@ -158,6 +158,25 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS(str2, "Test it, NOW! 42");
}
+ void test_deleteChar( void )
+ {
+ Common::String str("01234567890123456789012345678901");
+ str.deleteChar(10);
+ TS_ASSERT_EQUALS( str, "0123456789123456789012345678901" );
+ str.deleteChar(10);
+ TS_ASSERT_EQUALS( str, "012345678923456789012345678901" );
+ }
+
+ void test_sharing( void )
+ {
+ Common::String str("01234567890123456789012345678901");
+ Common::String str2(str);
+ TS_ASSERT_EQUALS( str2, "01234567890123456789012345678901" );
+ str.deleteLastChar();
+ TS_ASSERT_EQUALS( str, "0123456789012345678901234567890" );
+ TS_ASSERT_EQUALS( str2, "01234567890123456789012345678901" );
+ }
+
void test_lastPathComponent(void) {
TS_ASSERT(Common::lastPathComponent("/", '/') == "");
TS_ASSERT(Common::lastPathComponent("/foo/bar", '/') == "bar");