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
13@skipUnlessDarwin
14class FoundationTestCase2(TestBase):
15
16    mydir = TestBase.compute_mydir(__file__)
17
18    NO_DEBUG_INFO_TESTCASE = True
19
20    def test_expr_commands(self):
21        """More expression commands for objective-c."""
22        self.build()
23        main_spec = lldb.SBFileSpec("main.m")
24
25        (target, process, thread, bp) = lldbutil.run_to_source_breakpoint(
26            self, "Break here for selector: tests", main_spec)
27
28        # Test_Selector:
29        self.expect("expression (char *)sel_getName(sel)",
30                    substrs=["(char *)",
31                             "length"])
32
33        desc_bkpt = target.BreakpointCreateBySourceRegex("Break here for description test",
34                                                          main_spec)
35        self.assertEqual(desc_bkpt.GetNumLocations(), 1, "description breakpoint has a location")
36        lldbutil.continue_to_breakpoint(process, desc_bkpt)
37
38        self.expect("expression (char *)sel_getName(_cmd)",
39                    substrs=["(char *)",
40                             "description"])
41