diff options
author | Abseil Team <absl-team@google.com> | 2020-04-20 07:20:27 -0700 |
---|---|---|
committer | Derek Mauro <dmauro@google.com> | 2020-04-20 12:56:42 -0400 |
commit | df60c82df43e33274550e758c7a93fa49f88e0fe (patch) | |
tree | 0ae04d074d0a845ff1fd588b8d44067ff0fcd460 /absl/strings/cord_test.cc | |
parent | b35973e3e35cb1eccb086d6a549c253c49579474 (diff) |
Export of internal Abseil changes
--
b885a238ec13effcc407e250583e293052bd7984 by Greg Falcon <gfalcon@google.com>:
Remove the dependency of //absl/hash on //absl/strings:cord.
The `AbslHashValue` definition should reside in cord.h, but the implementation currently needs internal details from the hash library. This CL changes the way that Cord gains access to those internals. Note that PiecewiseCombiner remains an internal namespace API, and we still reserve the right to make changes to it.
The cord_benchmark shows no statistically significant changes in hash<Cord> performance with this change.
PiperOrigin-RevId: 307393448
--
ca449f230ee719d069d9217ba28a07bf5b3bd8b1 by Derek Mauro <dmauro@google.com>:
Move the extension to use absl::Format() with absl::Cord as a sink to cord.h
PiperOrigin-RevId: 307077162
GitOrigin-RevId: b885a238ec13effcc407e250583e293052bd7984
Change-Id: If24a90782c786fa0b4343bc7d72d053b66c153ea
Diffstat (limited to 'absl/strings/cord_test.cc')
-rw-r--r-- | absl/strings/cord_test.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/absl/strings/cord_test.cc b/absl/strings/cord_test.cc index 49178498..336cedde 100644 --- a/absl/strings/cord_test.cc +++ b/absl/strings/cord_test.cc @@ -22,6 +22,7 @@ #include "absl/container/fixed_array.h" #include "absl/strings/cord_test_helpers.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/strings/string_view.h" typedef std::mt19937_64 RandomEngine; @@ -1582,6 +1583,14 @@ TEST(Cord, SmallBufferAssignFromOwnData) { } } +TEST(Cord, Format) { + absl::Cord c; + absl::Format(&c, "There were %04d little %s.", 3, "pigs"); + EXPECT_EQ(c, "There were 0003 little pigs."); + absl::Format(&c, "And %-3llx bad wolf!", 1); + EXPECT_EQ(c, "There were 0003 little pigs.And 1 bad wolf!"); +} + TEST(CordDeathTest, Hardening) { absl::Cord cord("hello"); // These statement should abort the program in all builds modes. |