[Lldb-commits] [lldb] cb59267 - [lldb] Make TestOptionValueFileColonLine work on Windows

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 20 23:18:05 PDT 2020


Author: Jonas Devlieghere
Date: 2020-07-20T23:15:03-07:00
New Revision: cb5926795aaf4ca0059e8e4f985fcfd156a71477

URL: https://github.com/llvm/llvm-project/commit/cb5926795aaf4ca0059e8e4f985fcfd156a71477
DIFF: https://github.com/llvm/llvm-project/commit/cb5926795aaf4ca0059e8e4f985fcfd156a71477.diff

LOG: [lldb] Make TestOptionValueFileColonLine work on Windows

The colon in the file name is interpreted as a drive name and therefore
the path looks like foo:\\bar.c. Compare FileSpecs instead of their
string representation so we don't have to worry about that.

Added: 
    

Modified: 
    lldb/unittests/Interpreter/TestOptionValueFileColonLine.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Interpreter/TestOptionValueFileColonLine.cpp b/lldb/unittests/Interpreter/TestOptionValueFileColonLine.cpp
index 54e31333d835..079c26bdd8ab 100644
--- a/lldb/unittests/Interpreter/TestOptionValueFileColonLine.cpp
+++ b/lldb/unittests/Interpreter/TestOptionValueFileColonLine.cpp
@@ -13,7 +13,7 @@
 
 using namespace lldb_private;
 
-void CheckSetting(const char *input, bool success, const char *path = nullptr,
+void CheckSetting(const char *input, bool success, FileSpec path = {},
                   uint32_t line_number = LLDB_INVALID_LINE_NUMBER,
                   uint32_t column_number = LLDB_INVALID_COLUMN_NUMBER) {
 
@@ -29,8 +29,7 @@ void CheckSetting(const char *input, bool success, const char *path = nullptr,
 
   ASSERT_EQ(value.GetLineNumber(), line_number);
   ASSERT_EQ(value.GetColumnNumber(), column_number);
-  std::string value_path = value.GetFileSpec().GetPath();
-  ASSERT_STREQ(value_path.c_str(), path);
+  ASSERT_EQ(value.GetFileSpec(), path);
 }
 
 TEST(OptionValueFileColonLine, setFromString) {
@@ -48,11 +47,11 @@ TEST(OptionValueFileColonLine, setFromString) {
   CheckSetting("foo.c", false);
 
   // Now try with just a file & line:
-  CheckSetting("foo.c:12", true, "foo.c", 12);
-  CheckSetting("foo.c:12:20", true, "foo.c", 12, 20);
+  CheckSetting("foo.c:12", true, FileSpec("foo.c"), 12);
+  CheckSetting("foo.c:12:20", true, FileSpec("foo.c"), 12, 20);
   // Make sure a colon doesn't mess us up:
-  CheckSetting("foo:bar.c:12", true, "foo:bar.c", 12);
-  CheckSetting("foo:bar.c:12:20", true, "foo:bar.c", 12, 20);
+  CheckSetting("foo:bar.c:12", true, FileSpec("foo:bar.c"), 12);
+  CheckSetting("foo:bar.c:12:20", true, FileSpec("foo:bar.c"), 12, 20);
   // Try errors in the line number:
   CheckSetting("foo.c:12c", false);
   CheckSetting("foo.c:12:20c", false);


        


More information about the lldb-commits mailing list