1"""
2Test more expression command sequences with objective-c.
3"""
4
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class FoundationTestCase2(TestBase):
14
15    mydir = TestBase.compute_mydir(__file__)
16
17    NO_DEBUG_INFO_TESTCASE = True
18
19    def test_expr_commands(self):
20        """More expression commands for objective-c."""
21        self.build()
22        main_spec = lldb.SBFileSpec("main.m")
23
24        (target, process, thread, bp) = lldbutil.run_to_source_breakpoint(
25            self, "Break here for selector: tests", main_spec)
26
27        # Test_Selector:
28        self.expect("expression (char *)sel_getName(sel)",
29                    substrs=["(char *)",
30                             "length"])
31
32        desc_bkpt = target.BreakpointCreateBySourceRegex("Break here for description test",
33                                                          main_spec)
34        self.assertEqual(desc_bkpt.GetNumLocations(), 1, "description breakpoint has a location")
35        lldbutil.continue_to_breakpoint(process, desc_bkpt)
36
37        self.expect("expression (char *)sel_getName(_cmd)",
38                    substrs=["(char *)",
39                             "description"])
40