about summary refs log tree commit diff
path: root/absl
diff options
context:
space:
mode:
Diffstat (limited to 'absl')
-rw-r--r--absl/strings/internal/resize_uninitialized_test.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/absl/strings/internal/resize_uninitialized_test.cc b/absl/strings/internal/resize_uninitialized_test.cc
index c5be0b122908..0f8b3c2a95b8 100644
--- a/absl/strings/internal/resize_uninitialized_test.cc
+++ b/absl/strings/internal/resize_uninitialized_test.cc
@@ -20,13 +20,27 @@ namespace {
 
 int resize_call_count = 0;
 
+// A mock string class whose only purpose is to track how many times its
+// resize() method has been called.
 struct resizable_string {
+  size_t size() const { return 0; }
+  char& operator[](size_t) {
+    static char c = '\0';
+    return c;
+  }
   void resize(size_t) { resize_call_count += 1; }
 };
 
 int resize_default_init_call_count = 0;
 
+// A mock string class whose only purpose is to track how many times its
+// resize() and __resize_default_init() methods have been called.
 struct resize_default_init_string {
+  size_t size() const { return 0; }
+  char& operator[](size_t) {
+    static char c = '\0';
+    return c;
+  }
   void resize(size_t) { resize_call_count += 1; }
   void __resize_default_init(size_t) { resize_default_init_call_count += 1; }
 };