xref: /llvm-project/lldb/test/API/lang/objc/foundation/TestObjCMethodsNSArray.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 FoundationTestCaseNSArray(TestBase):
13    def test_NSArray_expr_commands(self):
14        """Test expression commands for NSArray."""
15        self.build()
16        self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
17            self, "// Break here for NSArray tests", lldb.SBFileSpec("main.m", False)
18        )
19
20        self.runCmd("thread backtrace")
21        self.expect(
22            "expression (int)[nil_mutable_array count]", patterns=["\(int\) \$.* = 0"]
23        )
24        self.expect("expression (int)[array1 count]", patterns=["\(int\) \$.* = 3"])
25        self.expect("expression (int)[array2 count]", patterns=["\(int\) \$.* = 3"])
26        self.expect("expression (int)array1.count", patterns=["\(int\) \$.* = 3"])
27        self.expect("expression (int)array2.count", patterns=["\(int\) \$.* = 3"])
28        self.runCmd("process continue")
29