summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Option/OptionParsingTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Option/OptionParsingTest.cpp')
-rw-r--r--llvm/unittests/Option/OptionParsingTest.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/unittests/Option/OptionParsingTest.cpp b/llvm/unittests/Option/OptionParsingTest.cpp
index ee741c25d05..e1d7a473ee7 100644
--- a/llvm/unittests/Option/OptionParsingTest.cpp
+++ b/llvm/unittests/Option/OptionParsingTest.cpp
@@ -298,10 +298,19 @@ TEST(Option, FindNearest) {
EXPECT_EQ(1U, T.findNearest("/framb:foo", Nearest));
EXPECT_EQ(Nearest, "/cramb:foo");
- // `--glormp` should have an editing distance of 1 to `--glormp=`.
- EXPECT_EQ(1U, T.findNearest("--glormp", Nearest));
- EXPECT_EQ(Nearest, "--glormp=");
- EXPECT_EQ(0U, T.findNearest("--glormp=foo", Nearest));
+ // `--glormp` should have an editing distance > 0 from `--glormp=`.
+ EXPECT_GT(T.findNearest("--glorrmp", Nearest), 0U);
+ EXPECT_EQ(Nearest, "--glorrmp=");
+ EXPECT_EQ(0U, T.findNearest("--glorrmp=foo", Nearest));
+
+ // `--blurmps` should correct to `--blurmp`, not `--blurmp=`, even though
+ // both naively have an editing distance of 1.
+ EXPECT_EQ(1U, T.findNearest("--blurmps", Nearest));
+ EXPECT_EQ(Nearest, "--blurmp");
+
+ // ...but `--blurmps=foo` should correct to `--blurmp=foo`.
+ EXPECT_EQ(1U, T.findNearest("--blurmps=foo", Nearest));
+ EXPECT_EQ(Nearest, "--blurmp=foo");
// Flags should be included and excluded as specified.
EXPECT_EQ(1U, T.findNearest("-doopf", Nearest, /*FlagsToInclude=*/OptFlag2));
OpenPOWER on IntegriCloud