diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-07 16:35:13 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-07 23:56:10 +0000 |
commit | 746c28772e01675096800d8853aae33f94ed3d55 (patch) | |
tree | 2ce47901d8028f4e73db474ed6a4a36768463f14 /core/fxcrt/cfx_widestring_unittest.cpp | |
parent | c4a2b7518949df00651aa3513c93079f1968441e (diff) | |
download | pdfium-746c28772e01675096800d8853aae33f94ed3d55.tar.xz |
Create initializer-list ctor for strings.
Also use safe arithmetic for two-arg ctor.
Change-Id: I5d541d9b2d5fe5b939f4cc8c22cf034f5cb01176
Reviewed-on: https://pdfium-review.googlesource.com/3955
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_widestring_unittest.cpp')
-rw-r--r-- | core/fxcrt/cfx_widestring_unittest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_widestring_unittest.cpp b/core/fxcrt/cfx_widestring_unittest.cpp index a0523b1804..dd44cb70af 100644 --- a/core/fxcrt/cfx_widestring_unittest.cpp +++ b/core/fxcrt/cfx_widestring_unittest.cpp @@ -945,3 +945,10 @@ TEST(fxcrt, EmptyWideString) { const wchar_t* cstr = empty_str.c_str(); EXPECT_EQ(0, FXSYS_wcslen(cstr)); } + +TEST(fxcrt, WidStringInitializerList) { + CFX_WideString many_str({L"clams", L" and ", L"oysters"}); + EXPECT_EQ(L"clams and oysters", many_str); + many_str = {L"fish", L" and ", L"chips", L" and ", L"soda"}; + EXPECT_EQ(L"fish and chips and soda", many_str); +} |