From c9f8d5af69e3b0bb6c8e58e74b61c016b2d099a1 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 12 Apr 2018 23:27:35 +0000 Subject: 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 Commit-Queue: Tom Sepez --- core/fxcrt/widestring_unittest.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/fxcrt/widestring_unittest.cpp') 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 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]); -- cgit v1.2.3