• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Test that CoreFoundation classes CFGregorianDate and CFRange are not improperly uniqued
3"""
4
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class Rdar10967107TestCase(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_cfrange_diff_cfgregoriandate(self):
27        """Test that CoreFoundation classes CFGregorianDate and CFRange are not improperly uniqued."""
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,
37            self.main_source,
38            self.line,
39            num_expected_locations=1,
40            loc_exact=True)
41
42        self.runCmd("run", RUN_SUCCEEDED)
43        # check that each type is correctly bound to its list of children
44        self.expect(
45            "frame variable cf_greg_date --raw",
46            substrs=[
47                'year',
48                'month',
49                'day',
50                'hour',
51                'minute',
52                'second'])
53        self.expect(
54            "frame variable cf_range --raw",
55            substrs=[
56                'location',
57                'length'])
58        # check that printing both does not somehow confuse LLDB
59        self.expect(
60            "frame variable  --raw",
61            substrs=[
62                'year',
63                'month',
64                'day',
65                'hour',
66                'minute',
67                'second',
68                'location',
69                'length'])
70