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