diff options
author | Don Hinton <hintonda@gmail.com> | 2019-05-03 17:47:29 +0000 |
---|---|---|
committer | Don Hinton <hintonda@gmail.com> | 2019-05-03 17:47:29 +0000 |
commit | c242be40a140df8959ce08bc6d593d9ee14ca319 (patch) | |
tree | f82a3799e99dd46b871e4e42f9e526c3108f7332 /llvm/unittests/Support/CommandLineTest.cpp | |
parent | 46ec57e57605e92121d972438bff04bd694f74d5 (diff) | |
download | llvm-c242be40a140df8959ce08bc6d593d9ee14ca319.zip llvm-c242be40a140df8959ce08bc6d593d9ee14ca319.tar.gz llvm-c242be40a140df8959ce08bc6d593d9ee14ca319.tar.bz2 |
[CommandLine] Change help output to prefix long options with `--` instead of `-`. NFC . Part 3 of 5
Summary:
By default, `parseCommandLineOptions()` will accept either a
`-` or `--` prefix for long options -- options with names longer than
a single character.
While this change does not affect behavior, it will be helpful with a
subsequent change that requires long options use the `--` prefix.
Reviewers: rnk, thopre
Reviewed By: thopre
Subscribers: thopre, cfe-commits, hiraditya, llvm-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D61269
llvm-svn: 359909
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r-- | llvm/unittests/Support/CommandLineTest.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index 5ce6541..e528f51 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -1042,7 +1042,7 @@ public: StackOption<OptionValue> TestOption(Opt, cl::desc(HelpText), OptionAttributes...); - printOptionInfo(TestOption, 25); + printOptionInfo(TestOption, 26); outs().flush(); } auto Buffer = MemoryBuffer::getFile(File.FilePath); @@ -1069,8 +1069,8 @@ TEST_F(PrintOptionInfoTest, PrintOptionInfoValueOptionalWithoutSentinel) { cl::values(clEnumValN(OptionValue::Val, "v1", "desc1"))); // clang-format off - EXPECT_EQ(Output, (" -" + Opt + "=<value> - " + HelpText + "\n" - " =v1 - desc1\n") + EXPECT_EQ(Output, (" --" + Opt + "=<value> - " + HelpText + "\n" + " =v1 - desc1\n") .str()); // clang-format on } @@ -1082,9 +1082,9 @@ TEST_F(PrintOptionInfoTest, PrintOptionInfoValueOptionalWithSentinel) { // clang-format off EXPECT_EQ(Output, - (" -" + Opt + " - " + HelpText + "\n" - " -" + Opt + "=<value> - " + HelpText + "\n" - " =v1 - desc1\n") + (" --" + Opt + " - " + HelpText + "\n" + " --" + Opt + "=<value> - " + HelpText + "\n" + " =v1 - desc1\n") .str()); // clang-format on } @@ -1095,10 +1095,10 @@ TEST_F(PrintOptionInfoTest, PrintOptionInfoValueOptionalWithSentinelWithHelp) { clEnumValN(OptionValue::Val, "", "desc2"))); // clang-format off - EXPECT_EQ(Output, (" -" + Opt + " - " + HelpText + "\n" - " -" + Opt + "=<value> - " + HelpText + "\n" - " =v1 - desc1\n" - " =<empty> - desc2\n") + EXPECT_EQ(Output, (" --" + Opt + " - " + HelpText + "\n" + " --" + Opt + "=<value> - " + HelpText + "\n" + " =v1 - desc1\n" + " =<empty> - desc2\n") .str()); // clang-format on } @@ -1109,8 +1109,8 @@ TEST_F(PrintOptionInfoTest, PrintOptionInfoValueRequiredWithEmptyValueName) { clEnumValN(OptionValue::Val, "", ""))); // clang-format off - EXPECT_EQ(Output, (" -" + Opt + "=<value> - " + HelpText + "\n" - " =v1 - desc1\n" + EXPECT_EQ(Output, (" --" + Opt + "=<value> - " + HelpText + "\n" + " =v1 - desc1\n" " =<empty>\n") .str()); // clang-format on @@ -1122,7 +1122,7 @@ TEST_F(PrintOptionInfoTest, PrintOptionInfoEmptyValueDescription) { // clang-format off EXPECT_EQ(Output, - (" -" + Opt + "=<value> - " + HelpText + "\n" + (" --" + Opt + "=<value> - " + HelpText + "\n" " =v1\n").str()); // clang-format on } @@ -1147,7 +1147,7 @@ private: TEST_F(GetOptionWidthTest, GetOptionWidthArgNameLonger) { StringRef ArgName("a-long-argument-name"); - size_t ExpectedStrSize = (" -" + ArgName + "=<value> - ").str().size(); + size_t ExpectedStrSize = (" --" + ArgName + "=<value> - ").str().size(); EXPECT_EQ( runTest(ArgName, cl::values(clEnumValN(OptionValue::Val, "v", "help"))), ExpectedStrSize); |