|
9 | 9 |
|
10 | 10 |
|
11 | 11 | class LibcxxUnorderedMapDataFormatterTestCase(TestBase):
|
12 |
| - def check_reference(self, var_name: str, expected_type: str): |
13 |
| - self.expect_var_path( |
14 |
| - var_name, |
15 |
| - summary="size=1", |
16 |
| - type=expected_type, |
17 |
| - children=[ |
18 |
| - ValueCheck( |
19 |
| - name="[0]", |
20 |
| - children=[ |
21 |
| - ValueCheck(name="first", summary='"Hello"'), |
22 |
| - ValueCheck(name="second", summary='"World"'), |
23 |
| - ], |
24 |
| - ), |
25 |
| - ], |
26 |
| - ) |
| 12 | + def check_ptr_or_ref(self, var_name: str): |
| 13 | + var = self.frame().FindVariable(var_name) |
| 14 | + self.assertTrue(var) |
| 15 | + |
| 16 | + pair = var.GetChildAtIndex(0) |
| 17 | + self.assertTrue(pair) |
| 18 | + |
| 19 | + self.assertEqual(pair.GetChildAtIndex(0).summary, '"Hello"') |
| 20 | + self.assertEqual(pair.GetChildAtIndex(1).summary, '"World"') |
| 21 | + |
| 22 | + def check_ptr_ptr(self, var_name: str): |
| 23 | + var = self.frame().FindVariable(var_name) |
| 24 | + self.assertTrue(var) |
| 25 | + |
| 26 | + ptr = var.GetChildAtIndex(0) |
| 27 | + self.assertTrue(ptr) |
| 28 | + |
| 29 | + pair = ptr.GetChildAtIndex(0) |
| 30 | + self.assertTrue(pair) |
| 31 | + |
| 32 | + self.assertEqual(pair.GetChildAtIndex(0).summary, '"Hello"') |
| 33 | + self.assertEqual(pair.GetChildAtIndex(1).summary, '"World"') |
27 | 34 |
|
28 | 35 | @add_test_categories(["libc++"])
|
29 | 36 | def test_iterator_formatters(self):
|
@@ -84,16 +91,25 @@ def test_iterator_formatters(self):
|
84 | 91 | lldbutil.continue_to_breakpoint(process, bkpt)
|
85 | 92 |
|
86 | 93 | # Test references to std::unordered_map
|
87 |
| - self.check_reference("ref1", "const StringMapT &") |
88 |
| - self.check_reference("ref2", "StringMapT &") |
89 |
| - self.check_reference("ref3", "StringMapTRef") |
90 |
| - self.check_reference("ref4", "const StringMapT &") |
91 |
| - self.check_reference("ref5", "const StringMapT &&") |
92 |
| - self.check_reference("ref6", "StringMapT &&") |
| 94 | + self.check_ptr_or_ref("ref1") |
| 95 | + self.check_ptr_or_ref("ref2") |
| 96 | + self.check_ptr_or_ref("ref3") |
| 97 | + self.check_ptr_or_ref("ref4") |
| 98 | + self.check_ptr_or_ref("ref5") |
| 99 | + self.check_ptr_or_ref("ref6") |
93 | 100 |
|
94 | 101 | # FIXME: we're getting this wrong.
|
95 | 102 | self.expect_var_path(
|
96 | 103 | "ref7",
|
97 | 104 | summary="size=0",
|
98 | 105 | type="const StringMapT *const &",
|
99 | 106 | )
|
| 107 | + |
| 108 | + lldbutil.continue_to_breakpoint(process, bkpt) |
| 109 | + |
| 110 | + self.check_ptr_or_ref("ptr1") |
| 111 | + self.check_ptr_or_ref("ptr2") |
| 112 | + self.check_ptr_or_ref("ptr3") |
| 113 | + self.check_ptr_ptr("ptr4") |
| 114 | + self.check_ptr_ptr("ptr5") |
| 115 | + self.check_ptr_ptr("ptr6") |
0 commit comments