about summary refs log tree commit diff
path: root/src/test/debug-info
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@gmail>2013-06-28 11:56:35 +0200
committerMichael Woerister <michaelwoerister@gmail>2013-07-19 07:53:58 +0200
commit36ea75683105447cb9f8338cd2a70493f4eb2c70 (patch)
tree6f099a2b31c283c32c2863686927c3da158c252c /src/test/debug-info
parent7a31a3e0716f33ceb7c7278cb7da4acbafd97e17 (diff)
debuginfo: Refactored vec slice code to use the new infrastructure. Added test cases for vec slices.
Diffstat (limited to 'src/test/debug-info')
-rw-r--r--src/test/debug-info/vec-slices.rs70
-rw-r--r--src/test/debug-info/vec.rs18
2 files changed, 74 insertions, 14 deletions
diff --git a/src/test/debug-info/vec-slices.rs b/src/test/debug-info/vec-slices.rs
new file mode 100644
index 00000000000..a7e47f992fc
--- /dev/null
+++ b/src/test/debug-info/vec-slices.rs
@@ -0,0 +1,70 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:-Z extra-debug-info
+// debugger:set print pretty off
+// debugger:break zzz
+// debugger:run
+// debugger:finish
+// debugger:print empty.size_in_bytes
+// check:$1 = 0
+
+// debugger:print singleton.size_in_bytes
+// check:$2 = 8
+// debugger:print *((int64_t[1]*)(singleton.data_ptr))
+// check:$3 = {1}
+
+// debugger:print multiple.size_in_bytes
+// check:$4 = 32
+// debugger:print *((int64_t[4]*)(multiple.data_ptr))
+// check:$5 = {2, 3, 4, 5}
+
+// debugger:print slice_of_slice.size_in_bytes
+// check:$6 = 16
+// debugger:print *((int64_t[2]*)(slice_of_slice.data_ptr))
+// check:$7 = {3, 4}
+
+// debugger:print padded_tuple.size_in_bytes
+// check:$8 = 16
+// debugger:print padded_tuple.data_ptr[0]
+// check:$9 = {6, 7}
+// debugger:print padded_tuple.data_ptr[1]
+// check:$10 = {8, 9}
+
+// debugger:print padded_struct.size_in_bytes
+// check:$11 = 24
+// debugger:print padded_struct.data_ptr[0]
+// check:$12 = {x = 10, y = 11, z = 12}
+// debugger:print padded_struct.data_ptr[1]
+// check:$13 = {x = 13, y = 14, z = 15}
+
+struct AStruct {
+    x: i16,
+    y: i32,
+    z: i16
+}
+
+fn main() {
+    let empty : &[i64] = &[];
+    let singleton : &[i64] = &[1];
+    let multiple : &[i64] = &[2, 3, 4, 5];
+    let slice_of_slice = multiple.slice(1,3);
+
+    let padded_tuple : &[(i32, i16)] = &[(6, 7), (8, 9)];
+
+    let padded_struct : &[AStruct] = &[
+        AStruct { x: 10, y: 11, z: 12 },
+        AStruct { x: 13, y: 14, z: 15 }
+    ];
+
+    zzz();
+}
+
+fn zzz() {()}
diff --git a/src/test/debug-info/vec.rs b/src/test/debug-info/vec.rs
index f198a53729e..a9aca58fad7 100644
--- a/src/test/debug-info/vec.rs
+++ b/src/test/debug-info/vec.rs
@@ -8,28 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// xfail-test
-
 // compile-flags:-Z extra-debug-info
 // debugger:set print pretty off
-// debugger:break _zzz
+// debugger:break zzz
 // debugger:run
 // debugger:finish
 // debugger:print a
 // check:$1 = {1, 2, 3}
-// debugger:print b.vec[0]
-// check:$2 = 4
-// debugger:print c->boxed.data[1]
-// check:$3 = 8
-// debugger:print d->boxed.data[2]
-// check:$4 = 12
 
 fn main() {
     let a = [1, 2, 3];
-    let b = &[4, 5, 6];
-    let c = @[7, 8, 9];
-    let d = ~[10, 11, 12];
-    _zzz();
+
+    zzz();
 }
 
-fn _zzz() {()}
+fn zzz() {()}