summaryrefslogtreecommitdiff
path: root/o3tl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-03-01 10:44:12 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-03-01 18:00:17 +0100
commitffe7850a1449c43dd077c5cb073d8eee178f7099 (patch)
tree0b68713d8aa234e861afc8172e392b41ee126248 /o3tl
parentee2a192923bf709d05c174848e7054cd411b205a (diff)
fix o3tl::equalsIgnoreAsciiCase()
As the OUString equivalent shows, it needs to check == 0. Commit 33ecd0d5c4fff9511a8436513936a3f7044a775a for some reason also dropped the cheap checks (even from OUString) that OString has, so add them. Change-Id: I88e68b5ae10fd76c3c08b9b36d5abed0fad17bbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130753 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'o3tl')
-rw-r--r--o3tl/qa/test-string_view.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/o3tl/qa/test-string_view.cxx b/o3tl/qa/test-string_view.cxx
index b400c9605962..c068638f800e 100644
--- a/o3tl/qa/test-string_view.cxx
+++ b/o3tl/qa/test-string_view.cxx
@@ -60,6 +60,7 @@ private:
CPPUNIT_TEST(testStartsWithRest);
CPPUNIT_TEST(testEndsWith);
CPPUNIT_TEST(testEndsWithRest);
+ CPPUNIT_TEST(testEqualsIgnoreAsciiCase);
CPPUNIT_TEST_SUITE_END();
void testStartsWith()
@@ -585,6 +586,13 @@ private:
CPPUNIT_ASSERT_EQUAL(u""sv, rest);
}
}
+
+ void testEqualsIgnoreAsciiCase()
+ {
+ using namespace std::string_view_literals;
+ CPPUNIT_ASSERT(o3tl::equalsIgnoreAsciiCase(u"test"sv, u"test"sv));
+ CPPUNIT_ASSERT(!o3tl::equalsIgnoreAsciiCase(u"test"sv, u"test2"sv));
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(Test);