3 Test lldb data formatter subsystem.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
12 from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
15 class ObjCDataFormatterNSPlain(ObjCDataFormatterTestCase):
18 def test_plain_objc_with_run_command(self):
19 """Test basic ObjC formatting behavior."""
21 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
22 self, '// Set break point at this line.',
23 lldb.SBFileSpec('main.m', False))
25 # The stop reason of the thread should be breakpoint.
28 STOPPED_DUE_TO_BREAKPOINT,
29 substrs=['stopped', 'stop reason = breakpoint'])
31 # This is the function to remove the custom formats in order to have a
32 # clean slate for the next test case.
34 self.runCmd('type format clear', check=False)
35 self.runCmd('type summary clear', check=False)
36 self.runCmd('type synth clear', check=False)
38 # Execute the cleanup function during test case tear down.
39 self.addTearDownHook(cleanup)
41 self.runCmd("type summary add --summary-string \"${var%@}\" MyClass")
43 self.expect("frame variable object2", substrs=['MyOtherClass'])
45 self.expect("frame variable *object2", substrs=['MyOtherClass'])
47 # Now let's delete the 'MyClass' custom summary.
48 self.runCmd("type summary delete MyClass")
50 # The type format list should not show 'MyClass' at this point.
51 self.expect("type summary list", matching=False, substrs=['MyClass'])
53 self.runCmd("type summary add --summary-string \"a test\" MyClass")
56 "frame variable *object2",
57 substrs=['*object2 =', 'MyClass = a test', 'backup = '])
60 "frame variable object2", matching=False, substrs=['a test'])
62 self.expect("frame variable object", substrs=['a test'])
64 self.expect("frame variable *object", substrs=['a test'])
67 'frame variable myclass', substrs=['(Class) myclass = NSValue'])
69 'frame variable myclass2',
70 substrs=['(Class) myclass2 = ', 'NS', 'String'])
72 'frame variable myclass3', substrs=['(Class) myclass3 = Molecule'])
74 'frame variable myclass4',
75 substrs=['(Class) myclass4 = NSMutableArray'])
77 'frame variable myclass5', substrs=['(Class) myclass5 = nil'])