diff options
author | Willem Jan Palenstijn | 2009-07-25 10:25:57 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2009-07-25 10:25:57 +0000 |
commit | 744112ceb0731da474604f47d27f413828db7009 (patch) | |
tree | 5321863dd510d46086f2963eddbd96eeb5ca38a5 /test | |
parent | 4463e1c084a4822a2c5c130532964ea3372bdef7 (diff) | |
download | scummvm-rg350-744112ceb0731da474604f47d27f413828db7009.tar.gz scummvm-rg350-744112ceb0731da474604f47d27f413828db7009.tar.bz2 scummvm-rg350-744112ceb0731da474604f47d27f413828db7009.zip |
Add Common::String::printf to format a string
svn-id: r42743
Diffstat (limited to 'test')
-rw-r--r-- | test/common/str.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h index bf0db98b09..f65b078bdc 100644 --- a/test/common/str.h +++ b/test/common/str.h @@ -285,4 +285,12 @@ class StringTestSuite : public CxxTest::TestSuite TS_ASSERT(!Common::matchString("monkey.s99", "monkey.s*1")); TS_ASSERT(Common::matchString("monkey.s101", "monkey.s*1")); } + + void test_string_printf() { + TS_ASSERT( Common::String::printf("") == "" ); + TS_ASSERT( Common::String::printf("%s", "test") == "test" ); + TS_ASSERT( Common::String::printf("%s.s%.02d", "monkey", 1) == "monkey.s01" ); + TS_ASSERT( Common::String::printf("%s%X", "test", 1234) == "test4D2" ); + TS_ASSERT( Common::String::printf("Some %s to make this string longer than the default built-in %s %d", "text", "capacity", 123456) == "Some text to make this string longer than the default built-in capacity 123456" ); + } }; |