Index: unittests/Format/FormatTest.cpp =================================================================== --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -10907,12 +10907,16 @@ format("auto a = unique_ptr < Foo < Bar>[10]> ;", Spaces)); } -// Since this test case uses UNIX-style file path. We disable it for MS -// compiler. -#if !defined(_MSC_VER) && !defined(__MINGW32__) - TEST(FormatStyle, GetStyleOfFile) { vfs::InMemoryFileSystem FS; + + // Set CWD so that clang::vfs::FileSystem::makeAbsolute and + // llvm::sys::fs::make_absolute return the same thing. + llvm::SmallString<128> InitialDirectory; + std::error_code EC = llvm::sys::fs::current_path(InitialDirectory); + EXPECT_EQ(EC.value(), 0); + FS.setCurrentWorkingDirectory(InitialDirectory); + // Test 1: format file in the same directory. ASSERT_TRUE( FS.addFile("/a/.clang-format", 0, @@ -10938,8 +10942,6 @@ ASSERT_EQ(Style3, getGoogleStyle()); } -#endif // _MSC_VER - TEST_F(ReplacementTest, FormatCodeAfterReplacements) { // Column limit is 20. std::string Code = "Type *a =\n"