summaryrefslogtreecommitdiff
path: root/i18npool/qa/cppunit
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-14 14:38:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-18 09:06:23 +0200
commit6131eee742a972c41b9017de455b8b8104bcaf32 (patch)
treefa32bdea4e93f45a38e6acd7e8b8cd185cad87b5 /i18npool/qa/cppunit
parent32074859ba79489f1211542aca295a450443203e (diff)
loplugin:useuniqueptr in TestTextSearch
Change-Id: Ifce0dc836ea8500105ebcf3302f37ad6968929ec Reviewed-on: https://gerrit.libreoffice.org/60607 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/qa/cppunit')
-rw-r--r--i18npool/qa/cppunit/test_textsearch.cxx8
1 files changed, 2 insertions, 6 deletions
diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx
index 18fd1d9079a6..012bbeb3eddd 100644
--- a/i18npool/qa/cppunit/test_textsearch.cxx
+++ b/i18npool/qa/cppunit/test_textsearch.cxx
@@ -60,14 +60,13 @@ private:
void TestTextSearch::testICU()
{
UErrorCode nErr = U_ZERO_ERROR;
- RegexMatcher* pRegexMatcher;
sal_uInt32 nSearchFlags = UREGEX_UWORD | UREGEX_CASE_INSENSITIVE;
OUString aString( "abcdefgh" );
OUString aPattern( "e" );
IcuUniString aSearchPat( reinterpret_cast<const UChar*>(aPattern.getStr()), aPattern.getLength() );
- pRegexMatcher = new RegexMatcher( aSearchPat, nSearchFlags, nErr );
+ std::unique_ptr<RegexMatcher> pRegexMatcher(new RegexMatcher( aSearchPat, nSearchFlags, nErr ));
IcuUniString aSource( reinterpret_cast<const UChar*>(aString.getStr()), aString.getLength() );
pRegexMatcher->reset( aSource );
@@ -79,13 +78,11 @@ void TestTextSearch::testICU()
CPPUNIT_ASSERT_EQUAL( static_cast<int32_t>(5), pRegexMatcher->end( nErr ) );
CPPUNIT_ASSERT_EQUAL( U_ZERO_ERROR, nErr );
- delete pRegexMatcher;
-
OUString aString2( "acababaabcababadcdaa" );
OUString aPattern2( "a" );
IcuUniString aSearchPat2( reinterpret_cast<const UChar*>(aPattern2.getStr()), aPattern2.getLength() );
- pRegexMatcher = new RegexMatcher( aSearchPat2, nSearchFlags, nErr );
+ pRegexMatcher.reset(new RegexMatcher( aSearchPat2, nSearchFlags, nErr ));
IcuUniString aSource2( reinterpret_cast<const UChar*>(aString2.getStr()), aString2.getLength() );
pRegexMatcher->reset( aSource2 );
@@ -96,7 +93,6 @@ void TestTextSearch::testICU()
CPPUNIT_ASSERT_EQUAL( U_ZERO_ERROR, nErr );
CPPUNIT_ASSERT_EQUAL( static_cast<int32_t>(1), pRegexMatcher->end( nErr ) );
CPPUNIT_ASSERT_EQUAL( U_ZERO_ERROR, nErr );
- delete pRegexMatcher;
}
void TestTextSearch::testSearches()