diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-07 19:57:51 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-07 19:57:51 +0000 |
commit | 4871395b676802e4c563c4d5bdf62fa6928020c3 (patch) | |
tree | 6461a396bd10b37e9a6c86a410c3fdda72160044 /core | |
parent | 651605112d947e33bbbd46ea1276bf2ccb452005 (diff) | |
download | pdfium-4871395b676802e4c563c4d5bdf62fa6928020c3.tar.xz |
Add test for {Byte,Wide}String Operator+().
Precursor to converting some Format() operations to simple string
addition.
Change-Id: I3a159f5ac548ea14586d87e7d56d1ec288898b0d
Reviewed-on: https://pdfium-review.googlesource.com/39590
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/fxcrt/bytestring_unittest.cpp | 7 | ||||
-rw-r--r-- | core/fxcrt/widestring_unittest.cpp | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/core/fxcrt/bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp index 7095a1b799..abc3648f18 100644 --- a/core/fxcrt/bytestring_unittest.cpp +++ b/core/fxcrt/bytestring_unittest.cpp @@ -390,6 +390,13 @@ TEST(ByteString, OperatorNE) { EXPECT_TRUE(c_string3 != byte_string); } +TEST(ByteString, OperatorPlus) { + EXPECT_EQ("I like dogs", "I like " + ByteString("dogs")); + EXPECT_EQ("Dogs like me", ByteString("Dogs") + " like me"); + EXPECT_EQ("Oh no, error number 42", + "Oh no, error number " + ByteString::Format("%d", 42)); +} + TEST(ByteString, Concat) { ByteString fred; fred.Concat("FRED", 4); diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp index 37d4ecd581..9017fe0c54 100644 --- a/core/fxcrt/widestring_unittest.cpp +++ b/core/fxcrt/widestring_unittest.cpp @@ -395,6 +395,13 @@ TEST(WideString, OperatorNE) { EXPECT_TRUE(c_string3 != wide_string); } +TEST(WideString, OperatorPlus) { + EXPECT_EQ(L"I like dogs", L"I like " + WideString(L"dogs")); + EXPECT_EQ(L"Dogs like me", WideString(L"Dogs") + L" like me"); + EXPECT_EQ(L"Oh no, error number 42", + L"Oh no, error number " + WideString::Format(L"%d", 42)); +} + TEST(WideString, ConcatInPlace) { WideString fred; fred.Concat(L"FRED", 4); |