[Lldb-commits] [PATCH] D133366: [lldb] Fix SBFileSpec.fullpath for Windows

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 11 14:51:24 PST 2022


kastiglione updated this revision to Diff 474866.
kastiglione added a comment.

Add a test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133366/new/

https://reviews.llvm.org/D133366

Files:
  lldb/bindings/interface/SBFileSpec.i
  lldb/test/API/python_api/file_spec/TestFileSpecAPI.py


Index: lldb/test/API/python_api/file_spec/TestFileSpecAPI.py
===================================================================
--- /dev/null
+++ lldb/test/API/python_api/file_spec/TestFileSpecAPI.py
@@ -0,0 +1,15 @@
+import lldb
+import os
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def test_full_path(self):
+        file_spec = lldb.SBFileSpec()
+        file_spec.SetDirectory("a")
+        file_spec.SetFilename("b")
+        self.assertEqual(file_spec.fullpath, os.path.join("a", "b"))
Index: lldb/bindings/interface/SBFileSpec.i
===================================================================
--- lldb/bindings/interface/SBFileSpec.i
+++ lldb/bindings/interface/SBFileSpec.i
@@ -88,7 +88,7 @@
             spec_dir = self.GetDirectory()
             spec_file = self.GetFilename()
             if spec_dir and spec_file:
-                return '%s/%s' % (spec_dir, spec_file)
+                return os.path.join(spec_dir, spec_file)
             elif spec_dir:
                 return spec_dir
             elif spec_file:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133366.474866.patch
Type: text/x-patch
Size: 1184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221111/3acf8c15/attachment.bin>


More information about the lldb-commits mailing list