1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // min-lldb-version: 310
15 // === GDB TESTS ===================================================================================
19 // gdb-command:print a
21 // gdb-command:print b
22 // gdb-check:$2 = false
24 // gdb-command:print c
26 // gdb-command:print d
28 // gdb-command:print e
31 // gdb-command:print f
33 // gdb-command:print g
34 // gdb-check:$7 = {__0 = 6, __1 = 7}
36 // gdb-command:print h
38 // gdb-command:print i
39 // gdb-check:$9 = {a = 9, b = 10}
40 // gdb-command:print j
43 // gdb-command:print k
45 // gdb-command:print l
48 // gdb-command:print m
50 // gdb-command:print n
53 // gdb-command:print o
56 // gdb-command:print p
58 // gdb-command:print q
60 // gdb-command:print r
61 // gdb-check:$18 = {a = 21, b = 22}
63 // gdb-command:print s
65 // gdb-command:print t
68 // gdb-command:print u
70 // gdb-command:print v
72 // gdb-command:print w
74 // gdb-command:print x
76 // gdb-command:print y
78 // gdb-command:print z
80 // gdb-command:print ae
82 // gdb-command:print oe
84 // gdb-command:print ue
87 // gdb-command:print aa
88 // gdb-check:$30 = {__0 = 34, __1 = 35}
90 // gdb-command:print bb
91 // gdb-check:$31 = {__0 = 36, __1 = 37}
93 // gdb-command:print cc
96 // gdb-command:print dd
97 // gdb-check:$33 = {__0 = 40, __1 = 41, __2 = 42}
99 // gdb-command:print *ee
100 // gdb-check:$34 = {__0 = 43, __1 = 44, __2 = 45}
102 // gdb-command:print *ff
103 // gdb-check:$35 = 46
105 // gdb-command:print gg
106 // gdb-check:$36 = {__0 = 47, __1 = 48}
108 // gdb-command:print *hh
109 // gdb-check:$37 = 50
111 // gdb-command:print ii
112 // gdb-check:$38 = 51
114 // gdb-command:print *jj
115 // gdb-check:$39 = 52
117 // gdb-command:print kk
118 // gdb-check:$40 = 53
120 // gdb-command:print ll
121 // gdb-check:$41 = 54
123 // gdb-command:print mm
124 // gdb-check:$42 = 55
126 // gdb-command:print *nn
127 // gdb-check:$43 = 56
130 // === LLDB TESTS ==================================================================================
134 // lldb-command:print a
135 // lldb-check:[...]$0 = 1
136 // lldb-command:print b
137 // lldb-check:[...]$1 = false
139 // lldb-command:print c
140 // lldb-check:[...]$2 = 2
141 // lldb-command:print d
142 // lldb-check:[...]$3 = 3
143 // lldb-command:print e
144 // lldb-check:[...]$4 = 4
146 // lldb-command:print f
147 // lldb-check:[...]$5 = 5
148 // lldb-command:print g
149 // lldb-check:[...]$6 = (6, 7)
151 // lldb-command:print h
152 // lldb-check:[...]$7 = 8
153 // lldb-command:print i
154 // lldb-check:[...]$8 = Struct { a: 9, b: 10 }
155 // lldb-command:print j
156 // lldb-check:[...]$9 = 11
158 // lldb-command:print k
159 // lldb-check:[...]$10 = 12
160 // lldb-command:print l
161 // lldb-check:[...]$11 = 13
163 // lldb-command:print m
164 // lldb-check:[...]$12 = 14
165 // lldb-command:print n
166 // lldb-check:[...]$13 = 16
168 // lldb-command:print o
169 // lldb-check:[...]$14 = 18
171 // lldb-command:print p
172 // lldb-check:[...]$15 = 19
173 // lldb-command:print q
174 // lldb-check:[...]$16 = 20
175 // lldb-command:print r
176 // lldb-check:[...]$17 = Struct { a: 21, b: 22 }
178 // lldb-command:print s
179 // lldb-check:[...]$18 = 24
180 // lldb-command:print t
181 // lldb-check:[...]$19 = 23
183 // lldb-command:print u
184 // lldb-check:[...]$20 = 25
185 // lldb-command:print v
186 // lldb-check:[...]$21 = 26
187 // lldb-command:print w
188 // lldb-check:[...]$22 = 27
189 // lldb-command:print x
190 // lldb-check:[...]$23 = 28
191 // lldb-command:print y
192 // lldb-check:[...]$24 = 29
193 // lldb-command:print z
194 // lldb-check:[...]$25 = 30
195 // lldb-command:print ae
196 // lldb-check:[...]$26 = 31
197 // lldb-command:print oe
198 // lldb-check:[...]$27 = 32
199 // lldb-command:print ue
200 // lldb-check:[...]$28 = 33
202 // lldb-command:print aa
203 // lldb-check:[...]$29 = (34, 35)
205 // lldb-command:print bb
206 // lldb-check:[...]$30 = (36, 37)
208 // lldb-command:print cc
209 // lldb-check:[...]$31 = 38
211 // lldb-command:print dd
212 // lldb-check:[...]$32 = (40, 41, 42)
214 // lldb-command:print *ee
215 // lldb-check:[...]$33 = (43, 44, 45)
217 // lldb-command:print *ff
218 // lldb-check:[...]$34 = 46
220 // lldb-command:print gg
221 // lldb-check:[...]$35 = (47, 48)
223 // lldb-command:print *hh
224 // lldb-check:[...]$36 = 50
226 // lldb-command:print ii
227 // lldb-check:[...]$37 = 51
229 // lldb-command:print *jj
230 // lldb-check:[...]$38 = 52
232 // lldb-command:print kk
233 // lldb-check:[...]$39 = 53
235 // lldb-command:print ll
236 // lldb-check:[...]$40 = 54
238 // lldb-command:print mm
239 // lldb-check:[...]$41 = 55
241 // lldb-command:print *nn
242 // lldb-check:[...]$42 = 56
245 #![allow(unused_variables)]
246 #![feature(box_patterns)]
247 #![feature(box_syntax)]
248 #![feature(omit_gdb_pretty_printer_section)]
249 #![omit_gdb_pretty_printer_section]
251 use self::Univariant::Unit;
262 struct TupleStruct (f64, isize);
267 let (a, b) : (isize, bool) = (1, false);
270 let (c, (d, e)) : (isize, (u16, u16)) = (2, (3, 4));
272 // bind tuple-typed value to one name (destructure only first level)
273 let (f, g) : (isize, (u32, u32)) = (5, (6, 7));
275 // struct as tuple element
276 let (h, i, j) : (i16, Struct, i16) = (8, Struct { a: 9, b: 10 }, 11);
279 let Struct { a: k, b: l } = Struct { a: 12, b: 13 };
281 // ignored tuple element
282 let (m, _, n) = (14, 15, 16);
284 // ignored struct field
285 let Struct { b: o, .. } = Struct { a: 17, b: 18 };
287 // one struct destructured, one not
288 let (Struct { a: p, b: q }, r) = (Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 });
290 // different order of struct fields
291 let Struct { b: s, a: t } = Struct { a: 23, b: 24 };
294 let ((u, v), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue) =
295 ((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33);
303 // contained reference
304 let (&cc, _) = (&38, 39);
307 let box dd = box (40, 41, 42);
310 let ref ee = (43, 44, 45);
312 // ref binding in tuple
313 let (ref ff, gg) = (46, (47, 48));
315 // ref binding in struct
316 let Struct { b: ref hh, .. } = Struct { a: 49, b: 50 };
319 let Unit(ii) = Unit(51);
321 // univariant enum with ref binding
322 let &Unit(ref jj) = &Unit(52);
325 let &TupleStruct(kk, ll) = &TupleStruct(53.0, 54);
327 // tuple struct with ref binding
328 let &TupleStruct(mm, ref nn) = &TupleStruct(55.0, 56);