aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/CommandLineTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index a6b26b3..3e7ec8d 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -253,8 +253,8 @@ TEST(CommandLineTest, TokenizeGNUCommandLine) {
}
TEST(CommandLineTest, TokenizeWindowsCommandLine1) {
- const char Input[] = "a\\b c\\\\d e\\\\\"f g\" h\\\"i j\\\\\\\"k \"lmn\" o pqr "
- "\"st \\\"u\" \\v";
+ const char Input[] =
+ R"(a\b c\\d e\\"f g" h\"i j\\\"k "lmn" o pqr "st \"u" \v)";
const char *const Output[] = { "a\\b", "c\\\\d", "e\\f g", "h\"i", "j\\\"k",
"lmn", "o", "pqr", "st \"u", "\\v" };
testCommandLineTokenizer(cl::TokenizeWindowsCommandLine, Input, Output,
@@ -268,6 +268,17 @@ TEST(CommandLineTest, TokenizeWindowsCommandLine2) {
array_lengthof(Output));
}
+TEST(CommandLineTest, TokenizeWindowsCommandLineQuotedLastArgument) {
+ const char Input1[] = R"(a b c d "")";
+ const char *const Output1[] = {"a", "b", "c", "d", ""};
+ testCommandLineTokenizer(cl::TokenizeWindowsCommandLine, Input1, Output1,
+ array_lengthof(Output1));
+ const char Input2[] = R"(a b c d ")";
+ const char *const Output2[] = {"a", "b", "c", "d"};
+ testCommandLineTokenizer(cl::TokenizeWindowsCommandLine, Input2, Output2,
+ array_lengthof(Output2));
+}
+
TEST(CommandLineTest, TokenizeConfigFile1) {
const char *Input = "\\";
const char *const Output[] = { "\\" };