about summary refs log tree commit diff
path: root/absl/strings/internal/resize_uninitialized_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-02-06T21·47-0800
committerAndy Getz <durandal@google.com>2020-02-06T22·43-0500
commit24713a7036a81498334807fa5c7ad3cb7c643711 (patch)
tree7172f28efd25df1e4a203021ad0b2a125caf4657 /absl/strings/internal/resize_uninitialized_test.cc
parent72382c21fefed981b4b8a2a1b82e2d231c2c2e39 (diff)
Export of internal Abseil changes
--
183ff8d9640e7c08f78a9d36113bc0109c34703b by Jorg Brown <jorg@google.com>:

Internal cleanup

PiperOrigin-RevId: 293667472
GitOrigin-RevId: 183ff8d9640e7c08f78a9d36113bc0109c34703b
Change-Id: Ic21223ab9719b5d49b8f1eb21417e947190b056b
Diffstat (limited to 'absl/strings/internal/resize_uninitialized_test.cc')
-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; }
 };