about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorBrian Leibig <brian.leibig@gmail.com>2013-02-09 13:09:19 -0500
committerBrian Leibig <brian.leibig@gmail.com>2013-02-09 13:09:19 -0500
commit6bfbdadd3bdb811c16f4aecd1f123c1a1eb0ee2e (patch)
treeb856d591ec04d8983981f890664b5432ee1a0902 /src/test
parent0c2b4edff5009ff4d2330723d9acbc85af4b12ab (diff)
Add debug info tests
Diffstat (limited to 'src/test')
-rw-r--r--src/test/debug-info/simple.rs21
-rw-r--r--src/test/debug-info/struct.rs33
2 files changed, 54 insertions, 0 deletions
diff --git a/src/test/debug-info/simple.rs b/src/test/debug-info/simple.rs
new file mode 100644
index 00000000000..51bb177601a
--- /dev/null
+++ b/src/test/debug-info/simple.rs
@@ -0,0 +1,21 @@
+// 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.
+
+// xfail-test
+// compile-flags:-g
+// debugger:break 20
+// debugger:run
+// debugger:print x
+// check:$1 = 42
+
+fn main() {
+    let x = 42;
+    debug!("The answer is %d", x);
+}
diff --git a/src/test/debug-info/struct.rs b/src/test/debug-info/struct.rs
new file mode 100644
index 00000000000..b3132914477
--- /dev/null
+++ b/src/test/debug-info/struct.rs
@@ -0,0 +1,33 @@
+// 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.
+
+// xfail-test
+// compile-flags:-g
+// debugger:break 32
+// debugger:run
+// debugger:print pair
+// check:$1 = {
+// check:x = 1,
+// check:y = 2,
+// check:}
+// debugger:print pair.x
+// check:$2 = 1
+// debugger:print pair.y
+// check:$3 = 2
+
+struct Pair {
+    x: int,
+    y: int
+}
+
+fn main() {
+    let pair = Pair { x: 1, y: 2 };
+    debug!("x = %d, y = %d", pair.x, pair.y);
+}