summaryrefslogtreecommitdiff
path: root/unittests/Option/OptionParsingTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Option/OptionParsingTest.cpp')
-rw-r--r--unittests/Option/OptionParsingTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/unittests/Option/OptionParsingTest.cpp b/unittests/Option/OptionParsingTest.cpp
index aa32da3a595fd..521009a9e663f 100644
--- a/unittests/Option/OptionParsingTest.cpp
+++ b/unittests/Option/OptionParsingTest.cpp
@@ -209,3 +209,17 @@ TEST(Option, Slurp) {
EXPECT_EQ(AL->getAllArgValues(OPT_Slurp)[1], "--");
EXPECT_EQ(AL->getAllArgValues(OPT_Slurp)[2], "foo");
}
+
+TEST(Option, FlagAliasToJoined) {
+ TestOptTable T;
+ unsigned MAI, MAC;
+
+ // Check that a flag alias provides an empty argument to a joined option.
+ const char *MyArgs[] = { "-K" };
+ std::unique_ptr<InputArgList> AL(
+ T.ParseArgs(std::begin(MyArgs), std::end(MyArgs), MAI, MAC));
+ EXPECT_EQ(AL->size(), 1U);
+ EXPECT_TRUE(AL->hasArg(OPT_B));
+ EXPECT_EQ(AL->getAllArgValues(OPT_B).size(), 1U);
+ EXPECT_EQ(AL->getAllArgValues(OPT_B)[0], "");
+}