brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · b508a9f Raw
67 lines · python
1"""2Test lldb data formatter subsystem.3"""4 5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11 12class DataFormatterOneIsSingularTestCase(TestBase):13    @skipUnlessDarwin14    def test_one_is_singular_with_run_command(self):15        """Test that 1 item is not as reported as 1 items."""16        self.build()17        self.oneness_data_formatter_commands()18 19    def setUp(self):20        # Call super's setUp().21        TestBase.setUp(self)22        # Find the line number to break at.23        self.line = line_number("main.m", "// Set break point at this line.")24 25    def oneness_data_formatter_commands(self):26        """Test that 1 item is not as reported as 1 items."""27        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)28 29        lldbutil.run_break_set_by_file_and_line(30            self, "main.m", self.line, num_expected_locations=1, loc_exact=True31        )32 33        self.runCmd("run", RUN_SUCCEEDED)34 35        # The stop reason of the thread should be breakpoint.36        self.expect(37            "thread list",38            STOPPED_DUE_TO_BREAKPOINT,39            substrs=["stopped", "stop reason = breakpoint"],40        )41 42        # This is the function to remove the custom formats in order to have a43        # clean slate for the next test case.44        def cleanup():45            self.runCmd("type format clear", check=False)46            self.runCmd("type summary clear", check=False)47            self.runCmd("type synth clear", check=False)48 49        # Execute the cleanup function during test case tear down.50        self.addTearDownHook(cleanup)51 52        # Now check that we are displaying Cocoa classes correctly53        self.expect("frame variable key", substrs=['@"1 element"'])54        self.expect("frame variable key", matching=False, substrs=["1 elements"])55        self.expect("frame variable value", substrs=['@"1 element"'])56        self.expect("frame variable value", matching=False, substrs=["1 elements"])57        self.expect("frame variable dict", substrs=["1 key/value pair"])58        self.expect(59            "frame variable dict", matching=False, substrs=["1 key/value pairs"]60        )61        self.expect("frame variable imset", substrs=["1 index"])62        self.expect("frame variable imset", matching=False, substrs=["1 indexes"])63        self.expect("frame variable binheap_ref", substrs=['@"1 item"'])64        self.expect("frame variable binheap_ref", matching=False, substrs=["1 items"])65        self.expect("frame variable immutableData", substrs=["1 byte"])66        self.expect("frame variable immutableData", matching=False, substrs=["1 bytes"])67