]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/expression_command/po_verbosity/TestPoVerbosity.py
Vendor import of lldb release_39 branch r276489:
[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 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
13
14 class PoVerbosityTestCase(TestBase):
15
16     mydir = TestBase.compute_mydir(__file__)
17
18     def setUp(self):
19         # Call super's setUp().
20         TestBase.setUp(self)
21         # Find the line number to break for main.cpp.
22         self.line = line_number('main.m',
23                                 '// Stop here')
24
25     @skipUnlessDarwin
26     def test(self):
27         """Test that the po command acts correctly."""
28         self.build()
29         
30         # This is the function to remove the custom formats in order to have a
31         # clean slate for the next test case.
32         def cleanup():
33             self.runCmd('type summary clear', check=False)
34             self.runCmd('type synthetic clear', check=False)
35         
36         # Execute the cleanup function during test case tear down.
37         self.addTearDownHook(cleanup)
38
39         """Test expr + formatters for good interoperability."""
40         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
41
42         lldbutil.run_break_set_by_file_and_line (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'])