about summary refs log tree commit diff
path: root/src/test/debuginfo
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-08-14 23:59:04 +0800
committerGitHub <noreply@github.com>2018-08-14 23:59:04 +0800
commite401638d0813ed7302e67d4487f1899de1c24ad1 (patch)
tree0337dfbff4f88852c91c22b847e11aa4970022d4 /src/test/debuginfo
parentf45f52532a394d2d607fc5693364ad820049376d (diff)
parent6e562d24c6a2849516745da540fdebe832c114ee (diff)
downloadrust-e401638d0813ed7302e67d4487f1899de1c24ad1.tar.gz
rust-e401638d0813ed7302e67d4487f1899de1c24ad1.zip
Rollup merge of #53112 - fukatani:pretty-print-btreeset, r=michaelwoerister
pretty print BTreeSet

I want pretty printing for BTreeSet.
```rust
use std::collections::*;

fn main() {
  let mut s = BTreeSet::new();
  s.insert(5);
  s.insert(3);
  s.insert(7);
  s.remove(&3);
  println!("{:?}", s);
}
```

```
(gdb) b 9
(gdb) p s
$1 = BTreeSet<i32> with 2 elements = {[0] = 5, [1] = 7}
```
This is analogy of pretty printing for C++ std::set.
Diffstat (limited to 'src/test/debuginfo')
-rw-r--r--src/test/debuginfo/pretty-std-collections.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/test/debuginfo/pretty-std-collections.rs b/src/test/debuginfo/pretty-std-collections.rs
new file mode 100644
index 00000000000..18d73bf5677
--- /dev/null
+++ b/src/test/debuginfo/pretty-std-collections.rs
@@ -0,0 +1,50 @@
+// Copyright 2018 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.
+
+// ignore-windows failing on win32 bot
+// ignore-freebsd: gdb package too new
+// ignore-android: FIXME(#10381)
+// compile-flags:-g
+// min-gdb-version 7.7
+// min-lldb-version: 310
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: print btree_set
+// gdb-check:$1 = BTreeSet<i32>(len: 3) = {3, 5, 7}
+
+// gdb-command: print vec_deque
+// gdb-check:$2 = VecDeque<i32>(len: 3, cap: 8) = {5, 3, 7}
+
+#![allow(unused_variables)]
+use std::collections::BTreeSet;
+use std::collections::VecDeque;
+
+
+fn main() {
+
+    // BTreeSet
+    let mut btree_set = BTreeSet::new();
+    btree_set.insert(5);
+    btree_set.insert(3);
+    btree_set.insert(7);
+
+    // VecDeque
+    let mut vec_deque = VecDeque::new();
+    vec_deque.push_back(5);
+    vec_deque.push_back(3);
+    vec_deque.push_back(7);
+
+    zzz(); // #break
+}
+
+fn zzz() { () }