[Libreoffice-commits] core.git: sal/qa

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 27 13:18:04 UTC 2019


 sal/qa/rtl/strings/test_ostring_concat.cxx  |   14 ++++++++------
 sal/qa/rtl/strings/test_oustring_concat.cxx |   14 ++++++++------
 2 files changed, 16 insertions(+), 12 deletions(-)

New commits:
commit ad4c7b97752b4da73808402604d6f96b39d920f5
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Aug 27 09:06:31 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Aug 27 15:16:29 2019 +0200

    Avoid declaring function templates in namespace std
    
    ...that don't even depend on program-defined types
    
    Change-Id: I102ce7e97280e7b80f8270ab3b7bbdc111d4d68c
    Reviewed-on: https://gerrit.libreoffice.org/78168
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx
index 4f4f2e3f799b..15795d039cee 100644
--- a/sal/qa/rtl/strings/test_ostring_concat.cxx
+++ b/sal/qa/rtl/strings/test_ostring_concat.cxx
@@ -11,6 +11,7 @@
 #define RTL_STRING_UNITTEST_CONCAT
 
 #include <sal/types.h>
+#include <cppunit/TestAssert.h>
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
 
@@ -19,20 +20,21 @@
 #include <rtl/ustring.hxx>
 #include <rtl/ustrbuf.hxx>
 
+#include <string>
 #include <typeinfo>
 
 bool rtl_string_unittest_invalid_concat = false;
 
 using namespace rtl;
 
-namespace std
+namespace CppUnit
 {
-template< typename charT, typename traits > static std::basic_ostream<charT, traits> &
-operator <<(
-    std::basic_ostream<charT, traits> & stream, const std::type_info& info )
+template<> struct assertion_traits<std::type_info>
 {
-    return stream << info.name();
-}
+    static bool equal(std::type_info const & x, std::type_info const & y) { return x == y; }
+
+    static std::string toString(std::type_info const & x) { return x.name(); }
+};
 } // namespace
 
 namespace test { namespace ostring {
diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx
index 874666869554..8ec1699d4431 100644
--- a/sal/qa/rtl/strings/test_oustring_concat.cxx
+++ b/sal/qa/rtl/strings/test_oustring_concat.cxx
@@ -12,6 +12,7 @@
 extern bool rtl_string_unittest_invalid_concat;
 
 #include <sal/types.h>
+#include <cppunit/TestAssert.h>
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
 
@@ -20,18 +21,19 @@ extern bool rtl_string_unittest_invalid_concat;
 #include <rtl/string.hxx>
 #include <rtl/strbuf.hxx>
 
+#include <string>
 #include <typeinfo>
 
 using namespace rtl;
 
-namespace std
+namespace CppUnit
 {
-template< typename charT, typename traits > static std::basic_ostream<charT, traits> &
-operator <<(
-    std::basic_ostream<charT, traits> & stream, const std::type_info& info )
+template<> struct assertion_traits<std::type_info>
 {
-    return stream << info.name();
-}
+    static bool equal(std::type_info const & x, std::type_info const & y) { return x == y; }
+
+    static std::string toString(std::type_info const & x) { return x.name(); }
+};
 } // namespace
 
 namespace test { namespace oustring {


More information about the Libreoffice-commits mailing list