diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2018-02-12 16:57:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-12 16:57:08 -0500 |
commit | 9d1a80c0fbc03d8c824e0263d27d419b38b61bf4 (patch) | |
tree | f34e07e2970e08d06e5efcc993198ad844c19c19 /googlemock/src/gmock-internal-utils.cc | |
parent | 222607a019638b104f67b5bd6cf7572a091500b2 (diff) | |
parent | 1a7732a488850da770943e78ccd6de42985564a1 (diff) | |
download | googletest-9d1a80c0fbc03d8c824e0263d27d419b38b61bf4.tar.gz googletest-9d1a80c0fbc03d8c824e0263d27d419b38b61bf4.tar.bz2 googletest-9d1a80c0fbc03d8c824e0263d27d419b38b61bf4.zip |
Merge pull request #1452 from gennadiycivil/master
moving JoinAsTuple to internal
Diffstat (limited to 'googlemock/src/gmock-internal-utils.cc')
-rw-r--r-- | googlemock/src/gmock-internal-utils.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc index 91bf3fd9..658fa62d 100644 --- a/googlemock/src/gmock-internal-utils.cc +++ b/googlemock/src/gmock-internal-utils.cc @@ -47,6 +47,25 @@ namespace testing { namespace internal { +// Joins a vector of strings as if they are fields of a tuple; returns +// the joined string. +GTEST_API_ std::string JoinAsTuple(const Strings& fields) { + switch (fields.size()) { + case 0: + return ""; + case 1: + return fields[0]; + default: + std::string result = "(" + fields[0]; + for (size_t i = 1; i < fields.size(); i++) { + result += ", "; + result += fields[i]; + } + result += ")"; + return result; + } +} + // Converts an identifier name to a space-separated list of lower-case // words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is // treated as one word. For example, both "FooBar123" and |