Changes imported from Abseil "staging" branch:
- 6e88015f26885b66ce9b11696eb9c8d96ef7c0f6 Add ABSL_MUST_USE_RESULT to absl::StripPrefix and absl::S... by Mark Barolak <mbar@google.com> - 47d8de97748da346ad2a962f27389e0380a7a716 Fix missing header include when compiling with _GLIBCXX_D... by Alex Strelnikov <strel@google.com> GitOrigin-RevId: 6e88015f26885b66ce9b11696eb9c8d96ef7c0f6 Change-Id: I8698c77d9eab81455b209a6bef4bb2d5b32ebd65
This commit is contained in:
parent
6365d1744b
commit
0271cd3557
6 changed files with 241 additions and 18 deletions
|
|
@ -165,6 +165,18 @@ TEST(Split, APIExamples) {
|
|||
EXPECT_THAT(v, ElementsAre("abc", "def", "g"));
|
||||
}
|
||||
|
||||
{
|
||||
// Different forms of initialization / conversion.
|
||||
std::vector<std::string> v1 = absl::StrSplit("a,b,c", ',');
|
||||
EXPECT_THAT(v1, ElementsAre("a", "b", "c"));
|
||||
std::vector<std::string> v2(absl::StrSplit("a,b,c", ','));
|
||||
EXPECT_THAT(v2, ElementsAre("a", "b", "c"));
|
||||
auto v3 = std::vector<std::string>(absl::StrSplit("a,b,c", ','));
|
||||
EXPECT_THAT(v3, ElementsAre("a", "b", "c"));
|
||||
v3 = absl::StrSplit("a,b,c", ',');
|
||||
EXPECT_THAT(v3, ElementsAre("a", "b", "c"));
|
||||
}
|
||||
|
||||
{
|
||||
// Results stored in a std::map.
|
||||
std::map<std::string, std::string> m = absl::StrSplit("a,1,b,2,a,3", ',');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue