|
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 | + ) |
| 27 | + |
12 | 28 | @add_test_categories(["libc++"]) |
13 | 29 | def test_iterator_formatters(self): |
14 | 30 | """Test that std::unordered_map related structures are formatted correctly when printed. |
@@ -68,123 +84,12 @@ def test_iterator_formatters(self): |
68 | 84 | lldbutil.continue_to_breakpoint(process, bkpt) |
69 | 85 |
|
70 | 86 | # Test references to std::unordered_map |
71 | | - self.expect_var_path( |
72 | | - "ref1", |
73 | | - summary="size=2", |
74 | | - type="const StringMapT &", |
75 | | - children=[ |
76 | | - ValueCheck( |
77 | | - name="[0]", |
78 | | - children=[ |
79 | | - ValueCheck(name="first", summary='"Baz"'), |
80 | | - ValueCheck(name="second", summary='"Qux"'), |
81 | | - ], |
82 | | - ), |
83 | | - ValueCheck( |
84 | | - name="[1]", |
85 | | - children=[ |
86 | | - ValueCheck(name="first", summary='"Foo"'), |
87 | | - ValueCheck(name="second", summary='"Bar"'), |
88 | | - ], |
89 | | - ), |
90 | | - ], |
91 | | - ) |
92 | | - |
93 | | - self.expect_var_path( |
94 | | - "ref2", |
95 | | - summary="size=2", |
96 | | - type="StringMapT &", |
97 | | - children=[ |
98 | | - ValueCheck( |
99 | | - name="[0]", |
100 | | - children=[ |
101 | | - ValueCheck(name="first", summary='"Baz"'), |
102 | | - ValueCheck(name="second", summary='"Qux"'), |
103 | | - ], |
104 | | - ), |
105 | | - ValueCheck( |
106 | | - name="[1]", |
107 | | - children=[ |
108 | | - ValueCheck(name="first", summary='"Foo"'), |
109 | | - ValueCheck(name="second", summary='"Bar"'), |
110 | | - ], |
111 | | - ), |
112 | | - ], |
113 | | - ) |
114 | | - |
115 | | - self.expect_var_path( |
116 | | - "ref3", |
117 | | - summary="size=2", |
118 | | - type="StringMapTRef", |
119 | | - children=[ |
120 | | - ValueCheck( |
121 | | - name="[0]", |
122 | | - children=[ |
123 | | - ValueCheck(name="first", summary='"Baz"'), |
124 | | - ValueCheck(name="second", summary='"Qux"'), |
125 | | - ], |
126 | | - ), |
127 | | - ValueCheck( |
128 | | - name="[1]", |
129 | | - children=[ |
130 | | - ValueCheck(name="first", summary='"Foo"'), |
131 | | - ValueCheck(name="second", summary='"Bar"'), |
132 | | - ], |
133 | | - ), |
134 | | - ], |
135 | | - ) |
136 | | - |
137 | | - self.expect_var_path( |
138 | | - "ref4", |
139 | | - summary="size=2", |
140 | | - type="const StringMapT &", |
141 | | - children=[ |
142 | | - ValueCheck( |
143 | | - name="[0]", |
144 | | - children=[ |
145 | | - ValueCheck(name="first", summary='"Baz"'), |
146 | | - ValueCheck(name="second", summary='"Qux"'), |
147 | | - ], |
148 | | - ), |
149 | | - ValueCheck( |
150 | | - name="[1]", |
151 | | - children=[ |
152 | | - ValueCheck(name="first", summary='"Foo"'), |
153 | | - ValueCheck(name="second", summary='"Bar"'), |
154 | | - ], |
155 | | - ), |
156 | | - ], |
157 | | - ) |
158 | | - |
159 | | - self.expect_var_path( |
160 | | - "ref5", |
161 | | - summary="size=1", |
162 | | - type="const StringMapT &&", |
163 | | - children=[ |
164 | | - ValueCheck( |
165 | | - name="[0]", |
166 | | - children=[ |
167 | | - ValueCheck(name="first", summary='"Foo"'), |
168 | | - ValueCheck(name="second", summary='"Bar"'), |
169 | | - ], |
170 | | - ), |
171 | | - ], |
172 | | - ) |
173 | | - |
174 | | - self.expect_var_path( |
175 | | - "ref6", |
176 | | - summary="size=1", |
177 | | - type="StringMapT &&", |
178 | | - children=[ |
179 | | - ValueCheck( |
180 | | - name="[0]", |
181 | | - children=[ |
182 | | - ValueCheck(name="first", summary='"Baz"'), |
183 | | - ValueCheck(name="second", summary='"Qux"'), |
184 | | - ], |
185 | | - ), |
186 | | - ], |
187 | | - ) |
| 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 &&") |
188 | 93 |
|
189 | 94 | # FIXME: we're getting this wrong. |
190 | 95 | self.expect_var_path( |
|
0 commit comments