From c242be40a140df8959ce08bc6d593d9ee14ca319 Mon Sep 17 00:00:00 2001 From: Don Hinton Date: Fri, 3 May 2019 17:47:29 +0000 Subject: [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 --- llvm/unittests/Support/CommandLineTest.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'llvm/unittests/Support/CommandLineTest.cpp') 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 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 + "= - " + HelpText + "\n" - " =v1 - desc1\n") + EXPECT_EQ(Output, (" --" + Opt + "= - " + 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 + "= - " + HelpText + "\n" - " =v1 - desc1\n") + (" --" + Opt + " - " + HelpText + "\n" + " --" + Opt + "= - " + 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 + "= - " + HelpText + "\n" - " =v1 - desc1\n" - " = - desc2\n") + EXPECT_EQ(Output, (" --" + Opt + " - " + HelpText + "\n" + " --" + Opt + "= - " + HelpText + "\n" + " =v1 - desc1\n" + " = - desc2\n") .str()); // clang-format on } @@ -1109,8 +1109,8 @@ TEST_F(PrintOptionInfoTest, PrintOptionInfoValueRequiredWithEmptyValueName) { clEnumValN(OptionValue::Val, "", ""))); // clang-format off - EXPECT_EQ(Output, (" -" + Opt + "= - " + HelpText + "\n" - " =v1 - desc1\n" + EXPECT_EQ(Output, (" --" + Opt + "= - " + HelpText + "\n" + " =v1 - desc1\n" " =\n") .str()); // clang-format on @@ -1122,7 +1122,7 @@ TEST_F(PrintOptionInfoTest, PrintOptionInfoEmptyValueDescription) { // clang-format off EXPECT_EQ(Output, - (" -" + Opt + "= - " + HelpText + "\n" + (" --" + Opt + "= - " + 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 + "= - ").str().size(); + size_t ExpectedStrSize = (" --" + ArgName + "= - ").str().size(); EXPECT_EQ( runTest(ArgName, cl::values(clEnumValN(OptionValue::Val, "v", "help"))), ExpectedStrSize); -- cgit v1.1