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