summaryrefslogtreecommitdiff
path: root/absl/strings
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-03-31 09:48:42 -0700
committerGravatar rogeeff <rogeeff@google.com>2022-03-31 13:13:52 -0400
commit4dcae40a07e30cbc99d4130e590047000e5fda0b (patch)
treedfbc80a389e6d07807c3a9ad3ab5c5a2940de563 /absl/strings
parentb9ad9bbfed92199a1a58504306d026cd2597539e (diff)
Export of internal Abseil changes
-- b984c7c1cbee4253192c833046bfcfa16dca8ccf by Dino Radakovic <dinor@google.com>: Restrict visibility of absl/flags:commandlineflag_internal PiperOrigin-RevId: 438591894 Change-Id: I12a6392b2c7f9f1263c741dfd6c43ae22e903aad -- 81315601aab70bb6ac2d17655a727d7f9ee2ff95 by Justin Lebar <jlebar@google.com>: Update example in str_join.h to use a lambda. PiperOrigin-RevId: 438390035 Change-Id: Icc707b972e5a369a71ad774004fdf0a17a9b33a7 -- 1c3c7921224e505faca8617b073f657d3737219f by Dino Radakovic <dinor@google.com>: Internal change PiperOrigin-RevId: 438386036 Change-Id: I6066da1b5a1ddf5af265944a31ed298297b4f2e1 -- 2d6885f78481f04e0e7ee86060aec15b677144f3 by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 438378389 Change-Id: If70dd9114114eb44e85afccd521e7fb7e1436b88 -- 7f8282ddee7fcd032e01cbfe65c11c2d166cceb8 by Derek Mauro <dmauro@google.com>: Internal change PiperOrigin-RevId: 438374554 Change-Id: I993367952af1dc83bd5aa0ae19a64c024f457fdd -- ce65ba28f6031e45db8fa5118a05410f5166fd7a by Abseil Team <absl-team@google.com>: Spelling gardening: Heterogeneous has an "e" after the "n". PiperOrigin-RevId: 438374411 Change-Id: If1a9098a5d04338837998883739c7b555efa62b4 GitOrigin-RevId: b984c7c1cbee4253192c833046bfcfa16dca8ccf
Diffstat (limited to 'absl/strings')
-rw-r--r--absl/strings/cord_ring_reader_test.cc2
-rw-r--r--absl/strings/internal/cordz_sample_token_test.cc2
-rw-r--r--absl/strings/str_join.h24
-rw-r--r--absl/strings/string_view_test.cc2
4 files changed, 12 insertions, 18 deletions
diff --git a/absl/strings/cord_ring_reader_test.cc b/absl/strings/cord_ring_reader_test.cc
index d9a9a76d..8e7183bf 100644
--- a/absl/strings/cord_ring_reader_test.cc
+++ b/absl/strings/cord_ring_reader_test.cc
@@ -126,7 +126,7 @@ TEST(CordRingReaderTest, SeekForward) {
reader.Reset(ring);
size_t consumed = 0;
- size_t remaining = ring->length;;
+ size_t remaining = ring->length;
for (int i = 0; i < flats.size(); ++i) {
CordRepRing::index_type index = ring->advance(head, i);
size_t offset = consumed;
diff --git a/absl/strings/internal/cordz_sample_token_test.cc b/absl/strings/internal/cordz_sample_token_test.cc
index 9f54301d..6be1770d 100644
--- a/absl/strings/internal/cordz_sample_token_test.cc
+++ b/absl/strings/internal/cordz_sample_token_test.cc
@@ -167,7 +167,7 @@ TEST(CordzSampleTokenTest, MultiThreaded) {
if (cord.data.is_profiled()) {
// 1) Untrack
cord.data.cordz_info()->Untrack();
- cord.data.clear_cordz_info();;
+ cord.data.clear_cordz_info();
} else {
// 2) Track
CordzInfo::TrackCord(cord.data, kTrackCordMethod);
diff --git a/absl/strings/str_join.h b/absl/strings/str_join.h
index 33534536..ee5ae7ef 100644
--- a/absl/strings/str_join.h
+++ b/absl/strings/str_join.h
@@ -72,21 +72,15 @@ ABSL_NAMESPACE_BEGIN
// functions. You may provide your own Formatter to enable `absl::StrJoin()` to
// work with arbitrary types.
//
-// The following is an example of a custom Formatter that simply uses
-// `std::to_string()` to format an integer as a std::string.
-//
-// struct MyFormatter {
-// void operator()(std::string* out, int i) const {
-// out->append(std::to_string(i));
-// }
-// };
-//
-// You would use the above formatter by passing an instance of it as the final
-// argument to `absl::StrJoin()`:
-//
-// std::vector<int> v = {1, 2, 3, 4};
-// std::string s = absl::StrJoin(v, "-", MyFormatter());
-// EXPECT_EQ("1-2-3-4", s);
+// The following is an example of a custom Formatter that uses
+// `absl::FormatDuration` to join a list of `absl::Duration`s.
+//
+// std::vector<absl::Duration> v = {absl::Seconds(1), absl::Milliseconds(10)};
+// std::string s =
+// absl::StrJoin(v, ", ", [](std::string* out, absl::Duration dur) {
+// absl::StrAppend(out, absl::FormatDuration(dur));
+// });
+// EXPECT_EQ("1s, 10ms", s);
//
// The following standard formatters are provided within this file:
//
diff --git a/absl/strings/string_view_test.cc b/absl/strings/string_view_test.cc
index 2c13dd1c..9d5463a1 100644
--- a/absl/strings/string_view_test.cc
+++ b/absl/strings/string_view_test.cc
@@ -1189,7 +1189,7 @@ TEST(ComparisonOpsTest, StringCompareNotAmbiguous) {
EXPECT_LT("hello", std::string("world"));
}
-TEST(ComparisonOpsTest, HeterogenousStringViewEquals) {
+TEST(ComparisonOpsTest, HeterogeneousStringViewEquals) {
EXPECT_EQ(absl::string_view("hello"), std::string("hello"));
EXPECT_EQ("hello", absl::string_view("hello"));
}