]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / lang / objc / radar-9691614 / TestObjCMethodReturningBOOL.py
1 """
2 Test that objective-c method returning BOOL works correctly.
3 """
4
5 from __future__ import print_function
6
7
8
9 import os, time
10 import lldb
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
14
15 @skipUnlessDarwin
16 class MethodReturningBOOLTestCase(TestBase):
17
18     mydir = TestBase.compute_mydir(__file__)
19
20     def setUp(self):
21         # Call super's setUp().
22         TestBase.setUp(self)
23         # We'll use the test method name as the exe_name.
24         self.exe_name = self.testMethodName
25         # Find the line number to break inside main().
26         self.main_source = "main.m"
27         self.line = line_number(self.main_source, '// Set breakpoint here.')
28
29     def test_method_ret_BOOL(self):
30         """Test that objective-c method returning BOOL works correctly."""
31         d = {'EXE': self.exe_name}
32         self.build(dictionary=d)
33         self.setTearDownCleanup(dictionary=d)
34
35         exe = os.path.join(os.getcwd(), self.exe_name)
36         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
37
38         lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
39
40         self.runCmd("run", RUN_SUCCEEDED)
41         self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
42             substrs = [" at %s:%d" % (self.main_source, self.line),
43                        "stop reason = breakpoint"])
44
45         # rdar://problem/9691614
46         self.runCmd('p (int)[my isValid]')