1 """Test that we properly vend children for a single entry NSDictionary"""
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
14 class ObjCSingleEntryDictionaryTestCase(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
19 # Call super's setUp().
21 # Find the line number to break inside main().
22 self.line = line_number('main.m', '// break here')
25 @expectedFailureAll(oslist=['watchos'], bugnumber="rdar://problem/34642736") # bug in NSDictionary formatting on watchos
26 def test_single_entry_dict(self):
28 exe = self.getBuildArtifact("a.out")
29 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
31 # Break inside the foo function which takes a bar_ptr argument.
32 lldbutil.run_break_set_by_file_and_line(
33 self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
35 self.runCmd("run", RUN_SUCCEEDED)
37 # The stop reason of the thread should be breakpoint.
38 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
40 'stop reason = breakpoint'])
42 # The breakpoint should have a hit count of 1.
43 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
44 substrs=[' resolved, hit count = 1'])
46 d1 = self.frame().FindVariable("d1")
47 d1.SetPreferSyntheticValue(True)
48 d1.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
51 d1.GetNumChildren() == 1,
52 "dictionary has != 1 child elements")
53 pair = d1.GetChildAtIndex(0)
54 pair.SetPreferSyntheticValue(True)
55 pair.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
58 pair.GetNumChildren() == 2,
59 "pair has != 2 child elements")
61 key = pair.GetChildMemberWithName("key")
62 value = pair.GetChildMemberWithName("value")
64 key.SetPreferSyntheticValue(True)
65 key.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
66 value.SetPreferSyntheticValue(True)
67 value.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
70 key.GetSummary() == '@"key"',
71 "key doesn't contain key")
73 value.GetSummary() == '@"value"',
74 "value doesn't contain value")