diff options
| author | William A. Kennington III <wak@google.com> | 2019-06-27 12:48:59 -0700 |
|---|---|---|
| committer | William A. Kennington III <wak@google.com> | 2019-07-08 16:26:42 -0700 |
| commit | 4ef36e7904aa354256ab5818c543df0a9c61f90f (patch) | |
| tree | 80880e7259ada0b0757a8d2e437bc8a123fff857 /test | |
| parent | 079cba7212a9a2e5eb7260492696675d67979346 (diff) | |
| download | stdplus-4ef36e7904aa354256ab5818c543df0a9c61f90f.tar.gz stdplus-4ef36e7904aa354256ab5818c543df0a9c61f90f.zip | |
util/str: Add string concatentation methods
Change-Id: I5caf8e0731eb9ac0f18b84d25256ea0068fab03c
Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/meson.build | 1 | ||||
| -rw-r--r-- | test/util/string.cpp | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build index bcd016e..c8fddf0 100644 --- a/test/meson.build +++ b/test/meson.build @@ -6,6 +6,7 @@ tests = [ 'handle/copyable', 'handle/managed', 'util/cexec', + 'util/string', ] foreach t : tests diff --git a/test/util/string.cpp b/test/util/string.cpp new file mode 100644 index 0000000..8ab4e81 --- /dev/null +++ b/test/util/string.cpp @@ -0,0 +1,39 @@ +#include <gtest/gtest.h> +#include <stdplus/util/string.hpp> +#include <string> +#include <string_view> + +namespace stdplus +{ +namespace util +{ +namespace +{ + +using namespace std::string_literals; +using namespace std::string_view_literals; + +TEST(StrCat, NoStr) +{ + EXPECT_EQ("", strCat()); +} + +TEST(StrCat, SingleStr) +{ + EXPECT_EQ("func", strCat("func")); +} + +TEST(StrCat, Multi) +{ + EXPECT_EQ("func world test", strCat("func", " world"sv, " test"s)); +} + +TEST(StrCat, MoveStr) +{ + EXPECT_EQ("func", strCat("func"s)); + EXPECT_EQ("func world", strCat("func"s, " world")); +} + +} // namespace +} // namespace util +} // namespace stdplus |

