brintos

brintos / llvm-project-archived public Read only

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