46 lines · python
1import lldb2from lldbsuite.test.decorators import *3from lldbsuite.test.lldbtest import *4from lldbsuite.test import lldbutil5 6 7class TestObjcPoHint(TestBase):8 NO_DEBUG_INFO_TESTCASE = True9 10 def test_show_po_hint(self):11 ### Test that the po hint is shown once with the DWIM print command12 self.build()13 _, _, _, _ = lldbutil.run_to_source_breakpoint(14 self, "Set breakpoint here", lldb.SBFileSpec("main.m")15 )16 # Make sure the hint is printed the first time17 self.expect(18 "dwim-print -O -- foo",19 substrs=[20 "note: object description requested, but type doesn't implement "21 'a custom object description. Consider using "p" instead of "po"',22 "<Foo: 0x",23 ],24 )25 26 # Make sure it's not printed again.27 self.expect(28 "dwim-print -O -- foo",29 substrs=["note: object description"],30 matching=False,31 )32 33 def test_show_po_hint_disabled(self):34 ### Test that when the setting is disabled the hint is not printed35 self.build()36 _, _, _, _ = lldbutil.run_to_source_breakpoint(37 self, "Set breakpoint here", lldb.SBFileSpec("main.m")38 )39 self.runCmd("setting set show-dont-use-po-hint false")40 # Make sure the hint is not printed41 self.expect(42 "dwim-print -O -- foo",43 substrs=["note: object description"],44 matching=False,45 )46