From 720b1ad6a06a7f9f8098e2288058aac29dd05aad Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Mon, 22 Jan 2024 11:10:43 -0800 Subject: [PATCH] [lldb] Add DebugDescription test (NFC) --- .../lang/swift/debugdescriptionmacro/Makefile | 3 +++ .../TestDebugDescriptionMacro.py | 17 +++++++++++++++++ .../lang/swift/debugdescriptionmacro/main.swift | 11 +++++++++++ 3 files changed, 31 insertions(+) create mode 100644 lldb/test/API/lang/swift/debugdescriptionmacro/Makefile create mode 100644 lldb/test/API/lang/swift/debugdescriptionmacro/TestDebugDescriptionMacro.py create mode 100644 lldb/test/API/lang/swift/debugdescriptionmacro/main.swift diff --git a/lldb/test/API/lang/swift/debugdescriptionmacro/Makefile b/lldb/test/API/lang/swift/debugdescriptionmacro/Makefile new file mode 100644 index 0000000000000..ecc3a5b117dd1 --- /dev/null +++ b/lldb/test/API/lang/swift/debugdescriptionmacro/Makefile @@ -0,0 +1,3 @@ +SWIFT_SOURCES := main.swift +SWIFTFLAGS_EXTRAS := -enable-experimental-feature SymbolLinkageMarkers +include Makefile.rules diff --git a/lldb/test/API/lang/swift/debugdescriptionmacro/TestDebugDescriptionMacro.py b/lldb/test/API/lang/swift/debugdescriptionmacro/TestDebugDescriptionMacro.py new file mode 100644 index 0000000000000..ec2b541008268 --- /dev/null +++ b/lldb/test/API/lang/swift/debugdescriptionmacro/TestDebugDescriptionMacro.py @@ -0,0 +1,17 @@ +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +import lldbsuite.test.lldbutil as lldbutil + + +class TestCase(TestBase): + @swiftTest + def test(self): + "docstring" + self.build() + _, _, thread, _ = lldbutil.run_to_source_breakpoint( + self, "break here", lldb.SBFileSpec("main.swift") + ) + frame = thread.frames[0] + unit = frame.FindVariable("unit") + self.assertEqual(unit.summary, '"fulfilled"') diff --git a/lldb/test/API/lang/swift/debugdescriptionmacro/main.swift b/lldb/test/API/lang/swift/debugdescriptionmacro/main.swift new file mode 100644 index 0000000000000..2bfab4893aa5e --- /dev/null +++ b/lldb/test/API/lang/swift/debugdescriptionmacro/main.swift @@ -0,0 +1,11 @@ +@_DebugDescription +struct Unit { + var description: String { "fulfilled" } +} + +func main() { + let unit = Unit() + print("break here", unit) +} + +main()