diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-06-03 10:58:26 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-06-03 10:58:26 +0200 |
commit | 643b70006fd5f6762561696421808f20d4e1e86f (patch) | |
tree | e770962bd4830b9b41abf5446f5674f67c164048 /sal | |
parent | 9cf0ac710a6ace0a833fa193c7e18c4a7405bc42 (diff) |
Teach loplugin:stringconstant about RTL_CONSTASCII_STRINGPARAM
Change-Id: I8ff0e104aad045f3835dc8facc760a8339b1d088
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/rtl/oustring/rtl_OUString2.cxx | 53 |
1 files changed, 12 insertions, 41 deletions
diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx index 6c44741a44c2..00a7f6667579 100644 --- a/sal/qa/rtl/oustring/rtl_OUString2.cxx +++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx @@ -925,32 +925,16 @@ public: }; void indexOfAscii::test() { + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), rtl::OUString().indexOf("")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), rtl::OUString().lastIndexOf("")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rtl::OUString("foo").indexOf("foo")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rtl::OUString("foo").lastIndexOf("foo")); CPPUNIT_ASSERT_EQUAL( - sal_Int32(-1), - rtl::OUString().indexOfAsciiL(RTL_CONSTASCII_STRINGPARAM(""))); + sal_Int32(2), rtl::OUString("fofoobar").indexOf("foo")); CPPUNIT_ASSERT_EQUAL( - sal_Int32(-1), - rtl::OUString().lastIndexOfAsciiL(RTL_CONSTASCII_STRINGPARAM(""))); + sal_Int32(3), rtl::OUString("foofoofob").lastIndexOf("foo")); CPPUNIT_ASSERT_EQUAL( - sal_Int32(0), - rtl::OUString("foo").indexOfAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"))); - CPPUNIT_ASSERT_EQUAL( - sal_Int32(0), - rtl::OUString("foo").lastIndexOfAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"))); - CPPUNIT_ASSERT_EQUAL( - sal_Int32(2), - rtl::OUString("fofoobar").indexOfAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"))); - CPPUNIT_ASSERT_EQUAL( - sal_Int32(3), - rtl::OUString("foofoofob"). - lastIndexOfAsciiL(RTL_CONSTASCII_STRINGPARAM("foo"))); - CPPUNIT_ASSERT_EQUAL( - sal_Int32(3), - rtl::OUString("foofoobar").indexOfAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"), 1)); + sal_Int32(3), rtl::OUString("foofoobar").indexOf("foo", 1)); } class endsWith: public CppUnit::TestFixture { @@ -963,24 +947,11 @@ public: }; void endsWith::test() { - CPPUNIT_ASSERT_EQUAL( - true, - rtl::OUString().endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM(""))); - CPPUNIT_ASSERT_EQUAL( - false, - rtl::OUString().endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM("foo"))); - CPPUNIT_ASSERT_EQUAL( - true, - rtl::OUString("bar").endsWithAsciiL( - RTL_CONSTASCII_STRINGPARAM("bar"))); - CPPUNIT_ASSERT_EQUAL( - true, - rtl::OUString("foobar").endsWithAsciiL( - RTL_CONSTASCII_STRINGPARAM("bar"))); - CPPUNIT_ASSERT_EQUAL( - false, - rtl::OUString("FOOBAR").endsWithAsciiL( - RTL_CONSTASCII_STRINGPARAM("bar"))); + CPPUNIT_ASSERT_EQUAL(true, rtl::OUString().endsWith("")); + CPPUNIT_ASSERT_EQUAL(false, rtl::OUString().endsWith("foo")); + CPPUNIT_ASSERT_EQUAL(true, rtl::OUString("bar").endsWith("bar")); + CPPUNIT_ASSERT_EQUAL(true, rtl::OUString("foobar").endsWith("bar")); + CPPUNIT_ASSERT_EQUAL(false, rtl::OUString("FOOBAR").endsWith("bar")); } class isEmpty: public CppUnit::TestFixture { |