diff options
author | Martin Storsjö <martin@martin.st> | 2021-10-05 10:17:36 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2021-11-05 10:41:51 +0200 |
commit | f4d83c56c99deb52769aab12bbd22b9bfeb0c617 (patch) | |
tree | bd8bffc5c7a7a2d63df85ce941fd672b29914da5 /llvm/unittests/Support/CommandLineTest.cpp | |
parent | a8b54834a186f5570b49b614e31b961a9cf1cbfe (diff) | |
download | llvm-f4d83c56c99deb52769aab12bbd22b9bfeb0c617.zip llvm-f4d83c56c99deb52769aab12bbd22b9bfeb0c617.tar.gz llvm-f4d83c56c99deb52769aab12bbd22b9bfeb0c617.tar.bz2 |
[Support] [Windows] Convert paths to the preferred form
This normalizes most paths (except ones input from the user as command
line arguments) into the preferred form, if `real_style()` evaluates to
`windows_forward`.
Differential Revision: https://reviews.llvm.org/D111880
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r-- | llvm/unittests/Support/CommandLineTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index d8fd6f6..db7255e 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -1112,6 +1112,11 @@ TEST(CommandLineTest, PositionalEatArgsError) { } #ifdef _WIN32 +void checkSeparators(StringRef Path) { + char UndesiredSeparator = sys::path::get_separator()[0] == '/' ? '\\' : '/'; + ASSERT_EQ(Path.find(UndesiredSeparator), StringRef::npos); +} + TEST(CommandLineTest, GetCommandLineArguments) { int argc = __argc; char **argv = __argv; @@ -1121,6 +1126,7 @@ TEST(CommandLineTest, GetCommandLineArguments) { EXPECT_EQ(llvm::sys::path::is_absolute(argv[0]), llvm::sys::path::is_absolute(__argv[0])); + checkSeparators(argv[0]); EXPECT_TRUE( llvm::sys::path::filename(argv[0]).equals_insensitive("supporttests.exe")) |