diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-12 10:50:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-14 07:54:28 +0200 |
commit | bc2101646bc6e63944c42500af5a15134b9b2d17 (patch) | |
tree | ca1da50da2e3e76eef650a1ae3956c16e0a19f33 /o3tl | |
parent | ad97694737c99889bc0eb21efccb83768d510361 (diff) |
loplugin:stringviewparam improvements
improve the check by checking for methods that exclude
using string_view, rather than checking for methods that
__can__ use string_view, which leads to exposing
some holes in our o3tl/string_view.hxx coverage.
Change-Id: Ic9dd60441c671f502692f9cd2a1bb67301c4b960
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150277
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'o3tl')
-rw-r--r-- | o3tl/qa/test-string_view.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/o3tl/qa/test-string_view.cxx b/o3tl/qa/test-string_view.cxx index 37cb4118a8e2..a95afc923c2c 100644 --- a/o3tl/qa/test-string_view.cxx +++ b/o3tl/qa/test-string_view.cxx @@ -699,6 +699,37 @@ private: o3tl::getToken(suTokenStr, 0, ';', n); // should not GPF with negative index } + { + CPPUNIT_ASSERT_MESSAGE("compareToAscii", + OUString(u"aaa").compareToAscii("aa") + > 0); // just for comparison to following line + CPPUNIT_ASSERT_MESSAGE("compareToAscii", o3tl::compareToAscii(u"aaa", "aa") > 0); + + OUString aa(u"aa"); + CPPUNIT_ASSERT_MESSAGE("compareToAscii", + aa.compareToAscii("aaa") + < 0); // just for comparison to following line + CPPUNIT_ASSERT_MESSAGE("compareToAscii", o3tl::compareToAscii(u"aa", "aaa") < 0); + + CPPUNIT_ASSERT_MESSAGE( + "equalsIgnoreAsciiCase", + aa.equalsIgnoreAsciiCase("AA")); // just for comparison to following line + CPPUNIT_ASSERT_MESSAGE("equalsIgnoreAsciiCase", + o3tl::equalsIgnoreAsciiCase(u"aa", "AA")); + + CPPUNIT_ASSERT_MESSAGE( + "matchIgnoreAsciiCase", + aa.matchIgnoreAsciiCase("a")); // just for comparison to following line + CPPUNIT_ASSERT_MESSAGE("matchIgnoreAsciiCase", o3tl::matchIgnoreAsciiCase(u"aa", "a")); + + CPPUNIT_ASSERT_MESSAGE( + "endsWithIgnoreAsciiCase", + aa.endsWithIgnoreAsciiCase("a")); // just for comparison to following line + CPPUNIT_ASSERT_MESSAGE("endsWithIgnoreAsciiCase", + o3tl::endsWithIgnoreAsciiCase(u"aa", "a")); + CPPUNIT_ASSERT_MESSAGE("endsWithIgnoreAsciiCase", + o3tl::endsWithIgnoreAsciiCase(u"aa", u"a")); + } } }; |