• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Test that objective-c method returning BOOL works correctly.
3"""
4
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class MethodReturningBOOLTestCase(TestBase):
14
15    mydir = TestBase.compute_mydir(__file__)
16
17    def setUp(self):
18        # Call super's setUp().
19        TestBase.setUp(self)
20        # We'll use the test method name as the exe_name.
21        self.exe_name = self.testMethodName
22        # Find the line number to break inside main().
23        self.main_source = "main.m"
24        self.line = line_number(self.main_source, '// Set breakpoint here.')
25
26    def test_method_ret_BOOL(self):
27        """Test that objective-c method returning BOOL works correctly."""
28        d = {'EXE': self.exe_name}
29        self.build(dictionary=d)
30        self.setTearDownCleanup(dictionary=d)
31
32        exe = self.getBuildArtifact(self.exe_name)
33        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
34
35        lldbutil.run_break_set_by_file_and_line(
36            self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
37
38        self.runCmd("run", RUN_SUCCEEDED)
39        self.expect(
40            "process status",
41            STOPPED_DUE_TO_BREAKPOINT,
42            substrs=[
43                "stop reason = breakpoint",
44                " at %s:%d" % (self.main_source, self.line),
45            ])
46
47        # rdar://problem/9691614
48        self.runCmd('p (int)[my isValid]')
49