summaryrefslogtreecommitdiff
path: root/core/fxcrt/widestring_unittest.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-12 23:27:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-12 23:27:35 +0000
commitc9f8d5af69e3b0bb6c8e58e74b61c016b2d099a1 (patch)
treee5ecc04904b1066c037a415347f6e909cb0521b3 /core/fxcrt/widestring_unittest.cpp
parent008b928ea39904374bc0dc8888e27bc48c812bda (diff)
downloadpdfium-c9f8d5af69e3b0bb6c8e58e74b61c016b2d099a1.tar.xz
Add AsSpan() convenience method to fxcrt strings.
Make consistent with StringView methods. Change-Id: Idf336895053a327262de924b6a525052e22a25da Reviewed-on: https://pdfium-review.googlesource.com/30491 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/widestring_unittest.cpp')
-rw-r--r--core/fxcrt/widestring_unittest.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index ad91249c8e..ec0a55fc1e 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -21,6 +21,10 @@ TEST(WideString, ElementAccess) {
EXPECT_DEATH({ abc[4]; }, ".*");
#endif
+ pdfium::span<const wchar_t> abc_span = abc.AsSpan();
+ EXPECT_EQ(3u, abc_span.size());
+ EXPECT_EQ(0, wmemcmp(abc_span.data(), L"abc", 3));
+
WideString mutable_abc = abc;
EXPECT_EQ(abc.c_str(), mutable_abc.c_str());
EXPECT_EQ(L'a', mutable_abc[0]);