diff options
| author | Pavel Labath <labath@google.com> | 2017-12-11 14:22:30 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2017-12-11 14:22:30 +0000 |
| commit | c58a80ff4786fb3592f9d66f10075f56d67360c4 (patch) | |
| tree | 9d5a0e39e6516b6afa238aafe82655a2cb7c64ec /lldb/unittests/Interpreter | |
| parent | 25d9af0cb5765b798066c1a5b5f18d1b32b541b3 (diff) | |
| download | bcm5719-llvm-c58a80ff4786fb3592f9d66f10075f56d67360c4.tar.gz bcm5719-llvm-c58a80ff4786fb3592f9d66f10075f56d67360c4.zip | |
Add a StringList constructor to Args class
Host::GetEnvironment returns a StringList, but the interface for
launching a process takes Args. The fact that we use two classes for
representing an environment is not ideal, but for now we should at least
have an easy way to convert between the two.
llvm-svn: 320366
Diffstat (limited to 'lldb/unittests/Interpreter')
| -rw-r--r-- | lldb/unittests/Interpreter/TestArgs.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/unittests/Interpreter/TestArgs.cpp b/lldb/unittests/Interpreter/TestArgs.cpp index 2aeed0f542b..2aaaab84e21 100644 --- a/lldb/unittests/Interpreter/TestArgs.cpp +++ b/lldb/unittests/Interpreter/TestArgs.cpp @@ -10,6 +10,7 @@ #include "gtest/gtest.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/StringList.h" #include <limits> #include <sstream> @@ -117,6 +118,16 @@ TEST(ArgsTest, TestArgv) { EXPECT_EQ(nullptr, args.GetArgumentVector()[5]); } +TEST(ArgsTest, StringListConstructor) { + StringList list; + list << "foo" << "bar" << "baz"; + Args args(list); + ASSERT_EQ(3u, args.GetArgumentCount()); + EXPECT_EQ("foo", args[0].ref); + EXPECT_EQ("bar", args[1].ref); + EXPECT_EQ("baz", args[2].ref); +} + TEST(ArgsTest, GetQuotedCommandString) { Args args; const char *str = "process launch -o stdout.txt -- \"a b c\""; |

