From cb5926795aaf4ca0059e8e4f985fcfd156a71477 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 20 Jul 2020 23:13:01 -0700 Subject: [PATCH] [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. --- lldb/unittests/Interpreter/TestOptionValueFileColonLine.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lldb/unittests/Interpreter/TestOptionValueFileColonLine.cpp b/lldb/unittests/Interpreter/TestOptionValueFileColonLine.cpp index 54e3133..079c26b 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); -- 2.7.4