1""" 2Test behavior of `po` and persistent results. 3""" 4 5import lldb 6from lldbsuite.test.lldbtest import * 7from lldbsuite.test.decorators import * 8from lldbsuite.test import lldbutil 9 10 11class TestCase(TestBase): 12 def setUp(self): 13 TestBase.setUp(self) 14 self.build() 15 lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.m")) 16 17 @skipUnlessDarwin 18 def test_po_does_not_print_persistent_result(self): 19 """Test `po` doesn't advertise a persistent result variable.""" 20 self.expect("po obj", matching=False, substrs=["$0 = "]) 21 22 @skipUnlessDarwin 23 def test_po_does_not_keep_persistent_result(self): 24 """Test `po` doesn't leak a persistent result variable.""" 25 self.expect("po obj") 26 # Verify `po` used a temporary persistent result. In other words, there 27 # should be no $0 at this point. 28 self.expect("expression $0", error=True) 29 self.expect("expression obj", substrs=["$0 = "]) 30 31 @skipUnlessDarwin 32 def test_expression_description_verbosity(self): 33 """Test printing object description _and_ opt-in to persistent results.""" 34 self.expect("expression -O -vfull -- obj", substrs=["$0 = "]) 35 self.expect("expression $0", substrs=["$0 = "]) 36