1""" 2Test that the po command acts correctly. 3""" 4 5 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11 12 13class PoVerbosityTestCase(TestBase): 14 15 mydir = TestBase.compute_mydir(__file__) 16 17 def setUp(self): 18 # Call super's setUp(). 19 TestBase.setUp(self) 20 # Find the line number to break for main.cpp. 21 self.line = line_number('main.m', 22 '// Stop here') 23 24 @add_test_categories(["objc"]) 25 def test(self): 26 """Test that the po command acts correctly.""" 27 self.build() 28 29 # This is the function to remove the custom formats in order to have a 30 # clean slate for the next test case. 31 def cleanup(): 32 self.runCmd('type summary clear', check=False) 33 self.runCmd('type synthetic clear', check=False) 34 35 # Execute the cleanup function during test case tear down. 36 self.addTearDownHook(cleanup) 37 38 """Test expr + formatters for good interoperability.""" 39 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) 40 41 lldbutil.run_break_set_by_file_and_line( 42 self, "main.m", self.line, loc_exact=True) 43 44 self.runCmd("run", RUN_SUCCEEDED) 45 46 self.expect("expr -O -v -- foo", 47 substrs=['(id) $', ' = 0x', '1 = 2', '2 = 3;']) 48 self.expect("expr -O -vfull -- foo", 49 substrs=['(id) $', ' = 0x', '1 = 2', '2 = 3;']) 50 self.expect("expr -O -- foo", matching=False, 51 substrs=['(id) $']) 52 53 self.expect("expr -O -- 22", matching=False, 54 substrs=['(int) $']) 55 self.expect("expr -O -- 22", 56 substrs=['22']) 57 58 self.expect("expr -O -vfull -- 22", 59 substrs=['(int) $', ' = 22']) 60 61 self.expect("expr -O -v -- 22", 62 substrs=['(int) $', ' = 22']) 63