summaryrefslogtreecommitdiff
path: root/absl/strings/substitute_test.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-05-16 07:40:15 -0700
committerGravatar Andy Soffer <asoffer@google.com>2019-05-16 15:48:51 -0400
commitdaf381e8535a1f1f1b8a75966a74e7cca63dee89 (patch)
treed2914ddce7cd62d2e9696e5448dd40884c4d3c26 /absl/strings/substitute_test.cc
parentfa00c321073c7ea40a4fc3dfc8a06309eae3d025 (diff)
Export of internal Abseil changes.
-- 6fca451d74e509671f0996e15ea05008f73c9957 by Eric Fiselier <ericwf@google.com>: Support vector<bool>::reference and ::const_reference in absl::Substitute. PiperOrigin-RevId: 248524270 -- a4b298c74acb8ae0688ed681052593623d8021c7 by Abseil Team <absl-team@google.com>: Clarify that a static `SpinLock` using the `LinkerInitialized` constructor is initialized in non-cooperative mode. PiperOrigin-RevId: 248386381 GitOrigin-RevId: 6fca451d74e509671f0996e15ea05008f73c9957 Change-Id: I13d54c2034695e7677170cdc7b86384b7d7d9cb5
Diffstat (limited to 'absl/strings/substitute_test.cc')
-rw-r--r--absl/strings/substitute_test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/absl/strings/substitute_test.cc b/absl/strings/substitute_test.cc
index f6568906..e27abb17 100644
--- a/absl/strings/substitute_test.cc
+++ b/absl/strings/substitute_test.cc
@@ -15,6 +15,7 @@
#include "absl/strings/substitute.h"
#include <cstdint>
+#include <vector>
#include "gtest/gtest.h"
#include "absl/strings/str_cat.h"
@@ -172,6 +173,17 @@ TEST(SubstituteTest, SubstituteAndAppend) {
EXPECT_EQ("a b c d e f g h i j", str);
}
+TEST(SubstituteTest, VectorBoolRef) {
+ std::vector<bool> v = {true, false};
+ const auto& cv = v;
+ EXPECT_EQ("true false true false",
+ absl::Substitute("$0 $1 $2 $3", v[0], v[1], cv[0], cv[1]));
+
+ std::string str = "Logic be like: ";
+ absl::SubstituteAndAppend(&str, "$0 $1 $2 $3", v[0], v[1], cv[0], cv[1]);
+ EXPECT_EQ("Logic be like: true false true false", str);
+}
+
#ifdef GTEST_HAS_DEATH_TEST
TEST(SubstituteDeathTest, SubstituteDeath) {