Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ def test_value_types(self):
"""Test 'po' on a variety of value types with and without custom descriptions."""
self.build()
(_,_,_,_) = lldbutil.run_to_source_breakpoint(self, "Break here to run tests", lldb.SBFileSpec("main.swift"))

self.expect("po dm", substrs=['a', '12', 'b', '24'])
self.expect("po cm", substrs=['c', '36'])
self.expect("po cm", substrs=['12', '24'], matching=False)
self.expect("po cs", substrs=['CustomDebugStringConvertible'])
self.expect("po cs", substrs=['CustomStringConvertible'], matching=False)
self.expect("po cs", substrs=['a', '12', 'b', '24'])
self.expect("script lldb.frame.FindVariable('cs').GetObjectDescription()", substrs=['a', '12', 'b', '24'])
self.expect("po cs", substrs=["abc", "12", "def", "24"], matching=False)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does matching=False do?

Copy link
Author

@kastiglione kastiglione Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It tests that the substrings are not found in the output.

With the updated behavior in swiftlang/swift#84677, the properties (abc, def) should not be shown because the type conforms to CustomStringConvertible/CustomDebugStringConvertible.

self.expect(
"script lldb.frame.FindVariable('cs').GetObjectDescription()",
patterns=["abc", "12", "def", "24"],
matching=False,
)
self.expect("po (12,24,36,48)", substrs=['12', '24', '36', '48'])
self.expect("po (dm as Any, cm as Any,48 as Any)", substrs=['12', '24', '36', '48'])
self.expect("po patatino", substrs=['foo'])
Expand All @@ -46,6 +50,3 @@ def test_ignore_bkpts_in_po(self):
# As part of the po expression we should auto-continue past the breakpoint so this succeeds:
self.expect("po cs", substrs=['CustomDebugStringConvertible'])
self.assertEqual(po_bkpt.GetHitCount(), 1, "Did hit the breakpoint")



4 changes: 2 additions & 2 deletions lldb/test/API/lang/swift/po/val_types/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ struct CustomMirror : CustomReflectable {
}

struct CustomSummary : CustomStringConvertible, CustomDebugStringConvertible {
var a = 12
var b = 24
var abc = 12
var def = 24

var description: String {
return "CustomStringConvertible"
Expand Down