Thanks, I'll keep that in mind. I have a fix for this already, so hopefully these should go away quickly.
pl On 28 October 2016 at 16:34, Zachary Turner <ztur...@google.com> wrote: > Instead of #if 0'ing them, I believe you can add _Disabled to the end of the > name. A common pattern is something like this: > > #if LLVM_ON_WIN32 > #define TestFunBlackslashes_Maybe TestFunBlackslashes_Disabled > #else > #define TestFunBlackslashes_Maybe TestFunBlackslashes > #endif > TEST_F(FileSpecTest, TestFunBackslashes_Maybe) { > } > > You might need to check on the exact syntax, but that should get you pretty > close. > > On Fri, Oct 28, 2016 at 4:37 AM Pavel Labath via lldb-commits > <lldb-commits@lists.llvm.org> wrote: >> >> Author: labath >> Date: Fri Oct 28 06:28:01 2016 >> New Revision: 285393 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=285393&view=rev >> Log: >> Add a couple of fun unit tests for FileSpec::Equal >> >> Most of them fail right now and are commented out. The main problem is >> handling >> of backslashes on windows, but also the posix path code has a couple of >> issues. >> >> Modified: >> lldb/trunk/unittests/Host/FileSpecTest.cpp >> >> Modified: lldb/trunk/unittests/Host/FileSpecTest.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSpecTest.cpp?rev=285393&r1=285392&r2=285393&view=diff >> >> ============================================================================== >> --- lldb/trunk/unittests/Host/FileSpecTest.cpp (original) >> +++ lldb/trunk/unittests/Host/FileSpecTest.cpp Fri Oct 28 06:28:01 2016 >> @@ -109,19 +109,92 @@ TEST(FileSpecTest, CopyByAppendingPathCo >> EXPECT_STREQ("bar", fs.GetFilename().GetCString()); >> } >> >> -TEST(FileSpecTest, Equal) { >> +static void Compare(const FileSpec &one, const FileSpec &two, bool >> full_match, >> + bool remove_backup_dots, bool result) { >> + EXPECT_EQ(result, FileSpec::Equal(one, two, full_match, >> remove_backup_dots)) >> + << "File one: " << one.GetCString() << "\nFile two: " << >> two.GetCString() >> + << "\nFull match: " << full_match >> + << "\nRemove backup dots: " << remove_backup_dots; >> +} >> + >> +TEST(FileSpecTest, EqualSeparator) { >> FileSpec backward("C:\\foo\\bar", false, FileSpec::ePathSyntaxWindows); >> FileSpec forward("C:/foo/bar", false, FileSpec::ePathSyntaxWindows); >> EXPECT_EQ(forward, backward); >> >> const bool full_match = true; >> const bool remove_backup_dots = true; >> - EXPECT_TRUE( >> - FileSpec::Equal(forward, backward, full_match, >> remove_backup_dots)); >> - EXPECT_TRUE( >> - FileSpec::Equal(forward, backward, full_match, >> !remove_backup_dots)); >> - EXPECT_TRUE( >> - FileSpec::Equal(forward, backward, !full_match, >> remove_backup_dots)); >> - EXPECT_TRUE( >> - FileSpec::Equal(forward, backward, !full_match, >> !remove_backup_dots)); >> + const bool match = true; >> + Compare(forward, backward, full_match, remove_backup_dots, match); >> + Compare(forward, backward, full_match, !remove_backup_dots, match); >> + Compare(forward, backward, !full_match, remove_backup_dots, match); >> + Compare(forward, backward, !full_match, !remove_backup_dots, match); >> +} >> + >> +#if 0 >> +TEST(FileSpecTest, EqualDotsWindows) { >> + const bool full_match = true; >> + const bool remove_backup_dots = true; >> + const bool match = true; >> + std::pair<const char *, const char *> tests[] = { >> + {R"(C:\foo\bar\baz)", R"(C:\foo\foo\..\bar\baz)"}, >> + {R"(C:\bar\baz)", R"(C:\foo\..\bar\baz)"}, >> + {R"(C:\bar\baz)", R"(C:/foo/../bar/baz)"}, >> + {R"(C:/bar/baz)", R"(C:\foo\..\bar\baz)"}, >> + {R"(C:\bar)", R"(C:\foo\..\bar)"}, >> + }; >> + >> + for(const auto &test: tests) { >> + FileSpec one(test.first, false, FileSpec::ePathSyntaxWindows); >> + FileSpec two(test.second, false, FileSpec::ePathSyntaxWindows); >> + EXPECT_NE(one, two); >> + Compare(one, two, full_match, remove_backup_dots, match); >> + Compare(one, two, full_match, !remove_backup_dots, !match); >> + Compare(one, two, !full_match, remove_backup_dots, match); >> + Compare(one, two, !full_match, !remove_backup_dots, match); >> + } >> + >> +} >> +#endif >> + >> +TEST(FileSpecTest, EqualDotsPosix) { >> + const bool full_match = true; >> + const bool remove_backup_dots = true; >> + const bool match = true; >> + std::pair<const char *, const char *> tests[] = { >> + {R"(/foo/bar/baz)", R"(/foo/foo/../bar/baz)"}, >> + {R"(/bar/baz)", R"(/foo/../bar/baz)"}, >> +// {R"(/bar)", R"(/foo/../bar)"}, >> + }; >> + >> + for(const auto &test: tests) { >> + FileSpec one(test.first, false, FileSpec::ePathSyntaxPosix); >> + FileSpec two(test.second, false, FileSpec::ePathSyntaxPosix); >> + EXPECT_NE(one, two); >> + Compare(one, two, full_match, remove_backup_dots, match); >> + Compare(one, two, full_match, !remove_backup_dots, !match); >> + Compare(one, two, !full_match, remove_backup_dots, match); >> +// Compare(one, two, !full_match, !remove_backup_dots, match); >> + } >> + >> +} >> + >> +#if 0 >> +TEST(FileSpecTest, EqualDotsPosixRoot) { >> + const bool full_match = true; >> + const bool remove_backup_dots = true; >> + const bool match = true; >> + std::pair<const char *, const char *> tests[] = { >> + {R"(/)", R"(/..)"}, >> + {R"(/)", R"(/foo/..)"}, >> + }; >> + >> + for(const auto &test: tests) { >> + FileSpec one(test.first, false, FileSpec::ePathSyntaxPosix); >> + FileSpec two(test.second, false, FileSpec::ePathSyntaxPosix); >> + EXPECT_NE(one, two); >> + Compare(one, two, full_match, remove_backup_dots, match); >> + Compare(one, two, !full_match, remove_backup_dots, match); >> + } >> } >> +#endif >> >> >> _______________________________________________ >> lldb-commits mailing list >> lldb-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits