Index: compiled/String.h
===================================================================
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -16,16 +16,20 @@
  */
 
 #pragma once
 
 #include <algorithm>
 #include <cstddef>
 #include <cstring>
 #include <type_traits>
+#ifdef INSIDE_TESTS
+#include <iostream>
+#include <codecvt>
+#endif
 
 #include "debug.h"
 #include "library.h"
 
 inline void String_assert_writable(bool isWritable);
 
 class String
 {
@@ -188,16 +192,25 @@
       else if (currChar >= 128)
       {
         mBuf[i] = CharToLower(currChar);
       }
     }
   }
 };
 
+#ifdef INSIDE_TESTS
+inline std::ostream& operator<<(std::ostream& os, const String& str)
+{
+  std::wstring_convert<std::codecvt_utf8<char16_t>, char16_t> converter;
+  os << converter.to_bytes(str.data(), str.data() + str.length());
+  return os;
+}
+#endif
+
 class DependentString : public String
 {
 public:
   explicit DependentString()
       : String(nullptr, 0, INVALID)
   {
   }
 
@@ -252,16 +265,23 @@
 
   void erase()
   {
     *this = DependentString();
     mLen = DELETED;
   }
 };
 
+#ifdef INSIDE_TESTS
+inline std::ostream& operator<<(std::ostream& os, const DependentString& str)
+{
+  return os << static_cast<const String&>(str);
+}
+#endif
+
 inline DependentString operator "" _str(const String::value_type* str,
     String::size_type len)
 {
   return DependentString(str, len);
 }
 
 inline void String_assert_writable(bool isWritable)
 {
@@ -415,8 +435,15 @@
 
     for (int i = size - 1; i >= 0; i--)
     {
       mBuf[pos + i] = '0' + (num % 10);
       num /= 10;
     }
   }
 };
+
+#ifdef INSIDE_TESTS
+inline std::ostream& operator<<(std::ostream& os, const OwnedString& str)
+{
+  return os << static_cast<const String&>(str);
+}
+#endif
Index: meson.build
===================================================================
--- a/meson.build
+++ b/meson.build
@@ -214,15 +214,15 @@
                             link_args: LINK_PARAMS)
   gtest = static_library('gtest', files(join_paths(GTEST_DIR, 'src', 'gtest-all.cc')),
                          include_directories: [
                              include_directories(join_paths(GTEST_DIR, 'include'), is_system: true),
                              include_directories(GTEST_DIR)
                          ],
                          cpp_args: GTEST_PARAMS)
   abptest = executable('abptest', test_sources,
-                       cpp_args: ADDITIONAL_PARAMS + CORE_PARAMS,
+                       cpp_args: ADDITIONAL_PARAMS + CORE_PARAMS + ['-DINSIDE_TESTS'],
                        include_directories: include_directories(join_paths(GTEST_DIR, 'include')),
                        link_args: LINK_PARAMS,
                        link_with: [ adblockpluscore, gtest ])
   test('abptest', abptest)
 endif
 
