]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/expression_command/po_verbosity/TestPoVerbosity.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / expression_command / po_verbosity / TestPoVerbosity.py
1 """
2 Test that the po command acts correctly.
3 """
4
5 from __future__ import print_function
6
7
8
9 import lldb
10 import lldbsuite.test.lldbutil as lldbutil
11 from lldbsuite.test.lldbtest import *
12
13 class 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     @skipUnlessDarwin
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 a.out", CURRENT_EXECUTABLE_SET)
40
41         lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, loc_exact=True)
42
43         self.runCmd("run", RUN_SUCCEEDED)
44         
45         self.expect("expr -O -v -- foo",
46             substrs = ['(id) $',' = 0x', '1 = 2','2 = 3;'])
47         self.expect("expr -O -vfull -- foo",
48             substrs = ['(id) $',' = 0x', '1 = 2','2 = 3;'])
49         self.expect("expr -O -- foo",matching=False,
50             substrs = ['(id) $'])
51
52         self.expect("expr -O -- 22",matching=False,
53             substrs = ['(int) $'])
54         self.expect("expr -O -- 22",
55             substrs = ['22'])
56
57         self.expect("expr -O -vfull -- 22",
58             substrs = ['(int) $', ' = 22'])
59
60         self.expect("expr -O -v -- 22",
61             substrs = ['(int) $', ' = 22'])